From 7ea025c6e17ac467a82e14cdb9d5a0ebfc5f18ef Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Wed, 3 Jan 2024 05:19:42 -0800 Subject: [PATCH] r_viewfbo 0: factor out motion blur. Motion blur doesn't NEED the blending pass. --- gl_rmain.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/gl_rmain.c b/gl_rmain.c index f57c30ed..9f2aaab9 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -5255,9 +5255,6 @@ static qbool R_BlendView_IsTrivial(int viewx, int viewy, int viewwidth, int view // Higher bit depth or explicit FBO requested? if (r_viewfbo.integer) return false; - // Motion blur? - if(r_refdef.view.ismain && !R_Stereo_Active() && (r_motionblur.value > 0 || (r_damageblur.value > 0 && cl.cshifts[CSHIFT_DAMAGE].percent != 0)) && r_fb.ghosttexture) - return false; // Non-trivial postprocessing shader permutation? if (r_fb.bloomwidth || r_refdef.viewblend[3] > 0 @@ -5277,13 +5274,8 @@ static qbool R_BlendView_IsTrivial(int viewx, int viewy, int viewwidth, int view return true; } -static void R_BlendView(int viewfbo, rtexture_t *viewdepthtexture, rtexture_t *viewcolortexture, int viewx, int viewy, int viewwidth, int viewheight, int fbo, rtexture_t *depthtexture, rtexture_t *colortexture, int x, int y, int width, int height) +static void R_MotionBlurView(int viewfbo, rtexture_t *viewdepthtexture, rtexture_t *viewcolortexture, int viewx, int viewy, int viewwidth, int viewheight) { - uint64_t permutation; - float uservecs[4][4]; - rtexture_t *viewtexture; - rtexture_t *bloomtexture; - R_EntityMatrix(&identitymatrix); if(r_refdef.view.ismain && !R_Stereo_Active() && (r_motionblur.value > 0 || (r_damageblur.value > 0 && cl.cshifts[CSHIFT_DAMAGE].percent != 0)) && r_fb.ghosttexture) @@ -5346,6 +5338,16 @@ static void R_BlendView(int viewfbo, rtexture_t *viewdepthtexture, rtexture_t *v r_refdef.stats[r_stat_bloom_copypixels] += viewwidth * viewheight; r_fb.ghosttexture_valid = true; } +} + +static void R_BlendView(rtexture_t *viewcolortexture, int fbo, rtexture_t *depthtexture, rtexture_t *colortexture, int x, int y, int width, int height) +{ + uint64_t permutation; + float uservecs[4][4]; + rtexture_t *viewtexture; + rtexture_t *bloomtexture; + + R_EntityMatrix(&identitymatrix); if (r_fb.bloomwidth) { @@ -5810,8 +5812,9 @@ void R_RenderView(int fbo, rtexture_t *depthtexture, rtexture_t *colortexture, i // postprocess uses textures that are not aligned with the viewport we're rendering, so no scissoring GL_ScissorTest(false); + R_MotionBlurView(viewfbo, viewdepthtexture, viewcolortexture, viewx, viewy, viewwidth, viewheight); if (!skipblend) - R_BlendView(viewfbo, viewdepthtexture, viewcolortexture, viewx, viewy, viewwidth, viewheight, fbo, depthtexture, colortexture, x, y, width, height); + R_BlendView(viewcolortexture, fbo, depthtexture, colortexture, x, y, width, height); if (r_timereport_active) R_TimeReport("blendview"); -- 2.39.2