Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can I determine the limit on Vertex Shader outputs?

I’m trying to introduce multiple shadow casters, and in the process I’m passing a transformed position for each light in the VS output. The shader compiler reports errors as a result of the output size exceeding some internal limit, but I’ve been thus far unable to determine what the limit actually is (or how to find it).

The output structure is as follows:

out VS_OUT
{
    vec3 FragPos;
    vec3 Normal;
    vec3 Colour;
    vec2 TexCoord;
    vec4[MAX_SHADOW_CASTERS] LightSpaceFragPos;
} vso;

Compilation has failed at MAX_SHADOW_CASTERS value 64 and 32, at the very least.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Additionally, any suggestions around improving the capacity of the array would be appreciated. These values are naturally per fragment, so a universal texture/buffer would be impractical as far as I understand.

>Solution :

The maximum number of varying vector variables (that’s what the interface between the vertex and fragment shader stages are called – and in earlier GLSL versions those actually had the keyword varying instead of in/out) can be queryied via glGetIntegerv with GL_MAX_VARYING_VECTORS as the pname parameter argument.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading