Skip to content

Commit 26720f5

Browse files
committed
Fix MSAA with depth-fade and global fog
1 parent 353b2ce commit 26720f5

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/engine/renderer/tr_backend.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,8 +1622,6 @@ void RB_RenderSSAO()
16221622

16231623
RB_PrepareForSamplingDepthMap();
16241624

1625-
TransitionMSAAToMain( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
1626-
16271625
GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_ZERO );
16281626
GL_Cull( cullType_t::CT_TWO_SIDED );
16291627

@@ -1655,8 +1653,6 @@ void RB_RenderSSAO()
16551653

16561654
Tess_InstantScreenSpaceQuad();
16571655

1658-
TransitionMainToMSAA( GL_COLOR_BUFFER_BIT );
1659-
16601656
GL_CheckErrors();
16611657
}
16621658

@@ -2800,11 +2796,16 @@ static void RB_RenderView( bool depthPass )
28002796
RB_RenderDrawSurfaces( shaderSort_t::SS_ENVIRONMENT_FOG, shaderSort_t::SS_OPAQUE, DRAWSURFACES_ALL );
28012797
}
28022798

2799+
// Here so we don't do an extra MSAA resolve if both SSAO and global fog are present
2800+
TransitionMSAAToMain( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
2801+
28032802
RB_RenderSSAO();
28042803

28052804
// render global fog post process effect
28062805
RB_RenderGlobalFog();
28072806

2807+
TransitionMainToMSAA( GL_COLOR_BUFFER_BIT );
2808+
28082809
// draw everything that is translucent
28092810
if ( glConfig.usingMaterialSystem ) {
28102811
materialSystem.RenderMaterials( shaderSort_t::SS_ENVIRONMENT_NOFOG, shaderSort_t::SS_POST_PROCESS, backEnd.viewParms.viewID );

src/engine/renderer/tr_shade.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -900,10 +900,7 @@ void Render_generic3D( shaderStage_t *pStage )
900900
{
901901
RB_PrepareForSamplingDepthMap();
902902

903-
if ( glConfig.MSAA && backEnd.dirtyDepthBuffer ) {
904-
TransitionMSAAToMain( GL_DEPTH_BUFFER_BIT );
905-
R_BindFBO( GL_DRAW_FRAMEBUFFER, tr.msaaFBO );
906-
}
903+
TransitionMSAAToMain( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
907904
}
908905

909906
// choose right shader program ----------------------------------
@@ -992,6 +989,10 @@ void Render_generic3D( shaderStage_t *pStage )
992989

993990
Tess_DrawElements();
994991

992+
if ( needDepthMap ) {
993+
TransitionMainToMSAA( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
994+
}
995+
995996
GL_CheckErrors();
996997
}
997998

0 commit comments

Comments
 (0)