@@ -3221,8 +3221,8 @@ static void AdaptiveLightingReduction() {
32213221
32223222 gl_luminanceReductionShader->BindProgram ( 0 );
32233223
3224- const int width = tr. currentRenderImage [backEnd. currentMainFBO ]-> width ;
3225- const int height = tr. currentRenderImage [backEnd. currentMainFBO ]-> height ;
3224+ const int width = glConfig. vidWidth ;
3225+ const int height = glConfig. vidHeight ;
32263226
32273227 uint32_t globalWorkgroupX = ( width + 7 ) / 8 ;
32283228 uint32_t globalWorkgroupY = ( height + 7 ) / 8 ;
@@ -3232,6 +3232,7 @@ static void AdaptiveLightingReduction() {
32323232 gl_luminanceReductionShader->SetUniform_ViewWidth ( width );
32333233 gl_luminanceReductionShader->SetUniform_ViewHeight ( height );
32343234 vec4_t parms { log2f ( r_toneMappingHDRMax.Get () ) };
3235+ parms[1 ] = UINT32_MAX / ( width * height * ( uint32_t ( parms[0 ] ) + 8 ) );
32353236 gl_luminanceReductionShader->SetUniform_TonemapParms2 ( parms );
32363237
32373238 glMemoryBarrier ( GL_ATOMIC_COUNTER_BARRIER_BIT );
@@ -3299,6 +3300,10 @@ void RB_CameraPostFX() {
32993300 r_toneMappingDarkAreaPointHDR.Get (), r_toneMappingDarkAreaPointLDR.Get (), tonemapParms[2 ], tonemapParms[3 ] );
33003301 gl_cameraEffectsShader->SetUniform_TonemapParms ( tonemapParms );
33013302
3303+ vec4_t parms{ log2f ( r_toneMappingHDRMax.Get () ) };
3304+ parms[1 ] = UINT32_MAX / ( glConfig.vidWidth * glConfig.vidHeight * ( uint32_t ( parms[0 ] ) + 8 ) );
3305+ gl_cameraEffectsShader->SetUniform_TonemapParms2 ( parms );
3306+
33023307 gl_cameraEffectsShader->SetUniform_TonemapAdaptiveExposure (
33033308 glConfig2.adaptiveExposureAvailable && r_toneMappingAdaptiveExposure.Get () );
33043309 gl_cameraEffectsShader->SetUniform_TonemapExposure ( r_toneMappingExposure.Get () );
0 commit comments