aboutsummaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
authorAutechre2020-10-23 05:06:26 +0200
committerGitHub2020-10-23 05:06:26 +0200
commitaccedc82b01fe5834a805a9872405d51de1d5c06 (patch)
tree8e489b86af71d3b081c125d5eb234b0fd6b68f17 /frontend
parente592293a48af1d63b6973135fcd2677e5e04e17e (diff)
parentc765eb86debdc06fe304511bc2edbb6f3e3d7813 (diff)
downloadpcsx_rearmed-accedc82b01fe5834a805a9872405d51de1d5c06.tar.gz
pcsx_rearmed-accedc82b01fe5834a805a9872405d51de1d5c06.tar.bz2
pcsx_rearmed-accedc82b01fe5834a805a9872405d51de1d5c06.zip
Merge pull request #462 from justinweiss/threaded-rendering
Add a threaded renderer
Diffstat (limited to 'frontend')
-rw-r--r--frontend/libretro.c17
-rw-r--r--frontend/libretro_core_options.h14
-rw-r--r--frontend/main.c2
-rw-r--r--frontend/menu.c1
-rw-r--r--frontend/plugin_lib.h5
5 files changed, 38 insertions, 1 deletions
diff --git a/frontend/libretro.c b/frontend/libretro.c
index 93bfc28..323932a 100644
--- a/frontend/libretro.c
+++ b/frontend/libretro.c
@@ -1818,6 +1818,21 @@ static void update_variables(bool in_flight)
Config.SpuIrq = 1;
}
+#ifdef THREAD_RENDERING
+ var.key = "pcsx_rearmed_gpu_thread_rendering";
+ var.value = NULL;
+
+ if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
+ {
+ if (strcmp(var.value, "disabled") == 0)
+ pl_rearmed_cbs.thread_rendering = THREAD_RENDERING_OFF;
+ else if (strcmp(var.value, "sync") == 0)
+ pl_rearmed_cbs.thread_rendering = THREAD_RENDERING_SYNC;
+ else if (strcmp(var.value, "async") == 0)
+ pl_rearmed_cbs.thread_rendering = THREAD_RENDERING_ASYNC;
+ }
+#endif
+
#ifdef GPU_PEOPS
var.value = NULL;
var.key = "pcsx_rearmed_gpu_peops_odd_even_bit";
@@ -2031,7 +2046,7 @@ static void update_variables(bool in_flight)
"pcsx_rearmed_gpu_unai_fast_lighting",
"pcsx_rearmed_gpu_unai_ilace_force",
"pcsx_rearmed_gpu_unai_pixel_skip",
- "pcsx_rearmed_gpu_unai_scale_hires"
+ "pcsx_rearmed_gpu_unai_scale_hires",
};
option_display.visible = show_advanced_gpu_unai_settings;
diff --git a/frontend/libretro_core_options.h b/frontend/libretro_core_options.h
index 941bd81..1075e8f 100644
--- a/frontend/libretro_core_options.h
+++ b/frontend/libretro_core_options.h
@@ -972,6 +972,20 @@ struct retro_core_option_definition option_defs_us[] = {
},
"disabled",
},
+#ifdef THREAD_RENDERING
+ {
+ "pcsx_rearmed_gpu_thread_rendering",
+ "Threaded Rendering",
+ "When enabled, runs GPU commands in a thread. Sync waits for drawing to finish before vsync. Async will not wait unless there's another frame behind it.",
+ {
+ { "disabled", NULL },
+ { "sync", NULL },
+ { "async", NULL },
+ { NULL, NULL},
+ },
+ "disabled",
+ },
+#endif
#endif /* GPU UNAI Advanced Settings */
{
diff --git a/frontend/main.c b/frontend/main.c
index 51cb7bf..d3c7d40 100644
--- a/frontend/main.c
+++ b/frontend/main.c
@@ -125,6 +125,8 @@ void emu_set_default_config(void)
Config.SpuIrq = Config.RCntFix = Config.VSyncWA = 0;
Config.PsxAuto = 1;
+ pl_rearmed_cbs.thread_rendering = 0;
+
pl_rearmed_cbs.gpu_neon.allow_interlace = 2; // auto
pl_rearmed_cbs.gpu_neon.enhancement_enable =
pl_rearmed_cbs.gpu_neon.enhancement_no_main = 0;
diff --git a/frontend/menu.c b/frontend/menu.c
index e5c2738..bd56cf4 100644
--- a/frontend/menu.c
+++ b/frontend/menu.c
@@ -420,6 +420,7 @@ static const struct {
CE_INTVAL_N("adev0_is_nublike", in_adev_is_nublike[0]),
CE_INTVAL_N("adev1_is_nublike", in_adev_is_nublike[1]),
CE_INTVAL_V(frameskip, 3),
+ CE_INTVAL_P(thread_rendering),
CE_INTVAL_P(gpu_peops.iUseDither),
CE_INTVAL_P(gpu_peops.dwActFixes),
CE_INTVAL_P(gpu_unai.ilace_force),
diff --git a/frontend/plugin_lib.h b/frontend/plugin_lib.h
index 114aaad..71dfcb5 100644
--- a/frontend/plugin_lib.h
+++ b/frontend/plugin_lib.h
@@ -1,6 +1,10 @@
#ifndef __PLUGIN_LIB_H__
#define __PLUGIN_LIB_H__
+#define THREAD_RENDERING_OFF 0
+#define THREAD_RENDERING_SYNC 1
+#define THREAD_RENDERING_ASYNC 2
+
enum {
DKEY_SELECT = 0,
DKEY_L3,
@@ -70,6 +74,7 @@ struct rearmed_cbs {
unsigned int *gpu_hcnt;
unsigned int flip_cnt; // increment manually if not using pl_vout_flip
unsigned int only_16bpp; // platform is 16bpp-only
+ unsigned int thread_rendering;
struct {
int allow_interlace; // 0 off, 1 on, 2 guess
int enhancement_enable;