yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
e313300d2
master
1// ray-tracing-paramblock-regression.slang 2 3// Regression test for fix to segfault when using ParameterBlock with generics 4// in ray tracing shaders 5 6//TEST:SIMPLE(filecheck=CHECK): -target spirv 7 8interface IMatData {} 9 10struct PerDrawSubmesh<T> where T : IMatData 11{ 12 T* p_mat_data; 13} 14 15struct RtUbo<T> where T : IMatData 16{ 17 PerDrawSubmesh<T>* p_per_dsm_buff; 18} 19 20struct RtPayload 21{ 22 float3 emission = float3(0); 23} 24 25struct RtParams<T> where T : IMatData 26{ 27 RtUbo<T> ubo; 28}; 29 30struct MatData : IMatData 31{ 32 float4 emission; 33} 34 35// This used to cause a segfault before the fix 36[shader("closesthit")] 37void chit_main_with_paramblock(uniform ParameterBlock<RtParams<MatData>> params, in BuiltInTriangleIntersectionAttributes attr, out RtPayload payload) 38{ 39 payload = {}; 40 payload.emission = float3(1, 0, 0); 41} 42 43// CHECK: OpEntryPoint