The current vertex.flip_vert_y implementation adds gl_Position.y flipping at SPIRBlock::Return.
|
case SPIRBlock::Return: |
|
{ |
|
for (auto &line : current_function->fixup_hooks_out) |
|
line(); |
|
|
|
if (processing_entry_point) |
|
emit_fixup(); |
However, this does not affect the EmitVertex calls, so the vertices emitted in geometry shaders remain unflipped, which appears to be unintended.
Relevant issue: #1469
Small thoughts:
- Basically we could flip Y just before every
EmitVertex call to resolve this issue. However, the code may use gl_Position after the EmitVertex call (I won't write such a code though), so the modification should be rolled back immediately to maintain the original behavior.
- For VS-GS or VS-TCS-TES (or similar) pipelines, we can refer to the
gl_Position output from the previous stage. So it might be necessary to flip the input initially. However, if the geometry shader is used in isolation, flipping the input is not necessary...
- It might be useful to add an option to specify how the input should be handled...
The current
vertex.flip_vert_yimplementation addsgl_Position.yflipping atSPIRBlock::Return.SPIRV-Cross/spirv_glsl.cpp
Lines 17911 to 17917 in 72b5b7c
However, this does not affect the
EmitVertexcalls, so the vertices emitted in geometry shaders remain unflipped, which appears to be unintended.Relevant issue: #1469
Small thoughts:
EmitVertexcall to resolve this issue. However, the code may usegl_Positionafter theEmitVertexcall (I won't write such a code though), so the modification should be rolled back immediately to maintain the original behavior.gl_Positionoutput from the previous stage. So it might be necessary to flip the input initially. However, if the geometry shader is used in isolation, flipping the input is not necessary...