Do GLSL varying structures any performance overhead? How they are implemented?
Are the following snippets equivalent in the aspect of performance?
out vec3 var0;
out vec3 var1;
out vec3 var2;
Thanks in advance.
structures are pure syntactical convenience for you to increase readability/style/aesthetics of your code
the 2 cases you ask about should have no difference performance-wise (apart from bad compiler with bugs)
ultimately they will be translated to a bunch of GPU registers and any high-level grouping in structs is discarded.
There are various considerations that are beneficial to bear in mind though.
One such is that if you need an array that is to be indexed, you better make sure it has elements that are multiple of 16 bytes
(16 bytes is one vec4 - the hardware register unit) or else the compiler will generate very large and complicated GPU code
to emulate the requested behavior, because today’s GPUs can only index arrays that are multiple of vec4.
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.