Optimal performance with many uniforms

14 views
Skip to first unread message

Werner Modenbach

unread,
Apr 8, 2021, 10:13:33 AM4/8/21
to OpenSceneGraph Users
Hi all,

I'm on the way of optimizing my shaders.
Some of them have a large number of uniforms. As Robert says, the cost of uniforms is high.
So I would like to optimize this.
My questions:
1) Is the amount of space for basic types in uniforms like the space requirement in interface blocks, i.e. 16 byte? (vec4 and bool always the same amount?)
2) Does it make sense packing uniforms in uniform structures. Is the transfer time for 10 floats the same as for a struct of 10 floats?
3) Does it make sense packing uniforms in a uniformbuffer if they are valid for all my shaders? How can I do that in OSG and do I have to do any changes in the definition in the
shaders?

Thanks for any hints

- Werner -
Reply all
Reply to author
Forward
0 new messages