yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
b937207dc
master
1// A regression: the do-while loop ir lowering logic is making incorrect assumptions and is 2// broken after short circuiting expr change, leading to invalid IR being generated from lowering 3// (a block has two terminator insts). 4 5//TEST:SIMPLE(filecheck=CHECK): -target spirv -emit-spirv-directly 6 7// CHECK: OpEntryPoint 8 9struct Constants { 10 uint *buffer; 11} 12[[vk::push_constant]] Constants push_constants; 13 14[shader("compute")] [numthreads(1, 1, 1)] void compute(void) { 15 uint index = push_constants.buffer[0]; 16 17 [[unroll]] for (uint i = 0; i < 2; i++) { 18 GroupMemoryBarrierWithWaveSync(); 19 20 if (index > 0 && i < push_constants.buffer[index - 1]) { 21 do { 22 index--; 23 } while (index > 0 && i < push_constants.buffer[index - 1]); 24 } 25 } 26}