paul1492-/
2008-11-19 14:58:25 UTC
Maybe somebody on this list can save me from reinventing the wheel...
I'm looking to get a better understanding of performance issues related to uniforms.
How much overhead is there in having a uniform? If there only a performance hit if the uniform changes values or every frame. What if I change the Uniform in OSG to exactly the same value it already has, would there be a performance hit?
I have uniforms that might not change values very often. Some are simply boolean flags. Can I have different shaders and somehow switch between them? Can I "recompile" the shader on-the-fly (i.e. defining these boolean using #define/#if-#endif)?
In some cases, I have variables which can change within the shader, but I know these values when I create the scene graph so I currently use #define instead of passing them as uniforms (which will ever only have one value). Does this gain me much in performance?
Also, is there a difference in performance in using four "float" uniforms versus setting a Vec4?
Paul P.
I'm looking to get a better understanding of performance issues related to uniforms.
How much overhead is there in having a uniform? If there only a performance hit if the uniform changes values or every frame. What if I change the Uniform in OSG to exactly the same value it already has, would there be a performance hit?
I have uniforms that might not change values very often. Some are simply boolean flags. Can I have different shaders and somehow switch between them? Can I "recompile" the shader on-the-fly (i.e. defining these boolean using #define/#if-#endif)?
In some cases, I have variables which can change within the shader, but I know these values when I create the scene graph so I currently use #define instead of passing them as uniforms (which will ever only have one value). Does this gain me much in performance?
Also, is there a difference in performance in using four "float" uniforms versus setting a Vec4?
Paul P.