An entry in gl_Position in the vertex shader is necessary if there is a geometric shader

Suppose I have a geometric shader that computes its output gl_Positionfrom some input other than gl_in[].gl_Position. If the previous stages of the pipeline (vertex and tessellation) are not written in their own out gl_Position, does the action of the entire pipeline remain clearly defined?

Or, in other words, does the value affect gl_PositionGL performance until the Geometry shader completes? If not, that would mean that I could just use it as an extra slot for data transfer without any special spatial interpretation between the steps, right?

(The question assumes a direct OpenGL 4.5 profile.)

+4
source share
1 answer

gl_Positionshould be written only by the final Vertex Processing step (VS, tessellation and GS) in the rendering pipeline. Therefore, if you have an active GS, VS that connects to it, you do not need to write to gl_Position. Or it can put any arbitrary vec4data into it .

Note that gl_Positionyou still need to write regardless of the processing stage of the final vertex. Assuming you want to rasterize, of course. And no, this is not frivolous; You can do feedback.

If not, this means that I can simply use it as an additional slot for data transfer without any special spatial interpretation between stages, right?

GS, " ". gl_Position .

- , . , GLSL 4.30+ , , . .

+2

Source: https://habr.com/ru/post/1627697/


All Articles