Hello!
In my application, I have ~500 simple objects on screen that are rendered using a custom Cg shader. There is a shader uniform for each object that must be independently updated every frame. Calling set_shader_input() on each of these objects to set the uniform every frame costs ~8ms to simply make the set_shader_input() call, and about ~8ms increase in GarbageCollectStates time according to pstats.
In other words, setting a uniform on 500 different objects in my scene every frame causes an increase of 16ms frame time.
I realize that there are ways to accomplish my goal without using shader uniforms, but why is this so expensive? Setting a uniform is already done many times per object for transformation matrices and other values without performance problems. I read this thread ([url]Performance questions on setShaderInput and setShaderAuto]), but it only applies to auto-generated shaders, which neither my objects nor their children are using.
I did take a look at the pandaNode.cxx source, and set_attrib(), which is called by set_shader_input(), seems to mark the node and all parents’ bounding volumes stale even if we are simply setting a shader attrib or color attrib! Could this be the issue?
Any help or workarounds would be greatly appreciated. Thanks!
Matt