From 01ff31050057fe9f07c6e3336831cdfbb52fa780 Mon Sep 17 00:00:00 2001 From: notaz Date: Tue, 5 Sep 2023 02:05:01 +0300 Subject: [PATCH] gpulib: add some missed sync and flush notaz/pcsx_rearmed#303 --- plugins/gpu_neon/psx_gpu/psx_gpu.c | 2 ++ plugins/gpulib/gpu.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/plugins/gpu_neon/psx_gpu/psx_gpu.c b/plugins/gpu_neon/psx_gpu/psx_gpu.c index af24e770..a0bff3e9 100644 --- a/plugins/gpu_neon/psx_gpu/psx_gpu.c +++ b/plugins/gpu_neon/psx_gpu/psx_gpu.c @@ -4975,6 +4975,8 @@ void initialize_psx_gpu(psx_gpu_struct *psx_gpu, u16 *vram) psx_gpu->texture_page_ptr = psx_gpu->vram_ptr; psx_gpu->clut_ptr = psx_gpu->vram_ptr; + psx_gpu->viewport_start_x = psx_gpu->viewport_start_y = 0; + psx_gpu->viewport_end_x = psx_gpu->viewport_end_y = 0; psx_gpu->mask_msb = 0; psx_gpu->texture_window_x = 0; diff --git a/plugins/gpulib/gpu.c b/plugins/gpulib/gpu.c index 73abe8f5..5f69c9d2 100644 --- a/plugins/gpulib/gpu.c +++ b/plugins/gpulib/gpu.c @@ -62,6 +62,7 @@ static noinline void do_reset(void) gpu.screen.hres = gpu.screen.w = 256; gpu.screen.vres = gpu.screen.h = 240; gpu.screen.x = gpu.screen.y = 0; + renderer_sync_ecmds(gpu.ex_regs); renderer_notify_res_change(); } @@ -187,8 +188,12 @@ static noinline int decide_frameskip_allow(uint32_t cmd_e3) return gpu.frameskip.allow; } +static void flush_cmd_buffer(void); + static noinline void get_gpu_info(uint32_t data) { + if (unlikely(gpu.cmd_len > 0)) + flush_cmd_buffer(); switch (data & 0x0f) { case 0x02: case 0x03: -- 2.39.5