Add IMaterialRendererServices::startUseProgram/stopUseProgram

This makes it possible to set high-level shader constants (which are attached to shader programs) to be set outside
of OnSetConstants.
IShaderConstantSetCallBack::OnCreate has it set automatically now so it works the same as OnSetConstants.
D3D9 and burnings both work different, so there hadn't been a problem with those.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6469 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien
2023-04-24 14:46:09 +00:00
parent 16c960c5ed
commit c4bbbe1aaf
6 changed files with 71 additions and 18 deletions

View File

@ -41,6 +41,20 @@ public:
//! Return an index constant for the vertex shader based on a name.
virtual s32 getVertexShaderConstantID(const c8* name) = 0;
//! Call when you set shader constants outside of IShaderConstantSetCallBack
/** Only for high-level shader functions, aka those using an index instead of
an register. Shader constants are attached to shader programs, so if you want
to set them you have to make sure the correct shader program is in use.
IShaderConstantSetCallBack functions like OnSetConstants do that for you,
but if you want to set shader constants outside of those (usually for performance
reasons) call startUseProgram() before doing so and stopUseProgram() afterwards.
Note: Currently only necessary in OpenGL, but no real calling costs on other drivers.
*/
virtual void startUseProgram() {}
//! Call this when you are done setting shader constants outside of OnCreate or OnSetConstants
virtual void stopUseProgram() {}
//! Sets a constant for the vertex shader based on a name.
/** This can be used if you used a high level shader language like GLSL
or HLSL to create a shader. Example: If you created a shader which has