gpulib: add some missed sync and flush
authornotaz <notasas@gmail.com>
Mon, 4 Sep 2023 23:05:01 +0000 (02:05 +0300)
committernotaz <notasas@gmail.com>
Mon, 4 Sep 2023 23:12:44 +0000 (02:12 +0300)
notaz/pcsx_rearmed#303

plugins/gpu_neon/psx_gpu/psx_gpu.c
plugins/gpulib/gpu.c

index af24e77..a0bff3e 100644 (file)
@@ -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;
index 73abe8f..5f69c9d 100644 (file)
@@ -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: