Fixed NEON GPU plugin for PC by using stdint.h types - use
authortwinaphex <libretro@gmail.com>
Tue, 31 Dec 2013 03:55:09 +0000 (04:55 +0100)
committertwinaphex <libretro@gmail.com>
Tue, 31 Dec 2013 03:55:09 +0000 (04:55 +0100)
NEON GPU plugin for non-ARM targets now

Makefile
Makefile.libretro
frontend/libretro.c
plugins/gpu_neon/psx_gpu/common.h
plugins/gpu_neon/psx_gpu/psx_gpu.c
plugins/gpu_neon/psx_gpu_if.c

index cc19e77..6187958 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -107,9 +107,15 @@ endif
 # builtin gpu
 OBJS += plugins/gpulib/gpu.o plugins/gpulib/vout_pl.o
 ifeq "$(BUILTIN_GPU)" "neon"
-OBJS += plugins/gpu_neon/psx_gpu_if.o plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.o
+ifeq "$(HAVE_NEON)" "1"
 plugins/gpu_neon/psx_gpu_if.o: CFLAGS += -DNEON_BUILD -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP
 plugins/gpu_neon/psx_gpu_if.o: plugins/gpu_neon/psx_gpu/*.c
+OBJS += plugins/gpu_neon/psx_gpu_if.o plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.o
+else
+plugins/gpu_neon/psx_gpu_if.o: CFLAGS += -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP
+plugins/gpu_neon/psx_gpu_if.o: plugins/gpu_neon/psx_gpu/*.c
+OBJS += plugins/gpu_neon/psx_gpu_if.o
+endif
 endif
 ifeq "$(BUILTIN_GPU)" "peops"
 # note: code is not safe for strict-aliasing? (Castlevania problems)
index 8b4a61b..d9ab7a0 100644 (file)
@@ -25,10 +25,14 @@ ifeq ($(platform), unix)
    TARGET := $(TARGET_NAME)_libretro.so
    fpic := -fPIC
    SHARED := -shared -Wl,--version-script=libretro/link.T
+   BUILTIN_GPU = neon
+       CFLAGS += -DNEON_PC
 else ifeq ($(platform), osx)
    TARGET := $(TARGET_NAME)_libretro.dylib
    fpic := -fPIC
    SHARED := -dynamiclib
+   BUILTIN_GPU = neon
+       CFLAGS += -DNEON_PC
 else ifeq ($(platform), ios)
 ARCH := arm
    TARGET := $(TARGET_NAME)_libretro_ios.dylib
@@ -124,6 +128,8 @@ else
    LD_FLAGS := -fPIC
    SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=libretro/link.T
    CFLAGS += -D__WIN32__ -D__WIN32_LIBRETRO__
+   BUILTIN_GPU = neon
+       CFLAGS += -DNEON_PC
 endif
 
 CFLAGS += -fPIC
index 23eecf6..bce05e8 100644 (file)
@@ -246,7 +246,7 @@ void retro_set_environment(retro_environment_t cb)
 #ifndef DRC_DISABLE
       { "rearmed_drc", "Dynamic recompiler; enabled|disabled" },
 #endif
-#ifdef __ARM_NEON__
+#if defined(__ARM_NEON__) || defined(NEON_PC)
       { "neon_interlace_enable", "Enable interlacing mode(s); disabled|enabled" },
       { "neon_enhancement_enable", "Enhanced resolution (slow); disabled|enabled" },
       { "neon_enhancement_no_main", "Enhanced resolution speed hack; disabled|enabled" },
@@ -800,7 +800,7 @@ static void update_variables(bool in_flight)
          in_type1 = PSE_PAD_TYPE_ANALOGPAD;
    }
 
-#ifdef __ARM_NEON__
+#if defined(__ARM_NEON__) || defined(NEON_PC)
    var.value = "NULL";
    var.key = "neon_interlace_enable";
 
@@ -834,6 +834,7 @@ static void update_variables(bool in_flight)
          pl_rearmed_cbs.gpu_neon.enhancement_no_main = 1;
    }
 #endif
+
 #ifndef DRC_DISABLE
    var.value = NULL;
    var.key = "rearmed_drc";
index d5cf3e9..6c2a99b 100644 (file)
@@ -1,6 +1,18 @@
 #ifndef COMMON_H
 #define COMMON_H
 
+#include <stdint.h>
+
+#ifdef NEON_PC
+typedef int8_t s8;
+typedef uint8_t u8;
+typedef int16_t s16;
+typedef uint16_t u16;
+typedef int32_t s32;
+typedef uint32_t u32;
+typedef int64_t s64;
+typedef uint64_t u64;
+#else
 typedef signed char s8;
 typedef unsigned char u8;
 typedef signed short s16;
@@ -9,8 +21,8 @@ typedef signed int s32;
 typedef unsigned int u32;
 typedef signed long long int s64;
 typedef unsigned long long int u64;
+#endif
 
-#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/time.h>
index e113f06..24f663b 100644 (file)
@@ -4130,7 +4130,11 @@ void setup_sprite_untextured_simple(psx_gpu_struct *psx_gpu, s32 x, s32 y,
     num_width = width;
 
     vram_ptr = (void *)vram_ptr16;
+#ifdef NEON_PC
+    if((int32_t)vram_ptr16 & 2)
+#else
     if((long)vram_ptr16 & 2)
+#endif
     {
       *vram_ptr16 = color_32bpp;
       vram_ptr = (void *)(vram_ptr16 + 1);
index ad01761..86103f3 100644 (file)
@@ -8,7 +8,7 @@
  * See the COPYING file in the top-level directory.
  */
 
-#include <stdio.h>
+#include <stdint.h>
 #include <sys/mman.h>
 
 extern const unsigned char cmd_lengths[256];