aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpjft2017-05-06 21:51:55 +0100
committerpjft2017-05-06 21:51:55 +0100
commit5c1cbedc034c59caba3955c663868c74e9631731 (patch)
treebcd4c60d4987b6172565d848c45a8554bba3be97
parent70fb8fe72ff0ff6356e78be861355075bf8fb4fe (diff)
downloadpcsx_rearmed-5c1cbedc034c59caba3955c663868c74e9631731.tar.gz
pcsx_rearmed-5c1cbedc034c59caba3955c663868c74e9631731.tar.bz2
pcsx_rearmed-5c1cbedc034c59caba3955c663868c74e9631731.zip
Adding enable/disable dithering core option with support for Neon GPU
-rw-r--r--frontend/libretro.c22
-rw-r--r--frontend/plugin_lib.h1
-rw-r--r--plugins/gpu_neon/psx_gpu/psx_gpu.h1
-rw-r--r--plugins/gpu_neon/psx_gpu_if.c14
-rw-r--r--plugins/gpulib/gpu.c1
-rw-r--r--plugins/gpulib/gpu.h1
6 files changed, 40 insertions, 0 deletions
diff --git a/frontend/libretro.c b/frontend/libretro.c
index c078494..3013a7f 100644
--- a/frontend/libretro.c
+++ b/frontend/libretro.c
@@ -456,6 +456,7 @@ void retro_set_environment(retro_environment_t cb)
{ "pcsx_rearmed_multitap1", "Multitap 1; auto|disabled|enabled" },
{ "pcsx_rearmed_multitap2", "Multitap 2; auto|disabled|enabled" },
{ "pcsx_rearmed_vibration", "Enable Vibration; enabled|disabled" },
+ { "pcsx_rearmed_dithering", "Enable Dithering; enabled|disabled" },
#ifndef DRC_DISABLE
{ "pcsx_rearmed_drc", "Dynamic recompiler; enabled|disabled" },
#endif
@@ -1376,6 +1377,27 @@ static void update_variables(bool in_flight)
in_enable_vibration = 1;
}
+ var.value = NULL;
+ var.key = "pcsx_rearmed_dithering";
+
+ if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) || var.value)
+ {
+ if (strcmp(var.value, "disabled") == 0) {
+ pl_rearmed_cbs.gpu_peops.iUseDither = 0;
+ pl_rearmed_cbs.gpu_peopsgl.bDrawDither = 0;
+#ifdef __ARM_NEON__
+ pl_rearmed_cbs.gpu_neon.allow_dithering = 0;
+#endif
+ }
+ else if (strcmp(var.value, "enabled") == 0) {
+ pl_rearmed_cbs.gpu_peops.iUseDither = 1;
+ pl_rearmed_cbs.gpu_peopsgl.bDrawDither = 1;
+#ifdef __ARM_NEON__
+ pl_rearmed_cbs.gpu_neon.allow_dithering = 1;
+#endif
+ }
+ }
+
#ifdef __ARM_NEON__
var.value = "NULL";
var.key = "pcsx_rearmed_neon_interlace_enable";
diff --git a/frontend/plugin_lib.h b/frontend/plugin_lib.h
index 83b2774..92e62e9 100644
--- a/frontend/plugin_lib.h
+++ b/frontend/plugin_lib.h
@@ -71,6 +71,7 @@ struct rearmed_cbs {
int allow_interlace; // 0 off, 1 on, 2 guess
int enhancement_enable;
int enhancement_no_main;
+ int allow_dithering;
} gpu_neon;
struct {
int iUseDither;
diff --git a/plugins/gpu_neon/psx_gpu/psx_gpu.h b/plugins/gpu_neon/psx_gpu/psx_gpu.h
index 1eaa99a..1fa6b98 100644
--- a/plugins/gpu_neon/psx_gpu/psx_gpu.h
+++ b/plugins/gpu_neon/psx_gpu/psx_gpu.h
@@ -207,6 +207,7 @@ typedef struct
u8 texture_4bpp_cache[32][256 * 256];
u8 texture_8bpp_even_cache[16][256 * 256];
u8 texture_8bpp_odd_cache[16][256 * 256];
+ int use_dithering;
} psx_gpu_struct;
typedef struct __attribute__((aligned(16)))
diff --git a/plugins/gpu_neon/psx_gpu_if.c b/plugins/gpu_neon/psx_gpu_if.c
index ad01761..788e3b4 100644
--- a/plugins/gpu_neon/psx_gpu_if.c
+++ b/plugins/gpu_neon/psx_gpu_if.c
@@ -184,4 +184,18 @@ void renderer_set_config(const struct rearmed_cbs *cbs)
map_enhancement_buffer();
if (cbs->pl_set_gpu_caps)
cbs->pl_set_gpu_caps(GPU_CAP_SUPPORTS_2X);
+
+ egpu.use_dithering = cbs->gpu_neon.allow_dithering;
+ if(!egpu.use_dithering) {
+ egpu.dither_table[0] = dither_table_row(0, 0, 0, 0);
+ egpu.dither_table[1] = dither_table_row(0, 0, 0, 0);
+ egpu.dither_table[2] = dither_table_row(0, 0, 0, 0);
+ egpu.dither_table[3] = dither_table_row(0, 0, 0, 0);
+ } else {
+ egpu.dither_table[0] = dither_table_row(-4, 0, -3, 1);
+ egpu.dither_table[1] = dither_table_row(2, -2, 3, -1);
+ egpu.dither_table[2] = dither_table_row(-3, 1, -4, 0);
+ egpu.dither_table[3] = dither_table_row(3, -1, 2, -2);
+ }
+
}
diff --git a/plugins/gpulib/gpu.c b/plugins/gpulib/gpu.c
index 125bd89..9fc5f43 100644
--- a/plugins/gpulib/gpu.c
+++ b/plugins/gpulib/gpu.c
@@ -726,6 +726,7 @@ void GPUrearmedCallbacks(const struct rearmed_cbs *cbs)
gpu.state.allow_interlace = cbs->gpu_neon.allow_interlace;
gpu.state.enhancement_enable = cbs->gpu_neon.enhancement_enable;
+ gpu.useDithering = cbs->gpu_neon.allow_dithering;
gpu.mmap = cbs->mmap;
gpu.munmap = cbs->munmap;
diff --git a/plugins/gpulib/gpu.h b/plugins/gpulib/gpu.h
index d11f991..7e1d18b 100644
--- a/plugins/gpulib/gpu.h
+++ b/plugins/gpulib/gpu.h
@@ -88,6 +88,7 @@ struct psx_gpu {
uint32_t last_flip_frame;
uint32_t pending_fill[3];
} frameskip;
+ int useDithering:1; /* 0 - off , 1 - on */
uint16_t *(*get_enhancement_bufer)
(int *x, int *y, int *w, int *h, int *vram_h);
void *(*mmap)(unsigned int size);