SPIRV-Cross/reference/shaders/comp/torture-loop.comp
Hans-Kristian Arntzen 36a0b63f28 Fix various corner cases with expression dependencies.
There was a potential problem if variables were invalidated and SPIR-V
read expressions which depended on other expression which in turn depended on the
invalidated variable.

Also fixes issue where variables were considered immutable if they were
forwardable. This allowed some incorrect optimizations to slip through.
2016-07-12 14:50:23 +02:00

54 lines
924 B
Plaintext

#version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
layout(binding = 0, std430) buffer SSBO
{
mat4 mvp;
vec4 in_data[];
} _24;
layout(binding = 1, std430) buffer SSBO2
{
vec4 out_data[];
} _89;
void main()
{
uint ident = gl_GlobalInvocationID.x;
vec4 idat = _24.in_data[ident];
int k = 0;
uint i;
uint j;
for (;;)
{
int _39 = k;
int _40 = _39 + 1;
k = _40;
if ((_40 < 10))
{
idat = (idat * 2.0);
k = (k + 1);
continue;
}
else
{
break;
}
}
i = 0u;
for (; (i < 16u); i = (i + uint(1)), k = (k + 1))
{
j = 0u;
for (; (j < 30u); j = (j + uint(1)))
{
idat = (_24.mvp * idat);
}
}
do
{
k = (k + 1);
} while ((k > 10));
_89.out_data[ident] = idat;
}