yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
61a6c211b
master
1//TEST:SIMPLE(filecheck=CHECK): -target spirv -stage compute -entry main 2 3// Verify that the call to dot is after the conditional branch. 4 5// CHECK: OpBranchConditional 6// CHECK: OpDot 7 8[ForceInline] 9float test(bool x, float3 a, float3 b) { 10 float result = 0; 11 if(x) { 12 result = dot(a, b); 13 } 14 return result; 15} 16 17float caller(uniform bool x, uniform float3 a, uniform float3 b) { 18 return test(x, a, b); 19} 20 21RWStructuredBuffer<float> output; 22 23uniform bool branchCheck; 24uniform float3 uniformA; 25uniform float3 uniformB; 26 27[numthreads(1,1,1)] 28[shader("compute")] 29void main() 30{ 31 output[0] = caller(branchCheck, uniformA, uniformB); 32}