forked from Ports/perfect_dark
port: use a separate fb for fullscreen menu background
This commit is contained in:
1 parent
08ec8e541b
commit
3d8f63dbb6
1 file changed
+7
-6
+7
-6
@@ -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++);
|
||||
|
||||
Reference in new issue
Block a user