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