From 81a5e971ef5a987bf957ba0ce541d1f1f49788ff Mon Sep 17 00:00:00 2001 From: fgsfds Date: Sat, 21 Oct 2023 14:24:36 +0200 Subject: [PATCH] port: finish drawing before copying the backbuffer --- port/fast3d/gfx_pc.cpp | 3 +++ src/game/bondview.c | 2 ++ src/include/gbiex.h | 3 +++ 3 files changed, 8 insertions(+) diff --git a/port/fast3d/gfx_pc.cpp b/port/fast3d/gfx_pc.cpp index 75efc026a..7ba7974a3 100644 --- a/port/fast3d/gfx_pc.cpp +++ b/port/fast3d/gfx_pc.cpp @@ -2652,6 +2652,9 @@ static void gfx_run_dl(Gfx* cmd) { // TODO: skyRender uses these to render some types of skies and skybox water // by issuing low-level ucode commands G_TRI_FILL and G_TRI_SHADE_TXTR break; + case G_RDPFLUSH_EXT: + gfx_flush(); + break; case G_RDPPIPESYNC: case G_RDPFULLSYNC: case G_RDPLOADSYNC: diff --git a/src/game/bondview.c b/src/game/bondview.c index 03fc990a3..c5df9e3cd 100644 --- a/src/game/bondview.c +++ b/src/game/bondview.c @@ -715,6 +715,7 @@ Gfx *bviewDrawFisheye(Gfx *gdl, u32 colour, u32 alpha, s32 shuttertime60, s8 sta #ifndef PLATFORM_N64 // make a copy of the current back buffer contents that we will be using as a texture + gDPFlushEXT(gdl++); gDPCopyFramebufferEXT(gdl++, g_PrevFrameFb, 0, 0, 0, G_ON); gDPSetFramebufferTextureEXT(gdl++, 0, 0, 0, g_PrevFrameFb); #endif @@ -2659,6 +2660,7 @@ Gfx *bviewDrawHorizonScanner(Gfx *gdl) return gdl; } // make a copy of what we have drawn so far and use it as a texture + gDPFlushEXT(gdl++); gDPCopyFramebufferEXT(gdl++, g_PrevFrameFb, 0, 0, 0, G_ON); gDPSetFramebufferTextureEXT(gdl++, 0, 0, 0, g_PrevFrameFb); #endif diff --git a/src/include/gbiex.h b/src/include/gbiex.h index 83575cdc6..ee0e02229 100644 --- a/src/include/gbiex.h +++ b/src/include/gbiex.h @@ -194,6 +194,7 @@ #define G_SETINTENSITY_EXT 0x40 #define G_COPYFB_EXT 0x41 #define G_IMAGERECT_EXT 0x42 +#define G_RDPFLUSH_EXT 0x43 /* G_EXTRAGEOMETRYMODE flags */ @@ -292,6 +293,8 @@ #define gSPTextureRectangleEXT(p, xl, yl, xh, yh, tile, s, t, ds, dt) gSPTextureRectangleWideEXT(p, xl, yl, xh, yh, tile, s, t, ds, dt, G_OFF) #define gSPTextureRectangleFlipEXT(p, xl, yl, xh, yh, tile, s, t, ds, dt) gSPTextureRectangleWideEXT(p, xl, yl, xh, yh, tile, s, t, ds, dt, G_ON) +#define gDPFlushEXT(pkt) gDPNoParam(pkt, G_RDPFLUSH_EXT) + #undef gDPFillRectangleScaled #define gDPFillRectangleScaled(pkt, x1, y1, x2, y2) gDPFillRectangleEXT(pkt, (x1) * g_ScaleX, y1, (x2) * g_ScaleX, y2)