yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
ad45062fc
master
1//TEST:SIMPLE(filecheck=CHECK): -target spirv -stage compute -entry main -emit-spirv-directly 2 3// Test that we can transform a continue in a while loop to valid spirv. 4 5uniform int loopCount; 6 7// CHECK: OpEntryPoint 8 9bool condition1() 10{ 11 AllMemoryBarrier(); 12 return output[2] < 1; 13} 14bool condition2() 15{ 16 AllMemoryBarrier(); 17 return output[3] < 1; 18} 19 20RWStructuredBuffer<float> output; 21 22[numthreads(1,1,1)] 23void main() 24{ 25 float weight = 0.0; 26 do 27 { 28 if (condition2()) 29 { 30 continue; 31 } 32 AllMemoryBarrier(); 33 } while (condition1()); 34 35 while(condition1()) 36 { 37 if (condition2()) 38 { 39 continue; 40 } 41 AllMemoryBarrier(); 42 } 43 44 output[0] = weight; 45}