From 99fa09d2df0d328c6fe93924150cf098d7aaeea4 Mon Sep 17 00:00:00 2001 From: VReaperV Date: Thu, 26 Dec 2024 01:15:16 +0300 Subject: [PATCH] Don't set global uniforms in UpdateSurfaceData* --- src/engine/renderer/Material.cpp | 8 +------- src/engine/renderer/gl_shader.h | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/engine/renderer/Material.cpp b/src/engine/renderer/Material.cpp index 551aa33dde..3b7570fcbf 100644 --- a/src/engine/renderer/Material.cpp +++ b/src/engine/renderer/Material.cpp @@ -215,9 +215,6 @@ void UpdateSurfaceDataGeneric3D( uint32_t* materials, Material& material, drawSu gl_genericShaderMaterial->BindProgram( material.deformIndex ); - gl_genericShaderMaterial->SetUniform_ModelMatrix( backEnd.orientation.transformMatrix ); - gl_genericShaderMaterial->SetUniform_ModelViewProjectionMatrix( glState.modelViewProjectionMatrix[glState.stackIndex] ); - // u_AlphaThreshold gl_genericShaderMaterial->SetUniform_AlphaTest( pStage->stateBits ); @@ -548,10 +545,6 @@ void UpdateSurfaceDataLiquid( uint32_t* materials, Material& material, drawSurf_ gl_liquidShaderMaterial->SetUniform_FogDensity( fogDensity ); gl_liquidShaderMaterial->SetUniform_FogColor( fogColor ); - gl_liquidShaderMaterial->SetUniform_UnprojectMatrix( backEnd.viewParms.unprojectionMatrix ); - gl_liquidShaderMaterial->SetUniform_ModelMatrix( backEnd.orientation.transformMatrix ); - gl_liquidShaderMaterial->SetUniform_ModelViewProjectionMatrix( glState.modelViewProjectionMatrix[glState.stackIndex] ); - // NOTE: specular component is computed by shader. // FIXME: physical mapping is not implemented. if ( pStage->enableSpecularMapping ) { @@ -1183,6 +1176,7 @@ void BindShaderLiquid( Material* material ) { // Set shader uniforms. gl_liquidShaderMaterial->SetUniform_ViewOrigin( backEnd.viewParms.orientation.origin ); + gl_liquidShaderMaterial->SetUniform_UnprojectMatrix( backEnd.viewParms.unprojectionMatrix ); gl_liquidShaderMaterial->SetUniform_ModelMatrix( backEnd.orientation.transformMatrix ); gl_liquidShaderMaterial->SetUniform_ModelViewProjectionMatrix( glState.modelViewProjectionMatrix[glState.stackIndex] ); diff --git a/src/engine/renderer/gl_shader.h b/src/engine/renderer/gl_shader.h index d7fb0ff733..a6a8b7773f 100644 --- a/src/engine/renderer/gl_shader.h +++ b/src/engine/renderer/gl_shader.h @@ -3458,7 +3458,7 @@ class u_UnprojectMatrix : { public: u_UnprojectMatrix( GLShader *shader ) : - GLUniformMatrix4f( shader, "u_UnprojectMatrix" ) + GLUniformMatrix4f( shader, "u_UnprojectMatrix", true ) { }