Skip to content

Commit 066872e

Browse files
committed
Cleanup: remove GLShader::MissesRequiredMacros
For checking if a macro can't be used without another macro, we can just use HasConflictingMacros(). No need to have separate functions to check flags that must be on and flags that must be off. The one override of MissesRequiredMacros wasn't even using it for the right thing (a global GL config setting instead of a macro).
1 parent 11ec5c1 commit 066872e

2 files changed

Lines changed: 5 additions & 20 deletions

File tree

src/engine/renderer/gl_shader.cpp

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,11 @@ static bool IsUnusedPermutation( const char *compileMacros )
870870
const char* token;
871871
while ( *( token = COM_ParseExt2( &compileMacros, false ) ) )
872872
{
873-
if ( strcmp( token, "USE_DELUXE_MAPPING" ) == 0 )
873+
if ( strcmp( token, "USE_VERTEX_SKINNING" ) == 0 )
874+
{
875+
if ( !glConfig.vboVertexSkinningAvailable ) return true;
876+
}
877+
else if ( strcmp( token, "USE_DELUXE_MAPPING" ) == 0 )
874878
{
875879
if ( !glConfig.deluxeMapping ) return true;
876880
}
@@ -2044,11 +2048,6 @@ bool GLCompileMacro_USE_VERTEX_SKINNING::HasConflictingMacros( size_t permutatio
20442048
return false;
20452049
}
20462050

2047-
bool GLCompileMacro_USE_VERTEX_SKINNING::MissesRequiredMacros( size_t /*permutation*/, const std::vector< GLCompileMacro * > &/*macros*/ ) const
2048-
{
2049-
return !glConfig.vboVertexSkinningAvailable;
2050-
}
2051-
20522051
bool GLCompileMacro_USE_VERTEX_ANIMATION::HasConflictingMacros( size_t permutation, const std::vector< GLCompileMacro * > &macros ) const
20532052
{
20542053
for (const GLCompileMacro* macro : macros)
@@ -2248,10 +2247,6 @@ uint32_t GLShader::GetUniqueCompileMacros( size_t permutation, const int type )
22482247
continue;
22492248
}
22502249

2251-
if ( macro->MissesRequiredMacros( permutation, _compileMacros ) ) {
2252-
continue;
2253-
}
2254-
22552250
if ( !( macro->GetShaderTypes() & type ) ) {
22562251
continue;
22572252
}
@@ -2272,10 +2267,6 @@ bool GLShader::GetCompileMacrosString( size_t permutation, std::string &compileM
22722267
return false;
22732268
}
22742269

2275-
if ( macro->MissesRequiredMacros( permutation, _compileMacros ) ) {
2276-
return false;
2277-
}
2278-
22792270
if ( !( macro->GetShaderTypes() & type ) ) {
22802271
return false;
22812272
}

src/engine/renderer/gl_shader.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -952,11 +952,6 @@ class GLCompileMacro
952952
return false;
953953
}
954954

955-
virtual bool MissesRequiredMacros( size_t, const std::vector<GLCompileMacro*>& ) const
956-
{
957-
return false;
958-
}
959-
960955
virtual uint32_t GetRequiredVertexAttributes() const
961956
{
962957
return 0;
@@ -1075,7 +1070,6 @@ class GLCompileMacro_USE_VERTEX_SKINNING :
10751070
}
10761071

10771072
bool HasConflictingMacros( size_t permutation, const std::vector< GLCompileMacro * > &macros ) const override;
1078-
bool MissesRequiredMacros( size_t permutation, const std::vector< GLCompileMacro * > &macros ) const override;
10791073

10801074
uint32_t GetRequiredVertexAttributes() const override
10811075
{

0 commit comments

Comments
 (0)