yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Yong HeDefer immutable buffer loads when emitting spirv. (#7579)c701ec00c

master
929 B23 linesraw
1// entry-point-params.slang
2
3// Test that entry-point `uniform` parameters on ray-tracing
4// shaders properly map to the "shader record" in SPIR-V output.
5
6//TEST:SIMPLE(filecheck=CHECK): -profile glsl_460+spirv_1_4 -stage raygeneration -entry main -target spirv-assembly
7//TEST:SIMPLE(filecheck=CHECK): -stage raygeneration -entry main -target spirv-assembly -emit-spirv-directly
8
9RWStructuredBuffer<float> buffer;
10
11void main(
12	uniform float value) 
13{
14	buffer[DispatchRaysIndex().x] = value;
15}
16
17// CHECK: OpCapability RayTracingKHR
18// CHECK: OpExtension "SPV_KHR_ray_tracing"
19// CHECK: OpEntryPoint RayGeneration{{NV|KHR}} %main
20// CHECK-DAG: OpDecorate %[[LaunchID:[A-Za-z0-9_]+]] BuiltIn LaunchId{{NV|KHR}}
21// CHECK-DAG: %[[LaunchID]] = OpVariable %_ptr_Input_v3uint Input
22// CHECK-DAG: %{{.*}} = OpLoad %v3uint %[[LaunchID]]
23// CHECK-DAG: %{{.*}} = Op{{.*}}AccessChain %_ptr_ShaderRecordBuffer{{NV|KHR}}_float %{{.*}} %int_0