OpenGL2: Fix border for cg_viewsize using HDR/FB-MSAA w/postProcess

If using renderFBO (r_hdr 1 or r_ext_framebuffer_multisample > 0) and
r_postProcess 1, the viewport border (cg_viewsize < 100) which is drawn
before the world scene was drawn to the renderFBO but not copied to the
default framebuffer.

Now 2D before the world scene is drawn to the default framebuffer
directly for r_postProcess 1 like 2D drawn after the world scene.
This commit is contained in:
Zack Middleton 2023-11-18 19:10:53 -06:00 committed by The Turtle Man ♣
parent 78359180a4
commit a81df34905
2 changed files with 5 additions and 20 deletions

View file

@ -342,9 +342,7 @@ void RB_BeginDrawingView (void) {
{
FBO_t *fbo = backEnd.viewParms.targetFbo;
// FIXME: HUGE HACK: render to the screen fbo if we've already postprocessed the frame and aren't drawing more world
// drawing more world check is in case of double renders, such as skyportals
if (fbo == NULL && !(backEnd.framePostProcessed && (backEnd.refdef.rdflags & RDF_NOWORLDMODEL)))
if (fbo == NULL && (!r_postProcess->integer || !(backEnd.refdef.rdflags & RDF_NOWORLDMODEL)))
fbo = tr.renderFbo;
if (tr.renderCubeFbo && fbo == tr.renderCubeFbo)
@ -708,10 +706,9 @@ void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte *
ri.Printf( PRINT_ALL, "qglTexSubImage2D %i, %i: %i msec\n", cols, rows, end - start );
}
// FIXME: HUGE hack
if (glRefConfig.framebufferObject)
{
FBO_Bind(backEnd.framePostProcessed ? NULL : tr.renderFbo);
FBO_Bind(r_postProcess->integer ? NULL : tr.renderFbo);
}
RB_SetGL2D();
@ -795,9 +792,8 @@ const void *RB_StretchPic ( const void *data ) {
cmd = (const stretchPicCommand_t *)data;
// FIXME: HUGE hack
if (glRefConfig.framebufferObject)
FBO_Bind(backEnd.framePostProcessed ? NULL : tr.renderFbo);
FBO_Bind(r_postProcess->integer ? NULL : tr.renderFbo);
RB_SetGL2D();
@ -1313,14 +1309,7 @@ const void *RB_ClearDepth(const void *data)
if (glRefConfig.framebufferObject)
{
if (!tr.renderFbo || backEnd.framePostProcessed)
{
FBO_Bind(NULL);
}
else
{
FBO_Bind(tr.renderFbo);
}
FBO_Bind(tr.renderFbo);
}
qglClear(GL_DEPTH_BUFFER_BIT);
@ -1378,7 +1367,7 @@ const void *RB_SwapBuffers( const void *data ) {
if (glRefConfig.framebufferObject)
{
if (!backEnd.framePostProcessed)
if (!r_postProcess->integer)
{
if (tr.msaaResolveFbo && r_hdr->integer)
{
@ -1401,7 +1390,6 @@ const void *RB_SwapBuffers( const void *data ) {
GLimp_EndFrame();
backEnd.framePostProcessed = qfalse;
backEnd.projection2D = qfalse;
return (const void *)(cmd + 1);
@ -1655,8 +1643,6 @@ const void *RB_PostProcess(const void *data)
}
#endif
backEnd.framePostProcessed = qtrue;
return (const void *)(cmd + 1);
}

View file

@ -1472,7 +1472,6 @@ typedef struct {
FBO_t *last2DFBO;
qboolean colorMask[4];
qboolean framePostProcessed;
qboolean depthFill;
} backEndState_t;