From dbcc343064d6ce4890fbd10fb30b188ce421e1ec Mon Sep 17 00:00:00 2001 From: slipher Date: Wed, 25 Feb 2026 05:31:46 -0600 Subject: [PATCH 1/2] 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). --- src/engine/renderer/gl_shader.cpp | 19 +++++-------------- src/engine/renderer/gl_shader.h | 6 ------ 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/src/engine/renderer/gl_shader.cpp b/src/engine/renderer/gl_shader.cpp index f23055feb4..17a4f0ba69 100644 --- a/src/engine/renderer/gl_shader.cpp +++ b/src/engine/renderer/gl_shader.cpp @@ -868,7 +868,11 @@ static bool IsUnusedPermutation( const char *compileMacros ) const char* token; while ( *( token = COM_ParseExt2( &compileMacros, false ) ) ) { - if ( strcmp( token, "USE_DELUXE_MAPPING" ) == 0 ) + if ( strcmp( token, "USE_VERTEX_SKINNING" ) == 0 ) + { + if ( !glConfig.vboVertexSkinningAvailable ) return true; + } + else if ( strcmp( token, "USE_DELUXE_MAPPING" ) == 0 ) { if ( !glConfig.deluxeMapping ) return true; } @@ -2042,11 +2046,6 @@ bool GLCompileMacro_USE_VERTEX_SKINNING::HasConflictingMacros( size_t permutatio return false; } -bool GLCompileMacro_USE_VERTEX_SKINNING::MissesRequiredMacros( size_t /*permutation*/, const std::vector< GLCompileMacro * > &/*macros*/ ) const -{ - return !glConfig.vboVertexSkinningAvailable; -} - bool GLCompileMacro_USE_VERTEX_ANIMATION::HasConflictingMacros( size_t permutation, const std::vector< GLCompileMacro * > ¯os ) const { for (const GLCompileMacro* macro : macros) @@ -2246,10 +2245,6 @@ uint32_t GLShader::GetUniqueCompileMacros( size_t permutation, const int type ) continue; } - if ( macro->MissesRequiredMacros( permutation, _compileMacros ) ) { - continue; - } - if ( !( macro->GetShaderTypes() & type ) ) { continue; } @@ -2270,10 +2265,6 @@ bool GLShader::GetCompileMacrosString( size_t permutation, std::string &compileM return false; } - if ( macro->MissesRequiredMacros( permutation, _compileMacros ) ) { - return false; - } - if ( !( macro->GetShaderTypes() & type ) ) { return false; } diff --git a/src/engine/renderer/gl_shader.h b/src/engine/renderer/gl_shader.h index 781438e1b5..0f857de57c 100644 --- a/src/engine/renderer/gl_shader.h +++ b/src/engine/renderer/gl_shader.h @@ -952,11 +952,6 @@ class GLCompileMacro return false; } - virtual bool MissesRequiredMacros( size_t, const std::vector& ) const - { - return false; - } - virtual uint32_t GetRequiredVertexAttributes() const { return 0; @@ -1075,7 +1070,6 @@ class GLCompileMacro_USE_VERTEX_SKINNING : } bool HasConflictingMacros( size_t permutation, const std::vector< GLCompileMacro * > ¯os ) const override; - bool MissesRequiredMacros( size_t permutation, const std::vector< GLCompileMacro * > ¯os ) const override; uint32_t GetRequiredVertexAttributes() const override { From ef2d2e39d40b60393a7e799141ace49afb05e589 Mon Sep 17 00:00:00 2001 From: slipher Date: Wed, 25 Feb 2026 05:50:35 -0600 Subject: [PATCH 2/2] GL shaders: never build grid deluxe without grid lighting --- src/engine/renderer/gl_shader.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/engine/renderer/gl_shader.cpp b/src/engine/renderer/gl_shader.cpp index 17a4f0ba69..5e149a6c13 100644 --- a/src/engine/renderer/gl_shader.cpp +++ b/src/engine/renderer/gl_shader.cpp @@ -2116,6 +2116,12 @@ bool GLCompileMacro_USE_GRID_DELUXE_MAPPING::HasConflictingMacros(size_t permuta { return true; } + + // grid lighting is required + if ((macro->GetType() == USE_GRID_LIGHTING) && !(permutation & macro->GetBit())) + { + return true; + } } return false;