From c57da57edc581d8993bf39aefa99d46e80007077 Mon Sep 17 00:00:00 2001 From: cutealien Date: Fri, 5 May 2023 18:47:22 +0000 Subject: [PATCH] Remove IMaterialRendererServices::setBasicRenderStates Wasn't ever used by anything and not that well defined anyway. So they all just passed it on to the drivers. And then sometimes the driver version was called and sometimes the IMaterialRendererServices version. So now everything just calls the driver - all places which need it have access to the driver anyway. Also made the driver version non-virtual for now. If someone actually really needs this for some reason I can add it back as virtual function directly in IVideoDriver. But I doubt it - the interface was hardly accessible until recently and originally only meant for internal stuff. GLES version still to do, but checked them earlier and they also just do nothing with it. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6486 dfc29bdd-3216-0410-991c-e03cc46cb475 --- include/IMaterialRendererServices.h | 14 ----------- source/Irrlicht/CD3D9Driver.h | 4 ++-- source/Irrlicht/CD3D9HLSLMaterialRenderer.cpp | 5 ---- source/Irrlicht/CD3D9HLSLMaterialRenderer.h | 1 - source/Irrlicht/CD3D9MaterialRenderer.h | 24 +++++++++---------- .../Irrlicht/CD3D9ShaderMaterialRenderer.cpp | 2 +- source/Irrlicht/COpenGLDriver.h | 4 ++-- source/Irrlicht/COpenGLSLMaterialRenderer.cpp | 9 ------- source/Irrlicht/COpenGLSLMaterialRenderer.h | 1 - source/Irrlicht/CSoftwareDriver2.h | 4 ++-- source/Irrlicht/IBurningShader.cpp | 9 +------ source/Irrlicht/IBurningShader.h | 1 - tests/tests-last-passed-at.txt | 2 +- 13 files changed, 21 insertions(+), 59 deletions(-) diff --git a/include/IMaterialRendererServices.h b/include/IMaterialRendererServices.h index 164926b7..29762066 100644 --- a/include/IMaterialRendererServices.h +++ b/include/IMaterialRendererServices.h @@ -24,20 +24,6 @@ public: //! Destructor virtual ~IMaterialRendererServices() {} - //! Can be called by an IMaterialRenderer to make its work easier. - /** Sets all basic renderstates if needed. - Basic render states are diffuse, ambient, specular, and emissive color, - specular power, bilinear and trilinear filtering, wireframe mode, - gouraudshading, lighting, zbuffer, zwriteenable, backfaceculling and - fog enabling. - \param material The new material to be used. - \param lastMaterial The material used until now. - \param resetAllRenderstates Set to true if all renderstates should be - set, regardless of their current state. */ - virtual void setBasicRenderStates(const SMaterial& material, - const SMaterial& lastMaterial, - bool resetAllRenderstates) = 0; - //! Return an index constant for the vertex shader based on a name. virtual s32 getVertexShaderConstantID(const c8* name) = 0; diff --git a/source/Irrlicht/CD3D9Driver.h b/source/Irrlicht/CD3D9Driver.h index a879015c..9612115f 100644 --- a/source/Irrlicht/CD3D9Driver.h +++ b/source/Irrlicht/CD3D9Driver.h @@ -222,8 +222,8 @@ namespace video virtual void OnResize(const core::dimension2d& size) IRR_OVERRIDE; //! Can be called by an IMaterialRenderer to make its work easier. - virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, - bool resetAllRenderstates) IRR_OVERRIDE; + void setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, + bool resetAllRenderstates); //! Returns type of video driver virtual E_DRIVER_TYPE getDriverType() const IRR_OVERRIDE; diff --git a/source/Irrlicht/CD3D9HLSLMaterialRenderer.cpp b/source/Irrlicht/CD3D9HLSLMaterialRenderer.cpp index 7da11125..639caac1 100644 --- a/source/Irrlicht/CD3D9HLSLMaterialRenderer.cpp +++ b/source/Irrlicht/CD3D9HLSLMaterialRenderer.cpp @@ -275,11 +275,6 @@ bool CD3D9HLSLMaterialRenderer::createHLSLPixelShader(const char* pixelShaderPro return false; } -void CD3D9HLSLMaterialRenderer::setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates) -{ - Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); -} - s32 CD3D9HLSLMaterialRenderer::getVertexShaderConstantID(const c8* name) { return getVariableID(true, name); diff --git a/source/Irrlicht/CD3D9HLSLMaterialRenderer.h b/source/Irrlicht/CD3D9HLSLMaterialRenderer.h index 3b61483e..df3d2a28 100644 --- a/source/Irrlicht/CD3D9HLSLMaterialRenderer.h +++ b/source/Irrlicht/CD3D9HLSLMaterialRenderer.h @@ -47,7 +47,6 @@ public: bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype) IRR_OVERRIDE; // implementations for IMaterialRendererServices - virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates) IRR_OVERRIDE; virtual s32 getVertexShaderConstantID(const c8* name) IRR_OVERRIDE; virtual s32 getPixelShaderConstantID(const c8* name) IRR_OVERRIDE; virtual void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) IRR_OVERRIDE; diff --git a/source/Irrlicht/CD3D9MaterialRenderer.h b/source/Irrlicht/CD3D9MaterialRenderer.h index 08f36bf4..76aa04d4 100644 --- a/source/Irrlicht/CD3D9MaterialRenderer.h +++ b/source/Irrlicht/CD3D9MaterialRenderer.h @@ -82,7 +82,7 @@ public: virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates, IMaterialRendererServices* services) IRR_OVERRIDE { - services->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); + Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) { @@ -105,7 +105,7 @@ public: virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates, IMaterialRendererServices* services) IRR_OVERRIDE { - services->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); + Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); // if (material.MaterialType != lastMaterial.MaterialType || // material.MaterialTypeParam != lastMaterial.MaterialTypeParam || @@ -175,7 +175,7 @@ public: virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates, IMaterialRendererServices* services) IRR_OVERRIDE { - services->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); + Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) { @@ -199,7 +199,7 @@ public: virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates, IMaterialRendererServices* services) IRR_OVERRIDE { - services->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); + Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->getBridgeCalls()->setBlend(true); Driver->getBridgeCalls()->setBlendFunc(D3DBLEND_ONE, D3DBLEND_INVSRCCOLOR); @@ -238,7 +238,7 @@ public: virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates, IMaterialRendererServices* services) IRR_OVERRIDE { - services->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); + Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->getBridgeCalls()->setBlend(true); Driver->getBridgeCalls()->setBlendFunc(D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); @@ -278,7 +278,7 @@ public: virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates, IMaterialRendererServices* services) IRR_OVERRIDE { - services->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); + Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->getBridgeCalls()->setBlend(true); Driver->getBridgeCalls()->setBlendFunc(D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); @@ -325,7 +325,7 @@ public: virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates, IMaterialRendererServices* services) IRR_OVERRIDE { - services->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); + Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) { @@ -367,7 +367,7 @@ public: virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates, IMaterialRendererServices* services) IRR_OVERRIDE { - services->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); + Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) { @@ -411,7 +411,7 @@ public: virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates, IMaterialRendererServices* services) IRR_OVERRIDE { - services->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); + Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) { @@ -436,7 +436,7 @@ public: virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates, IMaterialRendererServices* services) IRR_OVERRIDE { - services->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); + Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) { @@ -471,7 +471,7 @@ public: virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates, IMaterialRendererServices* services) IRR_OVERRIDE { - services->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); + Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) { @@ -507,7 +507,7 @@ public: virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates, IMaterialRendererServices* services) IRR_OVERRIDE { - services->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); + Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); Driver->getBridgeCalls()->setBlend(true); Driver->getBridgeCalls()->setBlendFunc(D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); diff --git a/source/Irrlicht/CD3D9ShaderMaterialRenderer.cpp b/source/Irrlicht/CD3D9ShaderMaterialRenderer.cpp index a53acc67..0f943be7 100644 --- a/source/Irrlicht/CD3D9ShaderMaterialRenderer.cpp +++ b/source/Irrlicht/CD3D9ShaderMaterialRenderer.cpp @@ -132,7 +132,7 @@ void CD3D9ShaderMaterialRenderer::OnSetMaterial(const video::SMaterial& material } } - services->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); + Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); if (BaseMaterial) BaseMaterial->OnSetMaterial(material, lastMaterial, resetAllRenderstates, services); diff --git a/source/Irrlicht/COpenGLDriver.h b/source/Irrlicht/COpenGLDriver.h index 9df01afb..bb32a8f5 100644 --- a/source/Irrlicht/COpenGLDriver.h +++ b/source/Irrlicht/COpenGLDriver.h @@ -271,8 +271,8 @@ namespace video virtual const core::matrix4& getTransform(E_TRANSFORMATION_STATE state) const IRR_OVERRIDE; //! Can be called by an IMaterialRenderer to make its work easier. - virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastmaterial, - bool resetAllRenderstates) IRR_OVERRIDE; + void setBasicRenderStates(const SMaterial& material, const SMaterial& lastmaterial, + bool resetAllRenderstates); //! Compare in SMaterial doesn't check texture parameters, so we should call this on each OnRender call. virtual void setTextureRenderStates(const SMaterial& material, bool resetAllRenderstates); diff --git a/source/Irrlicht/COpenGLSLMaterialRenderer.cpp b/source/Irrlicht/COpenGLSLMaterialRenderer.cpp index df2cb060..4ef1444f 100644 --- a/source/Irrlicht/COpenGLSLMaterialRenderer.cpp +++ b/source/Irrlicht/COpenGLSLMaterialRenderer.cpp @@ -563,15 +563,6 @@ bool COpenGLSLMaterialRenderer::linkProgram() return true; } - -void COpenGLSLMaterialRenderer::setBasicRenderStates(const SMaterial& material, - const SMaterial& lastMaterial, - bool resetAllRenderstates) -{ - // forward - Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); -} - void COpenGLSLMaterialRenderer::startUseProgram() { if (Program2) diff --git a/source/Irrlicht/COpenGLSLMaterialRenderer.h b/source/Irrlicht/COpenGLSLMaterialRenderer.h index 92605a73..05f4b16a 100644 --- a/source/Irrlicht/COpenGLSLMaterialRenderer.h +++ b/source/Irrlicht/COpenGLSLMaterialRenderer.h @@ -72,7 +72,6 @@ public: } // implementations for IMaterialRendererServices - virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates) IRR_OVERRIDE; virtual void startUseProgram() IRR_OVERRIDE; virtual void stopUseProgram() IRR_OVERRIDE; virtual s32 getVertexShaderConstantID(const c8* name) IRR_OVERRIDE; diff --git a/source/Irrlicht/CSoftwareDriver2.h b/source/Irrlicht/CSoftwareDriver2.h index 18ed97e8..01ae8127 100644 --- a/source/Irrlicht/CSoftwareDriver2.h +++ b/source/Irrlicht/CSoftwareDriver2.h @@ -264,9 +264,9 @@ namespace video //IMaterialRendererService - virtual void setBasicRenderStates(const SMaterial& material, + void setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, - bool resetAllRenderstates) IRR_OVERRIDE; + bool resetAllRenderstates); //pass BaseMaterialID void setFallback_Material(E_MATERIAL_TYPE fallback_MaterialType diff --git a/source/Irrlicht/IBurningShader.cpp b/source/Irrlicht/IBurningShader.cpp index 56d3359e..43417ca3 100644 --- a/source/Irrlicht/IBurningShader.cpp +++ b/source/Irrlicht/IBurningShader.cpp @@ -299,7 +299,7 @@ void IBurningShader::OnSetMaterial(const SMaterial& material, const SMaterial& l { if (Driver) Driver->setFallback_Material(BaseMaterial, VertexShaderProgram_buildin); - services->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); + Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); if (CallBack) CallBack->OnSetMaterial(material); @@ -331,13 +331,6 @@ IShaderConstantSetCallBack* IBurningShader::getShaderConstantSetCallBack() const return CallBack; } -// implementations for the render services -void IBurningShader::setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates) -{ - // forward - Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); -} - static BurningUniform _empty = { "null",BL_VERTEX_FLOAT,{0.f,0.f,0.f,0.f} }; const f32* IBurningShader::getUniform(const c8* name, EBurningUniformFlags flags) const { diff --git a/source/Irrlicht/IBurningShader.h b/source/Irrlicht/IBurningShader.h index c19fdc7e..71ffd698 100644 --- a/source/Irrlicht/IBurningShader.h +++ b/source/Irrlicht/IBurningShader.h @@ -334,7 +334,6 @@ public: virtual IShaderConstantSetCallBack* getShaderConstantSetCallBack() const IRR_OVERRIDE; // implementations for the render services - virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates) IRR_OVERRIDE; virtual s32 getVertexShaderConstantID(const c8* name) IRR_OVERRIDE; virtual s32 getPixelShaderConstantID(const c8* name) IRR_OVERRIDE; virtual void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount = 1) IRR_OVERRIDE; diff --git a/tests/tests-last-passed-at.txt b/tests/tests-last-passed-at.txt index 63ceebb8..f7f59afa 100644 --- a/tests/tests-last-passed-at.txt +++ b/tests/tests-last-passed-at.txt @@ -1,4 +1,4 @@ Tests finished. 72 tests of 72 passed. Compiled as DEBUG -Test suite pass at GMT Thu May 04 15:46:30 2023 +Test suite pass at GMT Fri May 05 18:39:44 2023