aboutsummaryrefslogtreecommitdiff
path: root/plugins/gpulib/gpu.c
diff options
context:
space:
mode:
authorJustin Weiss2020-09-13 20:06:57 -0700
committerJustin Weiss2020-10-22 18:07:00 -0700
commitc765eb86debdc06fe304511bc2edbb6f3e3d7813 (patch)
tree8e489b86af71d3b081c125d5eb234b0fd6b68f17 /plugins/gpulib/gpu.c
parente592293a48af1d63b6973135fcd2677e5e04e17e (diff)
downloadpcsx_rearmed-c765eb86debdc06fe304511bc2edbb6f3e3d7813.tar.gz
pcsx_rearmed-c765eb86debdc06fe304511bc2edbb6f3e3d7813.tar.bz2
pcsx_rearmed-c765eb86debdc06fe304511bc2edbb6f3e3d7813.zip
Add a threaded renderer
This change adds a gpulib implementation that accepts GPU commands and runs them through a real gpulib implementation on a thread. Depending on a setting, it can either force a sync every frame, or continue to work until the next frame arrives.
Diffstat (limited to 'plugins/gpulib/gpu.c')
-rw-r--r--plugins/gpulib/gpu.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/plugins/gpulib/gpu.c b/plugins/gpulib/gpu.c
index 007da65..ed37b71 100644
--- a/plugins/gpulib/gpu.c
+++ b/plugins/gpulib/gpu.c
@@ -40,6 +40,8 @@ static void finish_vram_transfer(int is_read);
static noinline void do_cmd_reset(void)
{
+ renderer_sync();
+
if (unlikely(gpu.cmd_len > 0))
do_cmd_buffer(gpu.cmd_buffer, gpu.cmd_len);
gpu.cmd_len = 0;
@@ -52,7 +54,6 @@ static noinline void do_cmd_reset(void)
static noinline void do_reset(void)
{
unsigned int i;
-
do_cmd_reset();
memset(gpu.regs, 0, sizeof(gpu.regs));
@@ -370,6 +371,8 @@ static int do_vram_io(uint32_t *data, int count, int is_read)
int l;
count *= 2; // operate in 16bpp pixels
+ renderer_sync();
+
if (gpu.dma.offset) {
l = w - gpu.dma.offset;
if (count < l)
@@ -714,12 +717,15 @@ long GPUfreeze(uint32_t type, struct GPUFreeze *freeze)
case 1: // save
if (gpu.cmd_len > 0)
flush_cmd_buffer();
+
+ renderer_sync();
memcpy(freeze->psxVRam, gpu.vram, 1024 * 512 * 2);
memcpy(freeze->ulControl, gpu.regs, sizeof(gpu.regs));
memcpy(freeze->ulControl + 0xe0, gpu.ex_regs, sizeof(gpu.ex_regs));
freeze->ulStatus = gpu.status.reg;
break;
case 0: // load
+ renderer_sync();
memcpy(gpu.vram, freeze->psxVRam, 1024 * 512 * 2);
memcpy(gpu.regs, freeze->ulControl, sizeof(gpu.regs));
memcpy(gpu.ex_regs, freeze->ulControl + 0xe0, sizeof(gpu.ex_regs));
@@ -752,6 +758,8 @@ void GPUupdateLace(void)
return;
}
+ renderer_notify_update_lace(0);
+
if (!gpu.state.fb_dirty)
return;
@@ -767,6 +775,7 @@ void GPUupdateLace(void)
vout_update();
gpu.state.fb_dirty = 0;
gpu.state.blanked = 0;
+ renderer_notify_update_lace(1);
}
void GPUvBlank(int is_vblank, int lcf)