@@ -78,10 +78,8 @@ GLShader_reflection *gl_reflectionShader = nullptr;
7878GLShader_reflectionMaterial *gl_reflectionShaderMaterial = nullptr ;
7979GLShader_screen *gl_screenShader = nullptr ;
8080GLShader_screenMaterial *gl_screenShaderMaterial = nullptr ;
81- GLShader_shadowFill *gl_shadowFillShader = nullptr ;
8281GLShader_skybox *gl_skyboxShader = nullptr ;
8382GLShader_skyboxMaterial *gl_skyboxShaderMaterial = nullptr ;
84- GLShader_debugShadowMap *gl_debugShadowMapShader = nullptr ;
8583GLShaderManager gl_shaderManager;
8684
8785namespace // Implementation details
@@ -320,11 +318,6 @@ static inline void AddDefine( std::string& defines, const std::string& define, f
320318 defines += Str::Format (" #ifndef %s\n #define %s vec2(%.8e, %.8e)\n #endif\n " , define, define, v1, v2);
321319}
322320
323- static inline void AddDefine ( std::string& defines, const std::string& define )
324- {
325- defines += Str::Format (" #ifndef %s\n #define %s\n #endif\n " , define, define);
326- }
327-
328321// Has to match enum genFunc_t in tr_local.h
329322static const char *const genFuncNames[] = {
330323 " DSTEP_NONE" ,
@@ -494,10 +487,12 @@ static void AddConst( std::string& str, const std::string& name, float value )
494487 str += Str::Format (" const float %s = %.8e;\n " , name, value);
495488}
496489
490+ #if 0
497491static void AddConst( std::string& str, const std::string& name, float v1, float v2 )
498492{
499493 str += Str::Format("const vec2 %s = vec2(%.8e, %.8e);\n", name, v1, v2);
500494}
495+ #endif
501496
502497static std::string GenVersionDeclaration ( const std::vector<addedExtension_t> &addedExtensions ) {
503498 // Declare version.
@@ -680,7 +675,6 @@ static std::string GenEngineConstants() {
680675 AddDefine ( str, " r_zNear" , r_znear->value );
681676
682677 AddDefine ( str, " M_PI" , static_cast < float >( M_PI ) );
683- AddDefine ( str, " MAX_SHADOWMAPS" , MAX_SHADOWMAPS );
684678 AddDefine ( str, " MAX_REF_LIGHTS" , MAX_REF_LIGHTS );
685679 AddDefine ( str, " NUM_LIGHT_LAYERS" , glConfig2.realtimeLightLayers );
686680 AddDefine ( str, " TILE_SIZE" , TILE_SIZE );
@@ -689,94 +683,6 @@ static std::string GenEngineConstants() {
689683
690684 AddDefine ( str, " r_tileStep" , glState.tileStep [0 ], glState.tileStep [1 ] );
691685
692- if ( glConfig2.shadowMapping )
693- {
694- switch ( glConfig2.shadowingMode )
695- {
696- case shadowingMode_t::SHADOWING_ESM16:
697- case shadowingMode_t::SHADOWING_ESM32:
698- AddDefine ( str, " ESM" , 1 );
699- break ;
700- case shadowingMode_t::SHADOWING_VSM16:
701- case shadowingMode_t::SHADOWING_VSM32:
702- AddDefine ( str, " VSM" , 1 );
703-
704- if ( glConfig.hardwareType == glHardwareType_t::GLHW_R300 )
705- {
706- AddDefine ( str, " VSM_CLAMP" , 1 );
707- }
708- break ;
709- case shadowingMode_t::SHADOWING_EVSM32:
710- AddDefine ( str, " EVSM" , 1 );
711-
712- // The exponents for the EVSM techniques should be less than ln(FLT_MAX/FILTER_SIZE)/2 {ln(FLT_MAX/1)/2 ~44.3}
713- // 42.9 is the maximum possible value for FILTER_SIZE=15
714- // 42.0 is the truncated value that we pass into the sample
715- AddConst ( str, " r_EVSMExponents" , 42 .0f , 42 .0f );
716-
717- if ( r_evsmPostProcess->integer )
718- {
719- AddDefine ( str, " r_EVSMPostProcess" , 1 );
720- }
721- break ;
722- default :
723- DAEMON_ASSERT ( false );
724- break ;
725- }
726-
727- switch ( glConfig2.shadowingMode )
728- {
729- case shadowingMode_t::SHADOWING_ESM16:
730- case shadowingMode_t::SHADOWING_ESM32:
731- break ;
732- case shadowingMode_t::SHADOWING_VSM16:
733- AddConst ( str, " VSM_EPSILON" , 0 .0001f );
734- break ;
735- case shadowingMode_t::SHADOWING_VSM32:
736- // GLHW_R300 should not be GLDRV_OPENGL3 anyway.
737- if ( glConfig.driverType != glDriverType_t::GLDRV_OPENGL3
738- || glConfig.hardwareType == glHardwareType_t::GLHW_R300 )
739- {
740- AddConst ( str, " VSM_EPSILON" , 0 .0001f );
741- }
742- else
743- {
744- AddConst ( str, " VSM_EPSILON" , 0 .000001f );
745- }
746- break ;
747- case shadowingMode_t::SHADOWING_EVSM32:
748- // This may be wrong, but the code did that before it was rewritten.
749- AddConst ( str, " VSM_EPSILON" , 0 .0001f );
750- break ;
751- default :
752- DAEMON_ASSERT ( false );
753- break ;
754- }
755-
756- if ( r_lightBleedReduction->value )
757- AddConst ( str, " r_lightBleedReduction" , r_lightBleedReduction->value );
758-
759- if ( r_overDarkeningFactor->value )
760- AddConst ( str, " r_overDarkeningFactor" , r_overDarkeningFactor->value );
761-
762- if ( r_shadowMapDepthScale->value )
763- AddConst ( str, " r_shadowMapDepthScale" , r_shadowMapDepthScale->value );
764-
765- if ( r_debugShadowMaps->integer )
766- AddDefine ( str, " r_debugShadowMaps" , r_debugShadowMaps->integer );
767-
768- if ( r_softShadows->integer == 6 )
769- AddDefine ( str, " PCSS" , 1 );
770- else if ( r_softShadows->integer )
771- AddConst ( str, " r_PCFSamples" , r_softShadows->value + 1 .0f );
772-
773- if ( r_parallelShadowSplits->integer )
774- AddDefine ( str, Str::Format ( " r_parallelShadowSplits_%d" , r_parallelShadowSplits->integer ) );
775-
776- if ( r_showParallelShadowSplits->integer )
777- AddDefine ( str, " r_showParallelShadowSplits" , 1 );
778- }
779-
780686 if ( glConfig2.realtimeLighting )
781687 {
782688 AddDefine ( str, " r_realtimeLighting" , 1 );
@@ -2655,8 +2561,6 @@ GLShader_forwardLighting_omniXYZ::GLShader_forwardLighting_omniXYZ():
26552561 u_MaterialMap( this ),
26562562 u_AttenuationMapXY( this ),
26572563 u_AttenuationMapZ( this ),
2658- u_ShadowMap( this ),
2659- u_ShadowClipMap( this ),
26602564 u_RandomMap( this ),
26612565 u_HeightMap( this ),
26622566 u_TextureMatrix( this ),
@@ -2672,8 +2576,6 @@ GLShader_forwardLighting_omniXYZ::GLShader_forwardLighting_omniXYZ():
26722576 u_LightRadius( this ),
26732577 u_LightScale( this ),
26742578 u_LightAttenuationMatrix( this ),
2675- u_ShadowTexelSize( this ),
2676- u_ShadowBlur( this ),
26772579 u_ModelMatrix( this ),
26782580 u_ModelViewProjectionMatrix( this ),
26792581 u_Bones( this ),
@@ -2685,8 +2587,7 @@ GLShader_forwardLighting_omniXYZ::GLShader_forwardLighting_omniXYZ():
26852587 GLCompileMacro_USE_VERTEX_SKINNING( this ),
26862588 GLCompileMacro_USE_VERTEX_ANIMATION( this ),
26872589 GLCompileMacro_USE_HEIGHTMAP_IN_NORMALMAP( this ),
2688- GLCompileMacro_USE_RELIEF_MAPPING( this ),
2689- GLCompileMacro_USE_SHADOWING( this )
2590+ GLCompileMacro_USE_RELIEF_MAPPING( this )
26902591{
26912592}
26922593
@@ -2697,9 +2598,7 @@ void GLShader_forwardLighting_omniXYZ::SetShaderProgramUniforms( ShaderProgramDe
26972598 glUniform1i ( glGetUniformLocation ( shaderProgram->id , " u_MaterialMap" ), 2 );
26982599 glUniform1i ( glGetUniformLocation ( shaderProgram->id , " u_AttenuationMapXY" ), 3 );
26992600 glUniform1i ( glGetUniformLocation ( shaderProgram->id , " u_AttenuationMapZ" ), 4 );
2700- glUniform1i ( glGetUniformLocation ( shaderProgram->id , " u_ShadowMap" ), 5 );
27012601 glUniform1i ( glGetUniformLocation ( shaderProgram->id , " u_RandomMap" ), 6 );
2702- glUniform1i ( glGetUniformLocation ( shaderProgram->id , " u_ShadowClipMap" ), 7 );
27032602 glUniform1i ( glGetUniformLocation ( shaderProgram->id , " u_HeightMap" ), 15 );
27042603}
27052604
@@ -2711,8 +2610,6 @@ GLShader_forwardLighting_projXYZ::GLShader_forwardLighting_projXYZ():
27112610 u_MaterialMap( this ),
27122611 u_AttenuationMapXY( this ),
27132612 u_AttenuationMapZ( this ),
2714- u_ShadowMap0( this ),
2715- u_ShadowClipMap0( this ),
27162613 u_RandomMap( this ),
27172614 u_HeightMap( this ),
27182615 u_TextureMatrix( this ),
@@ -2728,9 +2625,6 @@ GLShader_forwardLighting_projXYZ::GLShader_forwardLighting_projXYZ():
27282625 u_LightRadius( this ),
27292626 u_LightScale( this ),
27302627 u_LightAttenuationMatrix( this ),
2731- u_ShadowTexelSize( this ),
2732- u_ShadowBlur( this ),
2733- u_ShadowMatrix( this ),
27342628 u_ModelMatrix( this ),
27352629 u_ModelViewProjectionMatrix( this ),
27362630 u_Bones( this ),
@@ -2742,8 +2636,7 @@ GLShader_forwardLighting_projXYZ::GLShader_forwardLighting_projXYZ():
27422636 GLCompileMacro_USE_VERTEX_SKINNING( this ),
27432637 GLCompileMacro_USE_VERTEX_ANIMATION( this ),
27442638 GLCompileMacro_USE_HEIGHTMAP_IN_NORMALMAP( this ),
2745- GLCompileMacro_USE_RELIEF_MAPPING( this ),
2746- GLCompileMacro_USE_SHADOWING( this )
2639+ GLCompileMacro_USE_RELIEF_MAPPING( this )
27472640{
27482641}
27492642
@@ -2759,9 +2652,7 @@ void GLShader_forwardLighting_projXYZ::SetShaderProgramUniforms( ShaderProgramDe
27592652 glUniform1i ( glGetUniformLocation ( shaderProgram->id , " u_MaterialMap" ), 2 );
27602653 glUniform1i ( glGetUniformLocation ( shaderProgram->id , " u_AttenuationMapXY" ), 3 );
27612654 glUniform1i ( glGetUniformLocation ( shaderProgram->id , " u_AttenuationMapZ" ), 4 );
2762- glUniform1i ( glGetUniformLocation ( shaderProgram->id , " u_ShadowMap0" ), 5 );
27632655 glUniform1i ( glGetUniformLocation ( shaderProgram->id , " u_RandomMap" ), 6 );
2764- glUniform1i ( glGetUniformLocation ( shaderProgram->id , " u_ShadowClipMap0" ), 7 );
27652656 glUniform1i ( glGetUniformLocation ( shaderProgram->id , " u_HeightMap" ), 15 );
27662657}
27672658
@@ -2771,16 +2662,6 @@ GLShader_forwardLighting_directionalSun::GLShader_forwardLighting_directionalSun
27712662 u_DiffuseMap( this ),
27722663 u_NormalMap( this ),
27732664 u_MaterialMap( this ),
2774- u_ShadowMap0( this ),
2775- u_ShadowMap1( this ),
2776- u_ShadowMap2( this ),
2777- u_ShadowMap3( this ),
2778- u_ShadowMap4( this ),
2779- u_ShadowClipMap0( this ),
2780- u_ShadowClipMap1( this ),
2781- u_ShadowClipMap2( this ),
2782- u_ShadowClipMap3( this ),
2783- u_ShadowClipMap4( this ),
27842665 u_HeightMap( this ),
27852666 u_TextureMatrix( this ),
27862667 u_SpecularExponent( this ),
@@ -2795,10 +2676,6 @@ GLShader_forwardLighting_directionalSun::GLShader_forwardLighting_directionalSun
27952676 u_LightRadius( this ),
27962677 u_LightScale( this ),
27972678 u_LightAttenuationMatrix( this ),
2798- u_ShadowTexelSize( this ),
2799- u_ShadowBlur( this ),
2800- u_ShadowMatrix( this ),
2801- u_ShadowParallelSplitDistances( this ),
28022679 u_ModelMatrix( this ),
28032680 u_ViewMatrix( this ),
28042681 u_ModelViewProjectionMatrix( this ),
@@ -2811,8 +2688,7 @@ GLShader_forwardLighting_directionalSun::GLShader_forwardLighting_directionalSun
28112688 GLCompileMacro_USE_VERTEX_SKINNING( this ),
28122689 GLCompileMacro_USE_VERTEX_ANIMATION( this ),
28132690 GLCompileMacro_USE_HEIGHTMAP_IN_NORMALMAP( this ),
2814- GLCompileMacro_USE_RELIEF_MAPPING( this ),
2815- GLCompileMacro_USE_SHADOWING( this )
2691+ GLCompileMacro_USE_RELIEF_MAPPING( this )
28162692{
28172693}
28182694
@@ -2828,45 +2704,9 @@ void GLShader_forwardLighting_directionalSun::SetShaderProgramUniforms( ShaderPr
28282704 glUniform1i ( glGetUniformLocation ( shaderProgram->id , " u_MaterialMap" ), 2 );
28292705 // glUniform1i(glGetUniformLocation( shaderProgram->id, "u_AttenuationMapXY" ), 3);
28302706 // glUniform1i(glGetUniformLocation( shaderProgram->id, "u_AttenuationMapZ" ), 4);
2831- glUniform1i ( glGetUniformLocation ( shaderProgram->id , " u_ShadowMap0" ), 5 );
2832- glUniform1i ( glGetUniformLocation ( shaderProgram->id , " u_ShadowMap1" ), 6 );
2833- glUniform1i ( glGetUniformLocation ( shaderProgram->id , " u_ShadowMap2" ), 7 );
2834- glUniform1i ( glGetUniformLocation ( shaderProgram->id , " u_ShadowMap3" ), 8 );
2835- glUniform1i ( glGetUniformLocation ( shaderProgram->id , " u_ShadowMap4" ), 9 );
2836- glUniform1i ( glGetUniformLocation ( shaderProgram->id , " u_ShadowClipMap0" ), 10 );
2837- glUniform1i ( glGetUniformLocation ( shaderProgram->id , " u_ShadowClipMap1" ), 11 );
2838- glUniform1i ( glGetUniformLocation ( shaderProgram->id , " u_ShadowClipMap2" ), 12 );
2839- glUniform1i ( glGetUniformLocation ( shaderProgram->id , " u_ShadowClipMap3" ), 13 );
2840- glUniform1i ( glGetUniformLocation ( shaderProgram->id , " u_ShadowClipMap4" ), 14 );
28412707 glUniform1i ( glGetUniformLocation ( shaderProgram->id , " u_HeightMap" ), 15 );
28422708}
28432709
2844- GLShader_shadowFill::GLShader_shadowFill () :
2845- GLShader( " shadowFill" , ATTR_POSITION | ATTR_TEXCOORD | ATTR_QTANGENT,
2846- false , " shadowFill" , " shadowFill" ),
2847- u_ColorMap( this ),
2848- u_TextureMatrix( this ),
2849- u_AlphaThreshold( this ),
2850- u_LightOrigin( this ),
2851- u_LightRadius( this ),
2852- u_ModelMatrix( this ),
2853- u_ModelViewProjectionMatrix( this ),
2854- u_Color_Float( this ),
2855- u_Color_Uint( this ),
2856- u_Bones( this ),
2857- u_VertexInterpolation( this ),
2858- GLDeformStage( this ),
2859- GLCompileMacro_USE_VERTEX_SKINNING( this ),
2860- GLCompileMacro_USE_VERTEX_ANIMATION( this ),
2861- GLCompileMacro_LIGHT_DIRECTIONAL( this )
2862- {
2863- }
2864-
2865- void GLShader_shadowFill::SetShaderProgramUniforms ( ShaderProgramDescriptor *shaderProgram )
2866- {
2867- glUniform1i ( glGetUniformLocation ( shaderProgram->id , " u_ColorMap" ), 0 );
2868- }
2869-
28702710GLShader_reflection::GLShader_reflection ():
28712711 GLShader( " reflection" , ATTR_POSITION | ATTR_TEXCOORD | ATTR_QTANGENT,
28722712 false , " reflection_CB" , " reflection_CB" ),
@@ -3153,19 +2993,6 @@ void GLShader_blur::SetShaderProgramUniforms( ShaderProgramDescriptor *shaderPro
31532993 glUniform1i ( glGetUniformLocation ( shaderProgram->id , " u_ColorMap" ), 0 );
31542994}
31552995
3156- GLShader_debugShadowMap::GLShader_debugShadowMap () :
3157- GLShader( " debugShadowMap" , ATTR_POSITION,
3158- false , " debugShadowMap" , " debugShadowMap" ),
3159- u_CurrentMap( this ),
3160- u_ModelViewProjectionMatrix( this )
3161- {
3162- }
3163-
3164- void GLShader_debugShadowMap::SetShaderProgramUniforms ( ShaderProgramDescriptor *shaderProgram )
3165- {
3166- glUniform1i ( glGetUniformLocation ( shaderProgram->id , " u_CurrentMap" ), 0 );
3167- }
3168-
31692996GLShader_liquid::GLShader_liquid () :
31702997 GLShader( " liquid" , ATTR_POSITION | ATTR_TEXCOORD | ATTR_QTANGENT,
31712998 false , " liquid" , " liquid" ),
0 commit comments