port: don't render garbage in the first blur frame (fixes #287)

This commit is contained in:
fgsfds committed 2023-12-06 14:57:21 +01:00
1 parent f46359b307
commit 3118d01921
4 files changed
+25 -2

No files matched your search

+5
View File
@@ -104,6 +104,7 @@ bool g_SchedIsFirstTask = true;
s32 g_PrevFrameFb = -1;
s32 g_BlurFb = -1;
s32 g_BlurFbCapTimer = -1;
bool g_BlurFbDirty = true;
void schedSetCrashEnable1(bool enable)
{
@@ -390,8 +391,12 @@ void schedConsiderScreenshot(void)
if (g_BlurFbCapTimer == 0) {
videoCopyFramebuffer(g_BlurFb, 0, -1, -1);
g_BlurFbCapTimer = -1;
g_BlurFbDirty = false;
} else if (g_BlurFbCapTimer > 0) {
--g_BlurFbCapTimer;
} else if (g_BlurFbCapTimer < 0) {
// no blur requested this frame, mark blur fb dirty
g_BlurFbDirty = true;
}
if (g_MenuData.screenshottimer >= 2) {
+16 -2
View File
@@ -289,6 +289,14 @@ Gfx *bviewDrawMotionBlur(Gfx *gdl, u32 colour, u32 alpha)
if (!videoFramebuffersSupported()) {
return gdl;
}
// capture fb at the end of this frame
g_BlurFbCapTimer = 0;
// don't render first blur frame as we haven't captured the fb yet
if (g_BlurFbDirty) {
return gdl;
}
#endif
mainOverrideVariable("sfxxx", &sfxxx);
@@ -312,7 +320,6 @@ Gfx *bviewDrawMotionBlur(Gfx *gdl, u32 colour, u32 alpha)
viewleft << 2, viewtop << 2, viewleft, viewtop,
(viewleft + viewwidth) << 2, (viewtop + viewheight) << 2, viewleft + viewwidth, viewtop + viewheight,
0, videoGetNativeWidth(), videoGetNativeHeight());
g_BlurFbCapTimer = 0;
#endif
return gdl;
@@ -521,6 +528,14 @@ Gfx *bviewDrawZoomBlur(Gfx *gdl, u32 colour, s32 alpha, f32 arg3, f32 arg4)
if (!videoFramebuffersSupported()) {
return gdl;
}
// capture fb at the end of this frame
g_BlurFbCapTimer = 0;
// don't render first blur frame as we haven't captured the fb yet
if (g_BlurFbDirty) {
return gdl;
}
#endif
strcpy(var800a41c0, "stretchBlurGfx");
@@ -550,7 +565,6 @@ Gfx *bviewDrawZoomBlur(Gfx *gdl, u32 colour, s32 alpha, f32 arg3, f32 arg4)
left << 2, top << 2, viewleft, viewtop,
right << 2, bottom << 2, viewleft + viewwidth, viewtop + viewheight,
0, videoGetNativeWidth(), videoGetNativeHeight());
g_BlurFbCapTimer = 0;
#endif
return gdl;
+3
View File
@@ -139,6 +139,9 @@ void texReset(void)
// get backend texture settings
g_TexFilter2D = videoGetTextureFilter2D() ? G_TF_BILERP : G_TF_POINT;
// notify blur code that the blur framebuffer is probably full of garbage
g_BlurFbDirty = true;
#endif
g_TexWords = mempAlloc(ALIGN16(g_TexNumConfigs * 4), MEMPOOL_STAGE);
+1
View File
@@ -545,6 +545,7 @@ extern u32 g_HudAlignModeR;
extern s32 g_PrevFrameFb;
extern s32 g_BlurFb;
extern s32 g_BlurFbCapTimer;
extern bool g_BlurFbDirty;
extern s32 g_TickRateDiv;
extern s32 g_MusicDisableMpDeath;