Skip to content

Commit

Permalink
NUKE unused shader uniforms
Browse files Browse the repository at this point in the history
  • Loading branch information
VReaperV committed Jan 3, 2025
1 parent ccbee97 commit bf8fe39
Show file tree
Hide file tree
Showing 10 changed files with 2 additions and 58 deletions.
3 changes: 0 additions & 3 deletions src/engine/renderer/Material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1138,8 +1138,6 @@ void BindShaderSkybox( Material* material ) {
gl_skyboxShaderMaterial->BindProgram( material->deformIndex );

// Set shader uniforms.
gl_skyboxShaderMaterial->SetUniform_ViewOrigin( backEnd.viewParms.orientation.origin );
gl_skyboxShaderMaterial->SetUniform_ModelMatrix( backEnd.orientation.transformMatrix );
gl_skyboxShaderMaterial->SetUniform_ModelViewProjectionMatrix( glState.modelViewProjectionMatrix[glState.stackIndex] );
}

Expand All @@ -1156,7 +1154,6 @@ void BindShaderHeatHaze( Material* material ) {
gl_heatHazeShaderMaterial->BindProgram( material->deformIndex );

// Set shader uniforms.
gl_heatHazeShaderMaterial->SetUniform_ModelMatrix( backEnd.orientation.transformMatrix );
gl_heatHazeShaderMaterial->SetUniform_ModelViewProjectionMatrix( glState.modelViewProjectionMatrix[glState.stackIndex] );

gl_heatHazeShaderMaterial->SetUniform_ModelViewMatrixTranspose( glState.modelViewMatrix[glState.stackIndex] );
Expand Down
21 changes: 1 addition & 20 deletions src/engine/renderer/gl_shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2553,7 +2553,6 @@ GLShader_shadowFill::GLShader_shadowFill( GLShaderManager *manager ) :
GLShader( "shadowFill", ATTR_POSITION | ATTR_TEXCOORD | ATTR_QTANGENT, manager ),
u_ColorMap( this ),
u_TextureMatrix( this ),
u_ViewOrigin( this ),
u_AlphaThreshold( this ),
u_LightOrigin( this ),
u_LightRadius( this ),
Expand Down Expand Up @@ -2633,11 +2632,9 @@ GLShader_skybox::GLShader_skybox( GLShaderManager *manager ) :
u_ColorMapCube( this ),
u_CloudMap( this ),
u_TextureMatrix( this ),
u_ViewOrigin( this ),
u_CloudHeight( this ),
u_UseCloudMap( this ),
u_AlphaThreshold( this ),
u_ModelMatrix( this ),
u_ModelViewProjectionMatrix( this )
{
}
Expand All @@ -2653,11 +2650,9 @@ GLShader_skyboxMaterial::GLShader_skyboxMaterial( GLShaderManager* manager ) :
u_ColorMapCube( this ),
u_CloudMap( this ),
u_TextureMatrix( this ),
u_ViewOrigin( this ),
u_CloudHeight( this ),
u_UseCloudMap( this ),
u_AlphaThreshold( this ),
u_ModelMatrix( this ),
u_ModelViewProjectionMatrix( this )
{}

Expand Down Expand Up @@ -2708,13 +2703,10 @@ GLShader_fogGlobal::GLShader_fogGlobal( GLShaderManager *manager ) :
GLShader( "fogGlobal", ATTR_POSITION, manager ),
u_ColorMap( this ),
u_DepthMap( this ),
u_ViewOrigin( this ),
u_ViewMatrix( this ),
u_ModelViewProjectionMatrix( this ),
u_UnprojectMatrix( this ),
u_Color( this ),
u_FogDistanceVector( this ),
u_FogDepthVector( this )
u_FogDistanceVector( this )
{
}

Expand All @@ -2730,15 +2722,10 @@ GLShader_heatHaze::GLShader_heatHaze( GLShaderManager *manager ) :
u_NormalMap( this ),
u_HeightMap( this ),
u_TextureMatrix( this ),
u_ViewOrigin( this ),
u_ViewUp( this ),
u_DeformMagnitude( this ),
u_ModelMatrix( this ),
u_ModelViewProjectionMatrix( this ),
u_ModelViewMatrixTranspose( this ),
u_ProjectionMatrixTranspose( this ),
u_ColorModulate( this ),
u_Color( this ),
u_Bones( this ),
u_NormalScale( this ),
u_VertexInterpolation( this ),
Expand All @@ -2761,16 +2748,11 @@ GLShader_heatHazeMaterial::GLShader_heatHazeMaterial( GLShaderManager* manager )
u_NormalMap( this ),
u_HeightMap( this ),
u_TextureMatrix( this ),
u_ViewOrigin( this ),
u_ViewUp( this ),
u_DeformEnable( this ),
u_DeformMagnitude( this ),
u_ModelMatrix( this ),
u_ModelViewProjectionMatrix( this ),
u_ModelViewMatrixTranspose( this ),
u_ProjectionMatrixTranspose( this ),
u_ColorModulate( this ),
u_Color( this ),
u_NormalScale( this ),
GLDeformStage( this )
{
Expand Down Expand Up @@ -2837,7 +2819,6 @@ GLShader_cameraEffects::GLShader_cameraEffects( GLShaderManager *manager ) :
u_ColorModulate( this ),
u_TextureMatrix( this ),
u_ModelViewProjectionMatrix( this ),
u_DeformMagnitude( this ),
u_InverseGamma( this )
{
}
Expand Down
21 changes: 1 addition & 20 deletions src/engine/renderer/gl_shader.h
Original file line number Diff line number Diff line change
Expand Up @@ -4240,7 +4240,6 @@ class GLShader_shadowFill :
public GLShader,
public u_ColorMap,
public u_TextureMatrix,
public u_ViewOrigin,
public u_AlphaThreshold,
public u_LightOrigin,
public u_LightRadius,
Expand Down Expand Up @@ -4311,11 +4310,9 @@ class GLShader_skybox :
public u_ColorMapCube,
public u_CloudMap,
public u_TextureMatrix,
public u_ViewOrigin,
public u_CloudHeight,
public u_UseCloudMap,
public u_AlphaThreshold,
public u_ModelMatrix,
public u_ModelViewProjectionMatrix
{
public:
Expand All @@ -4328,11 +4325,9 @@ class GLShader_skyboxMaterial :
public u_ColorMapCube,
public u_CloudMap,
public u_TextureMatrix,
public u_ViewOrigin,
public u_CloudHeight,
public u_UseCloudMap,
public u_AlphaThreshold,
public u_ModelMatrix,
public u_ModelViewProjectionMatrix {
public:
GLShader_skyboxMaterial( GLShaderManager* manager );
Expand Down Expand Up @@ -4378,13 +4373,10 @@ class GLShader_fogGlobal :
public GLShader,
public u_ColorMap,
public u_DepthMap,
public u_ViewOrigin,
public u_ViewMatrix,
public u_ModelViewProjectionMatrix,
public u_UnprojectMatrix,
public u_Color,
public u_FogDistanceVector,
public u_FogDepthVector
public u_FogDistanceVector
{
public:
GLShader_fogGlobal( GLShaderManager *manager );
Expand All @@ -4397,15 +4389,10 @@ class GLShader_heatHaze :
public u_NormalMap,
public u_HeightMap,
public u_TextureMatrix,
public u_ViewOrigin,
public u_ViewUp,
public u_DeformMagnitude,
public u_ModelMatrix,
public u_ModelViewProjectionMatrix,
public u_ModelViewMatrixTranspose,
public u_ProjectionMatrixTranspose,
public u_ColorModulate,
public u_Color,
public u_Bones,
public u_NormalScale,
public u_VertexInterpolation,
Expand All @@ -4424,16 +4411,11 @@ class GLShader_heatHazeMaterial :
public u_NormalMap,
public u_HeightMap,
public u_TextureMatrix,
public u_ViewOrigin,
public u_ViewUp,
public u_DeformEnable,
public u_DeformMagnitude,
public u_ModelMatrix,
public u_ModelViewProjectionMatrix,
public u_ModelViewMatrixTranspose,
public u_ProjectionMatrixTranspose,
public u_ColorModulate,
public u_Color,
public u_NormalScale,
public GLDeformStage
{
Expand Down Expand Up @@ -4490,7 +4472,6 @@ class GLShader_cameraEffects :
public u_ColorModulate,
public u_TextureMatrix,
public u_ModelViewProjectionMatrix,
public u_DeformMagnitude,
public u_InverseGamma
{
public:
Expand Down
2 changes: 0 additions & 2 deletions src/engine/renderer/glsl_source/depthtile1_fp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
uniform sampler2D u_DepthMap;
IN(flat) vec3 unprojectionParams;

uniform vec3 u_zFar;

const vec2 pixelScale = 1 / r_FBufSize;

DECLARE_OUTPUT(vec4)
Expand Down
3 changes: 0 additions & 3 deletions src/engine/renderer/glsl_source/fogGlobal_fp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
uniform sampler2D u_ColorMap; // fog texture
uniform sampler2D u_DepthMap;

uniform vec3 u_ViewOrigin;
uniform vec4 u_FogDistanceVector;
uniform vec4 u_FogDepthVector;
uniform vec4 u_Color;
uniform mat4 u_ViewMatrix;
uniform mat4 u_UnprojectMatrix;

#if __VERSION__ > 120
Expand Down
2 changes: 0 additions & 2 deletions src/engine/renderer/glsl_source/fogQuake3_vp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#insert vertexSkinning_vp
#insert vertexAnimation_vp

uniform vec3 u_ViewOrigin;

uniform float u_Time;

uniform vec4 u_ColorModulate;
Expand Down
1 change: 0 additions & 1 deletion src/engine/renderer/glsl_source/heatHaze_fp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define HEATHAZE_GLSL

uniform sampler2D u_CurrentMap;
uniform float u_AlphaThreshold;

#if defined(USE_MATERIAL_SYSTEM)
uniform float u_DeformEnable;
Expand Down
1 change: 0 additions & 1 deletion src/engine/renderer/glsl_source/reflection_CB_fp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

uniform samplerCube u_ColorMapCube;
uniform vec3 u_ViewOrigin;
uniform mat4 u_ModelMatrix;

IN(smooth) vec3 var_Position;
IN(smooth) vec2 var_TexCoords;
Expand Down
3 changes: 0 additions & 3 deletions src/engine/renderer/tr_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2983,8 +2983,6 @@ void RB_RenderGlobalFog()
// go back to the world modelview matrix
backEnd.orientation = backEnd.viewParms.world;

gl_fogGlobalShader->SetUniform_ViewOrigin( backEnd.viewParms.orientation.origin ); // world space

{
fog_t *fog;

Expand Down Expand Up @@ -3014,7 +3012,6 @@ void RB_RenderGlobalFog()
gl_fogGlobalShader->SetUniform_Color( fog->color );
}

gl_fogGlobalShader->SetUniform_ViewMatrix( backEnd.viewParms.world.viewMatrix );
gl_fogGlobalShader->SetUniform_UnprojectMatrix( backEnd.viewParms.unprojectionMatrix );

// bind u_ColorMap
Expand Down
3 changes: 0 additions & 3 deletions src/engine/renderer/tr_shade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1977,9 +1977,6 @@ void Render_skybox( shaderStage_t *pStage )

gl_skyboxShader->BindProgram( pStage->deformIndex );

gl_skyboxShader->SetUniform_ViewOrigin( backEnd.viewParms.orientation.origin ); // in world space

gl_skyboxShader->SetUniform_ModelMatrix( backEnd.orientation.transformMatrix );
gl_skyboxShader->SetUniform_ModelViewProjectionMatrix( glState.modelViewProjectionMatrix[ glState.stackIndex ] );

// bind u_ColorMap
Expand Down

0 comments on commit bf8fe39

Please sign in to comment.