aconstlink / natus

[Discontinued] Software Framework for Audio/Visual/Interactive Real-Time Applications
https://aconstlink.de
MIT License
0 stars 0 forks source link

GLSL Interface Blocks should not carry the position bound variable #331

Closed aconstlink closed 1 year ago

aconstlink commented 1 year ago

This make some trouble because if streamout is activated, all interface block variables need to be written. Whereas if used in the rendering pipe, gl_Position need to be written anytime because the is too troublesome to check every time if the current stage is the last before raster. Also in the geometry shader if the output bound position is written, gl_Position need to be written before EmitVertex is called. So here also the generator needs to inject code every time EmitVertex is called but only if position is written.

So if gl_Position is just written every time the output bound position variable is written, it makes code generation easier.

The user defined type must be regarded because if only gl_Position is written, the next shader stage also need to read from it. To make things worse, geometry shader uses array so it is not only gl_Position but gl_in[].gl_Position.

aconstlink commented 1 year ago

gl_Position is now used for all in and out interface blocks except for vertex shaders ins because an in interface block is not allowed there and it is also not replaced if transform feedback is used. Replacing the gl_in[].gl_Position in the geometry shader should also do the trick if tessellation shaders are used.