From 1fce6ce87dcd15107e3aa26b767395dbb6eafe6c Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 8 Feb 2020 22:19:13 +0100 Subject: [PATCH] Start getting NEON GPU to work on non-Arm --- Makefile | 7 ++- plugins/gpu_neon/psx_gpu/psx_gpu_parse.c | 67 +++++++++++++++++++++++- plugins/gpu_neon/psx_gpu_if.c | 5 ++ 3 files changed, 77 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d7f734f9..5218efda 100644 --- a/Makefile +++ b/Makefile @@ -162,8 +162,13 @@ endif OBJS += plugins/gpulib/gpu.o plugins/gpulib/vout_pl.o ifeq "$(BUILTIN_GPU)" "neon" CFLAGS += -DGPU_NEON -OBJS += plugins/gpu_neon/psx_gpu_if.o plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.o +OBJS += plugins/gpu_neon/psx_gpu_if.o +ifeq "$(HAVE_NEON)" "1" +OBJS += plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.o plugins/gpu_neon/psx_gpu_if.o: CFLAGS += -DNEON_BUILD -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP +else +plugins/gpu_neon/psx_gpu_if.o: CFLAGS += -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP +endif plugins/gpu_neon/psx_gpu_if.o: plugins/gpu_neon/psx_gpu/*.c endif ifeq "$(BUILTIN_GPU)" "peops" diff --git a/plugins/gpu_neon/psx_gpu/psx_gpu_parse.c b/plugins/gpu_neon/psx_gpu/psx_gpu_parse.c index ffa9b9a0..87d8c38b 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 788e3b42..3f3805a9 100644 --- a/plugins/gpu_neon/psx_gpu_if.c +++ b/plugins/gpu_neon/psx_gpu_if.c @@ -9,7 +9,12 @@ */ #include + +#ifdef _WIN32 +#include +#else #include +#endif extern const unsigned char cmd_lengths[256]; #define command_lengths cmd_lengths -- 2.39.5