diff --git a/src/engine/renderer/gl_shader.cpp b/src/engine/renderer/gl_shader.cpp index f23055feb4..540dd24dc6 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) @@ -2113,20 +2112,13 @@ bool GLCompileMacro_USE_GRID_DELUXE_MAPPING::HasConflictingMacros(size_t permuta { for (const GLCompileMacro* macro : macros) { - if ((permutation & macro->GetBit()) != 0 && (macro->GetType() == USE_DELUXE_MAPPING || macro->GetType() == USE_BSP_SURFACE)) + if ((permutation & macro->GetBit()) != 0 && (macro->GetType() == USE_DELUXE_MAPPING)) { return true; } - } - - return false; -} -bool GLCompileMacro_USE_GRID_LIGHTING::HasConflictingMacros(size_t permutation, const std::vector ¯os) const -{ - for (const GLCompileMacro* macro : macros) - { - if ((permutation & macro->GetBit()) != 0 && (macro->GetType() == USE_DELUXE_MAPPING)) + // grid lighting is required + if ((macro->GetType() == USE_GRID_LIGHTING) && !(permutation & macro->GetBit())) { return true; } @@ -2135,11 +2127,11 @@ bool GLCompileMacro_USE_GRID_LIGHTING::HasConflictingMacros(size_t permutation, return false; } -bool GLCompileMacro_USE_BSP_SURFACE::HasConflictingMacros(size_t permutation, const std::vector ¯os) const +bool GLCompileMacro_USE_GRID_LIGHTING::HasConflictingMacros(size_t permutation, const std::vector ¯os) const { for (const GLCompileMacro* macro : macros) { - if ((permutation & macro->GetBit()) != 0 && (macro->GetType() == USE_GRID_DELUXE_MAPPING)) + if ((permutation & macro->GetBit()) != 0 && (macro->GetType() == USE_DELUXE_MAPPING)) { return true; } @@ -2246,10 +2238,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 +2258,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..809918df6f 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; @@ -1034,8 +1029,6 @@ class GLCompileMacro_USE_BSP_SURFACE : return "USE_BSP_SURFACE"; } - bool HasConflictingMacros(size_t permutation, const std::vector< GLCompileMacro * > ¯os) const override; - EGLCompileMacro GetType() const override { return EGLCompileMacro::USE_BSP_SURFACE; @@ -1075,7 +1068,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 { diff --git a/src/engine/renderer/glsl_source/computeLight_fp.glsl b/src/engine/renderer/glsl_source/computeLight_fp.glsl index f3c23bf9e9..aa0ad85f7f 100644 --- a/src/engine/renderer/glsl_source/computeLight_fp.glsl +++ b/src/engine/renderer/glsl_source/computeLight_fp.glsl @@ -84,7 +84,7 @@ void computeDeluxeLight( vec3 lightDir, vec3 normal, vec3 viewDir, vec3 lightCol // clamp( NdotL, 0.0, 1.0 ) is done below float NdotL = dot( normal, lightDir ); - #if !defined(USE_BSP_SURFACE) && defined(r_halfLambertLighting) + #if defined(USE_GRID_LIGHTING) && defined(r_halfLambertLighting) // http://developer.valvesoftware.com/wiki/Half_Lambert NdotL = NdotL * 0.5 + 0.5; NdotL *= NdotL; diff --git a/src/engine/renderer/tr_bsp.cpp b/src/engine/renderer/tr_bsp.cpp index 3655ea0fb2..aabcf32db6 100644 --- a/src/engine/renderer/tr_bsp.cpp +++ b/src/engine/renderer/tr_bsp.cpp @@ -4657,7 +4657,11 @@ static void SetWorldLight() { // Game model surfaces use grid lighting, they don't have vertex light colors. tr.modelDeluxe = deluxeMode_t::GRID; - // Only game models use emulated deluxe map from light direction grid. + // Only game models use emulated deluxe map from light direction grid, unless the + // `r_lightMode 2` debug option is used. + if ( tr.worldLight == lightMode_t::GRID ) { + tr.worldDeluxe = deluxeMode_t::GRID; + } } }