@@ -73,7 +73,7 @@ static void EnableAvailableFeatures()
7373
7474 if ( glConfig2.realtimeLightLayers > glConfig2.max3DTextureSize ) {
7575 glConfig2.realtimeLightLayers = glConfig2.max3DTextureSize ;
76- Log::Notice ( " r_realtimeLightLayers exceeds maximum 3D texture size, using %i instead" , glConfig2.max3DTextureSize );
76+ Log::Notice ( " r_realtimeLightLayers exceeds maximum 3D texture size, using %i instead. " , glConfig2.max3DTextureSize );
7777 }
7878
7979 Log::Notice ( " Using %i dynamic light layers, %i dynamic lights available per tile" , glConfig2.realtimeLightLayers ,
@@ -94,12 +94,28 @@ static void EnableAvailableFeatures()
9494 glConfig2.shadowingMode = shadowingMode_t ( r_shadows.Get () );
9595 glConfig2.shadowMapping = glConfig2.shadowingMode >= shadowingMode_t::SHADOWING_ESM16;
9696
97- if ( glConfig2.shadowMapping )
97+ glConfig2.toneMapping = r_toneMapping.Get ();
98+
99+ if ( !r_highPrecisionRendering.Get () )
98100 {
99- if ( !glConfig2.textureFloatAvailable )
101+ Log::Warn ( " Tone mapping disabled because high precision rendering is disabled." );
102+ glConfig2.toneMapping = false ;
103+ }
104+
105+ if ( !glConfig2.textureFloatAvailable )
106+ {
107+ static const std::pair<bool *, std::string> textureFloatFeatures[] = {
108+ { &glConfig2.shadowMapping , " Shadow mapping" },
109+ { &glConfig2.toneMapping , " Tone mapping" },
110+ };
111+
112+ for ( auto & f : textureFloatFeatures )
100113 {
101- Log::Warn ( " Shadow mapping disabled because ARB_texture_float is not available" );
102- glConfig2.shadowMapping = false ;
114+ if ( *f.first )
115+ {
116+ Log::Warn ( " %s disabled because ARB_texture_float is not available." , f.second , " ARB_texture_float" );
117+ *f.first = false ;
118+ }
103119 }
104120 }
105121
@@ -136,14 +152,29 @@ static void EnableAvailableFeatures()
136152 }
137153 }
138154
139-
140155 // Disable features that require deluxe mapping to be enabled.
141156 glConfig2.normalMapping = glConfig2.deluxeMapping && glConfig2.normalMapping ;
142157 glConfig2.specularMapping = glConfig2.deluxeMapping && glConfig2.specularMapping ;
143158 glConfig2.physicalMapping = glConfig2.deluxeMapping && glConfig2.physicalMapping ;
144159
145160 glConfig2.bloom = r_bloom.Get ();
146161
162+ glConfig2.ssao = r_ssao.Get () != Util::ordinal ( ssaoMode::DISABLED );
163+
164+ static const std::pair<bool *, std::string> ssaoRequiredExtensions[] = {
165+ { &glConfig2.textureGatherAvailable , " ARB_texture_gather" },
166+ { &glConfig2.gpuShader4Available , " EXT_gpu_shader4" },
167+ };
168+
169+ for ( auto & e: ssaoRequiredExtensions )
170+ {
171+ if ( *e.first )
172+ {
173+ Log::Warn ( " SSAO disabled because %s is not available." , e.second );
174+ glConfig2.ssao = false ;
175+ }
176+ }
177+
147178 /* Motion blur is enabled by cg_motionblur which is a client cvar so we have to build it in all cases,
148179 unless unsupported by the hardware which is the only condition when the engine knows it is not used. */
149180 glConfig2.motionBlur = true ;
@@ -369,16 +400,9 @@ static void GLSL_InitGPUShadersOrError()
369400 gl_shaderManager.load ( gl_motionblurShader );
370401 }
371402
372- if ( r_ssao-> integer )
403+ if ( glConfig2. ssao )
373404 {
374- if ( glConfig2.textureGatherAvailable )
375- {
376- gl_shaderManager.load ( gl_ssaoShader );
377- }
378- else
379- {
380- Log::Warn (" SSAO not used because GL_ARB_texture_gather is not available." );
381- }
405+ gl_shaderManager.load ( gl_ssaoShader );
382406 }
383407
384408 if ( r_FXAA->integer != 0 )
0 commit comments