From 3d8f63dbb6c6c92fd48917713c8cb354db402131 Mon Sep 17 00:00:00 2001 From: fgsfds Date: Sat, 16 Nov 2024 12:31:37 +0100 Subject: [PATCH] port: use a separate fb for fullscreen menu background --- src/game/menugfx.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/game/menugfx.c b/src/game/menugfx.c index daa4aa00c..11b9f9a58 100644 --- a/src/game/menugfx.c +++ b/src/game/menugfx.c @@ -31,7 +31,8 @@ #define PXTOBYTES(val) ((val) * 2) #ifndef PLATFORM_N64 -static s32 g_MenuBlurFb = 0; +static s32 g_MenuBlurFb = -1; +static s32 g_MenuScreenFb = -1; static bool g_MenuBlurDone = false; #endif @@ -124,8 +125,9 @@ void menugfxCreateBlur(void) g_ScaleX = 1; #else - if (g_MenuBlurFb == 0) { + if (g_MenuBlurFb < 0) { g_MenuBlurFb = videoCreateFramebuffer(BLURIMG_WIDTH, BLURIMG_HEIGHT, true, false); + g_MenuScreenFb = videoCreateFramebuffer(0, 0, false, true); } // copy full viewport and downscale to 40x30 videoCopyFramebuffer(g_MenuBlurFb, 0, -1, -1); @@ -151,14 +153,13 @@ Gfx *menugfxRenderBgBlur(Gfx *gdl, u32 colour, s16 arg2, s16 arg3) #ifndef PLATFORM_N64 width = viGetWidth(); height = viGetHeight(); - if (g_MenuBlurFb && !g_MenuBlurDone) { + if (g_MenuBlurFb >= 0 && !g_MenuBlurDone) { // blit the small blur texture onto a screen-sized framebuffer while blurring it g_MenuBlurDone = true; - g_BlurFbDirty = true; gdl = bviewPrepareStaticRgba16(gdl, 0xffffffff, 0xff); gDPSetTextureFilter(gdl++, G_TF_BLUR_EXT); gDPSetFramebufferTextureEXT(gdl++, G_IM_FMT_RGBA, G_IM_SIZ_16b, BLURIMG_WIDTH, g_MenuBlurFb); - gDPSetFramebufferTargetEXT(gdl++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, g_BlurFb); + gDPSetFramebufferTargetEXT(gdl++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, g_MenuScreenFb); gSPImageRectangleEXT(gdl++, 0, 0, 0, 0, width << 2, height << 2, BLURIMG_WIDTH, BLURIMG_HEIGHT, 0, BLURIMG_WIDTH, BLURIMG_HEIGHT); gDPSetFramebufferTargetEXT(gdl++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, 0); gDPSetFramebufferTextureEXT(gdl++, G_IM_FMT_RGBA, G_IM_SIZ_16b, BLURIMG_WIDTH, 0); @@ -177,7 +178,7 @@ Gfx *menugfxRenderBgBlur(Gfx *gdl, u32 colour, s16 arg2, s16 arg3) #ifndef PLATFORM_N64 // LoadTextureBlock will set up the sizes, but we'll use the framebuffer instead of g_BlurBuffer - gDPSetFramebufferTextureEXT(gdl++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, g_BlurFb); + gDPSetFramebufferTextureEXT(gdl++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, g_MenuScreenFb); #endif gDPPipeSync(gdl++);