From e313300d2446c2efdc1d221304a6b6454fe7fa54 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Thu, 31 Jul 2025 15:49:39 -0700 Subject: Fix segmentation fault in ray tracing parameter consolidation. (#7997) * Initial plan * Fix segfault in ray tracing parameter consolidation Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Fix. * Fix. * Keep entrypoint param layout consistent during `MoveEntryPointUniformParametersToGlobalScope`. * Fix. * fix. * Fix. * Fix pending layout handling. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> Co-authored-by: Yong He --- .../ray-tracing-paramblock-regression.slang | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tests/pipeline/ray-tracing/ray-tracing-paramblock-regression.slang (limited to 'tests') diff --git a/tests/pipeline/ray-tracing/ray-tracing-paramblock-regression.slang b/tests/pipeline/ray-tracing/ray-tracing-paramblock-regression.slang new file mode 100644 index 000000000..657618ce3 --- /dev/null +++ b/tests/pipeline/ray-tracing/ray-tracing-paramblock-regression.slang @@ -0,0 +1,43 @@ +// ray-tracing-paramblock-regression.slang + +// Regression test for fix to segfault when using ParameterBlock with generics +// in ray tracing shaders + +//TEST:SIMPLE(filecheck=CHECK): -target spirv + +interface IMatData {} + +struct PerDrawSubmesh where T : IMatData +{ + T* p_mat_data; +} + +struct RtUbo where T : IMatData +{ + PerDrawSubmesh* p_per_dsm_buff; +} + +struct RtPayload +{ + float3 emission = float3(0); +} + +struct RtParams where T : IMatData +{ + RtUbo ubo; +}; + +struct MatData : IMatData +{ + float4 emission; +} + +// This used to cause a segfault before the fix +[shader("closesthit")] +void chit_main_with_paramblock(uniform ParameterBlock> params, in BuiltInTriangleIntersectionAttributes attr, out RtPayload payload) +{ + payload = {}; + payload.emission = float3(1, 0, 0); +} + +// CHECK: OpEntryPoint \ No newline at end of file -- cgit v1.2.3