]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
r_viewfbo 0: fix restoring GL_Scissor values at the end of skybox render.
authorRudolf Polzer <divVerent@gmail.com>
Wed, 3 Jan 2024 14:20:45 +0000 (06:20 -0800)
committerdivVerent <divVerent@gmail.com>
Wed, 3 Jan 2024 19:35:20 +0000 (14:35 -0500)
Fixes wrong handling of viewsize with r_viewfbo 0.

gl_rmain.c
r_sky.c

index 9f2aaab94848f69e3e0a9ad5b5166b9ab9fe22ae..770e326498a53ecc28aee5d11ef31dcfc07314e1 100644 (file)
@@ -5243,12 +5243,8 @@ static void R_Bloom_MakeTexture(void)
        r_fb.rt_bloom = cur;
 }
 
-static qbool R_BlendView_IsTrivial(int viewx, int viewy, int viewwidth, int viewheight, int x, int y, int width, int height)
+static qbool R_BlendView_IsTrivial(int viewwidth, int viewheight, int width, int height)
 {
-       // Shifting requested?
-       // (It should be possible to work around this otherwise)
-       if (viewx != x || viewy != y)
-               return false;
        // Scaling requested?
        if (viewwidth != width || viewheight != height)
                return false;
@@ -5742,7 +5738,7 @@ void R_RenderView(int fbo, rtexture_t *depthtexture, rtexture_t *colortexture, i
        if(r_fb.rt_bloom)
                r_refdef.view.colorscale *= r_bloom_scenebrightness.value;
 
-       skipblend = R_BlendView_IsTrivial(0, 0, r_fb.rt_screen->texturewidth, r_fb.rt_screen->textureheight, x, y, width, height);
+       skipblend = R_BlendView_IsTrivial(r_fb.rt_screen->texturewidth, r_fb.rt_screen->textureheight, width, height);
        if (skipblend)
        {
                // Render to the screen right away.
@@ -5805,7 +5801,7 @@ void R_RenderView(int fbo, rtexture_t *depthtexture, rtexture_t *colortexture, i
        // test needs to be on
        if (r_fb.rt_screen)
                GL_ScissorTest(true);
-       GL_Scissor(viewx, viewy, viewwidth, viewheight);
+       GL_Scissor(r_refdef.view.viewport.x, r_refdef.view.viewport.y, r_refdef.view.viewport.width, r_refdef.view.viewport.height);
        R_RenderScene(viewfbo, viewdepthtexture, viewcolortexture, viewx, viewy, viewwidth, viewheight);
        r_fb.water.numwaterplanes = 0;
 
diff --git a/r_sky.c b/r_sky.c
index 7fd1463dbc7239c60c998ea3124db9ca861234a5..8c29d32ef9b36f345768921b3a7e428b8ae5d398 100644 (file)
--- a/r_sky.c
+++ b/r_sky.c
@@ -432,7 +432,7 @@ void R_Sky(void)
                //GL_Clear(GL_DEPTH_BUFFER_BIT);
        }
        */
-       GL_Scissor(0, 0, r_fb.screentexturewidth, r_fb.screentextureheight);
+       GL_Scissor(r_refdef.view.viewport.x, r_refdef.view.viewport.y, r_refdef.view.viewport.width, r_refdef.view.viewport.height);
 }
 
 //===============================================================