@@ -199,42 +199,36 @@ GLuint64 GL_BindToTMU( int unit, image_t *image )
199199 return 0 ;
200200}
201201
202- static void BlitFBOToMSAA ( FBO_t* fbo ) {
203- glState.currentFBO = nullptr ;
204-
202+ static void BlitFBOToMSAA ( FBO_t* fbo, const GLbitfield mask ) {
205203 R_BindFBO ( GL_READ_FRAMEBUFFER, fbo );
206204 R_BindFBO ( GL_DRAW_FRAMEBUFFER, tr.msaaFBO );
207205 glBlitFramebuffer ( 0 , 0 , fbo->width , fbo->height , 0 , 0 , tr.msaaFBO ->width , tr.msaaFBO ->height ,
208- GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT , GL_NEAREST );
206+ mask , GL_NEAREST );
209207
210- glState.currentFBO = nullptr ;
211208 R_BindFBO ( GL_DRAW_FRAMEBUFFER, fbo );
212209 glState.currentFBO = fbo;
213210}
214211
215- static void BlitMSAAToFBO ( FBO_t* fbo ) {
216- glState.currentFBO = nullptr ;
217-
212+ static void BlitMSAAToFBO ( FBO_t* fbo, const GLbitfield mask ) {
218213 R_BindFBO ( GL_READ_FRAMEBUFFER, tr.msaaFBO );
219214 R_BindFBO ( GL_DRAW_FRAMEBUFFER, fbo );
220215 glBlitFramebuffer ( 0 , 0 , tr.msaaFBO ->width , tr.msaaFBO ->height , 0 , 0 , fbo->width , fbo->height ,
221- GL_COLOR_BUFFER_BIT /* | GL_DEPTH_BUFFER_BIT */ , GL_NEAREST );
216+ mask , GL_NEAREST );
222217
223- glState.currentFBO = nullptr ;
224218 R_BindFBO ( GL_READ_FRAMEBUFFER, fbo );
225219 glState.currentFBO = fbo;
226220}
227221
228- void TransitionMainToMSAA () {
222+ void TransitionMainToMSAA ( const GLbitfield mask ) {
229223 if ( glConfig.MSAA ) {
230- BlitFBOToMSAA ( tr.mainFBO [backEnd.currentMainFBO ] );
224+ BlitFBOToMSAA ( tr.mainFBO [backEnd.currentMainFBO ], mask );
231225 R_BindFBO ( tr.msaaFBO );
232226 }
233227}
234228
235- void TransitionMSAAToMain () {
229+ void TransitionMSAAToMain ( const GLbitfield mask ) {
236230 if ( glConfig.MSAA ) {
237- BlitMSAAToFBO ( tr.mainFBO [backEnd.currentMainFBO ] );
231+ BlitMSAAToFBO ( tr.mainFBO [backEnd.currentMainFBO ], mask );
238232 }
239233}
240234
@@ -1309,6 +1303,8 @@ static void RenderDepthTiles()
13091303 {
13101304 RB_PrepareForSamplingDepthMap ();
13111305 }
1306+
1307+ TransitionMSAAToMain ( GL_DEPTH_BUFFER_BIT );
13121308
13131309 // 1st step
13141310 R_BindFBO ( tr.depthtile1FBO );
@@ -1500,7 +1496,7 @@ void RB_RenderBloom()
15001496 GL_BindToTMU ( 0 , tr.currentRenderImage [backEnd.currentMainFBO ] )
15011497 );
15021498
1503- TransitionMSAAToMain ();
1499+ TransitionMSAAToMain ( GL_COLOR_BUFFER_BIT );
15041500
15051501 R_BindFBO ( tr.contrastRenderFBO );
15061502 GL_ClearColor ( 0 .0f , 0 .0f , 0 .0f , 1 .0f );
@@ -1566,7 +1562,7 @@ void RB_RenderBloom()
15661562 GL_PopMatrix ();
15671563 }
15681564
1569- TransitionMainToMSAA ();
1565+ TransitionMainToMSAA ( GL_COLOR_BUFFER_BIT );
15701566
15711567 GL_CheckErrors ();
15721568}
@@ -1588,7 +1584,7 @@ void RB_RenderMotionBlur()
15881584
15891585 gl_motionblurShader->BindProgram ();
15901586
1591- TransitionMSAAToMain ();
1587+ TransitionMSAAToMain ( GL_COLOR_BUFFER_BIT );
15921588
15931589 // Swap main FBOs
15941590 gl_motionblurShader->SetUniform_ColorMapBindless (
@@ -1605,7 +1601,7 @@ void RB_RenderMotionBlur()
16051601
16061602 Tess_InstantScreenSpaceQuad ();
16071603
1608- TransitionMainToMSAA ();
1604+ TransitionMainToMSAA ( GL_COLOR_BUFFER_BIT );
16091605
16101606 GL_CheckErrors ();
16111607}
@@ -1627,6 +1623,8 @@ void RB_RenderSSAO()
16271623
16281624 RB_PrepareForSamplingDepthMap ();
16291625
1626+ TransitionMSAAToMain ( GL_DEPTH_BUFFER_BIT );
1627+
16301628 GL_State ( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_ZERO );
16311629 GL_Cull ( cullType_t::CT_TWO_SIDED );
16321630
@@ -2856,7 +2854,7 @@ static void RB_RenderPostProcess()
28562854 materialSystem.EndFrame ();
28572855 }
28582856
2859- TransitionMSAAToMain ();
2857+ TransitionMSAAToMain ( GL_COLOR_BUFFER_BIT );
28602858
28612859 RB_FXAA ();
28622860
0 commit comments