yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
c43f6fa55
master
1//TEST:SIMPLE(filecheck=CHECK): -target spirv 2 3// Test that we can use Optional<T> or bool types in varying input or outputs. 4 5// CHECK: OpDecorate %i_inA_value Location 0 6// CHECK: OpDecorate %i_inA_hasValue Location 1 7// CHECK: OpDecorate %entryPointParam_vertMain_a_value Location 0 8// CHECK: OpDecorate %entryPointParam_vertMain_a_hasValue Location 1 9 10struct VIn { 11 Optional<float> inA; 12} 13 14struct VSOut { 15 Optional<float> a; 16 bool outputValues[3]; 17}; 18 19[shader("vertex")] 20VSOut vertMain(VIn i) 21{ 22 VSOut o; 23 if (i.inA.hasValue) 24 o.a = i.inA; 25 else 26 o.a = 0.0; 27 o.outputValues = { true, false, true }; 28 return o; 29}