aboutsummaryrefslogtreecommitdiff
path: root/plugins/gpu_neon
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/gpu_neon')
-rw-r--r--plugins/gpu_neon/psx_gpu/psx_gpu.h1
-rw-r--r--plugins/gpu_neon/psx_gpu/psx_gpu_parse.c67
-rw-r--r--plugins/gpu_neon/psx_gpu_if.c19
3 files changed, 86 insertions, 1 deletions
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/psx_gpu_parse.c b/plugins/gpu_neon/psx_gpu/psx_gpu_parse.c
index ffa9b9a..87d8c38 100644
--- a/plugins/gpu_neon/psx_gpu/psx_gpu_parse.c
+++ b/plugins/gpu_neon/psx_gpu/psx_gpu_parse.c
@@ -868,7 +868,72 @@ extern void scale2x_tiles8(void *dst, const void *src, int w8, int h);
#ifndef NEON_BUILD
// TODO?
-void scale2x_tiles8(void *dst, const void *src, int w8, int h) {}
+void scale2x_tiles8(void *dst, const void *src, int w8, int h)
+{
+ uint16_t* d = (uint16_t*)dst;
+ const uint16_t* s = (const uint16_t*)src;
+
+ while ( h-- )
+ {
+ uint16_t* d_save = d;
+ const uint16_t* s_save = s;
+ int w = w8;
+
+ while ( w-- )
+ {
+ d[ 0 ] = *s;
+ d[ 1 ] = *s;
+ d[ 1024 ] = *s;
+ d[ 1025 ] = *s;
+ d += 2; s++;
+
+ d[ 0 ] = *s;
+ d[ 1 ] = *s;
+ d[ 1024 ] = *s;
+ d[ 1025 ] = *s;
+ d += 2; s++;
+
+ d[ 0 ] = *s;
+ d[ 1 ] = *s;
+ d[ 1024 ] = *s;
+ d[ 1025 ] = *s;
+ d += 2; s++;
+
+ d[ 0 ] = *s;
+ d[ 1 ] = *s;
+ d[ 1024 ] = *s;
+ d[ 1025 ] = *s;
+ d += 2; s++;
+
+ d[ 0 ] = *s;
+ d[ 1 ] = *s;
+ d[ 1024 ] = *s;
+ d[ 1025 ] = *s;
+ d += 2; s++;
+
+ d[ 0 ] = *s;
+ d[ 1 ] = *s;
+ d[ 1024 ] = *s;
+ d[ 1025 ] = *s;
+ d += 2; s++;
+
+ d[ 0 ] = *s;
+ d[ 1 ] = *s;
+ d[ 1024 ] = *s;
+ d[ 1025 ] = *s;
+ d += 2; s++;
+
+ d[ 0 ] = *s;
+ d[ 1 ] = *s;
+ d[ 1024 ] = *s;
+ d[ 1025 ] = *s;
+ d += 2; s++;
+ }
+
+ d = d_save + 2048;
+ s = s_save + 1024; /* or 512? */
+ }
+}
#endif
static int disable_main_render;
diff --git a/plugins/gpu_neon/psx_gpu_if.c b/plugins/gpu_neon/psx_gpu_if.c
index ad01761..3f3805a 100644
--- a/plugins/gpu_neon/psx_gpu_if.c
+++ b/plugins/gpu_neon/psx_gpu_if.c
@@ -9,7 +9,12 @@
*/
#include <stdio.h>
+
+#ifdef _WIN32
+#include <mman.h>
+#else
#include <sys/mman.h>
+#endif
extern const unsigned char cmd_lengths[256];
#define command_lengths cmd_lengths
@@ -184,4 +189,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);
+ }
+
}