Thanks. I have also an idea to extend cache system - eliminate searching for const values (many values like texture ID, light colors etc. are const for one shader and doesn't change in next frames):
Code: Select all
const s32 i = UniformInfo.binary_search(target);
I think that we can extend IMaterialRendererServices by eg:
Code: Select all
/* This function will be removed uniform from an UniformInfo list and shift it to CachedUniformInfo. Each CachedUniformInfo element will be also store float/int/bool value assigned to current uniform. On COpenGLSLMaterialRenderer::OnRender method all CachedUniformInfo elements should be uploaded to GPU.*/
virtual bool addCachedPixelShaderConstant(const c8* name, const s32* ints, int count) = 0;
To efficient usage of addCachedPixelShaderConstant we should extend also IShaderConstantSetCallBack eg by:
Code: Select all
/* This function will be called only once after material is created, here we should put addCachedPixelShaderConstant calls. */
virtual void OnSetCachedConstants(video::IMaterialRendererServices* services, s32 userData) = 0;
When UniformInfo array will be smaller, set values for a dynamic uniforms will be faster (less element to searching by binary_search). I think that this is good optimization for a shaders with many uniforms and doesn't complicate existing interface too much. I will prepare patch soon. What do You think about this optimization? Personally I think that Handu's patches which doesn't change existing interface we can apply to v1.8, but I'm relatively new developer in a team, so Hybrid and CuteAlien should decide about it
