mirror of
https://github.com/perfect-dark-pc-port/perfect_dark.git
synced 2026-10-24 00:02:43 +02:00
port: don't render garbage in the first blur frame (fixes #287)
This commit is contained in:
1 parent
f46359b307
commit
3118d01921
4 files changed
+25
-2
No files matched your search
@@ -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
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in new issue
Block a user