SPIRV-Cross/reference/shaders/asm/geom/unroll-glposition-load.asm.geom
Hans-Kristian Arntzen 03d93abc1a Deal with case where a variable is dominated by inner part of a loop.
There is a risk that we try to preserve a loop variable through multiple
iterations, even though the dominating block is inside a loop.

Fix this by analyzing if a block starts off by writing to a variable. In
that case, there cannot be any preservation going on. If we don't, pretend the
loop header is reading the variable, which moves the variable to an
appropriate scope.
2019-06-06 11:11:44 +02:00

36 lines
614 B
GLSL

#version 450
layout(triangles) in;
layout(max_vertices = 3, triangle_strip) out;
struct SceneOut
{
vec4 pos;
};
void _main(vec4 positions[3], SceneOut OUT)
{
SceneOut o;
for (int i = 0; i < 3; i++)
{
o.pos = positions[i];
gl_Position = o.pos;
EmitVertex();
}
EndPrimitive();
}
void main()
{
vec4 _35_unrolled[3];
for (int i = 0; i < int(3); i++)
{
_35_unrolled[i] = gl_in[i].gl_Position;
}
vec4 positions[3] = _35_unrolled;
vec4 param[3] = positions;
SceneOut param_1;
_main(param, param_1);
SceneOut OUT = param_1;
}