From: notaz Date: Sat, 26 Oct 2024 22:32:40 +0000 (+0300) Subject: merge gpu_unai with gpu_unai_old X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ddc3a7a2e0bcfd9e587a895468635bce598228b;p=pcsx_rearmed.git merge gpu_unai with gpu_unai_old Can now switch between them during gameplay. Specify GPU_UNAI_NO_OLD=1 to prevent compiling this in to save memory or whatever. No big endian support. --- diff --git a/Makefile b/Makefile index 9cc6088f..d2977913 100644 --- a/Makefile +++ b/Makefile @@ -227,21 +227,24 @@ plugins/dfxvideo/gpulib_if.o: CFLAGS += -fno-strict-aliasing plugins/dfxvideo/gpulib_if.o: plugins/dfxvideo/prim.c plugins/dfxvideo/soft.c OBJS += plugins/dfxvideo/gpulib_if.o endif -ifeq "$(BUILTIN_GPU)" "unai_old" -OBJS += plugins/gpu_unai_old/gpulib_if.o -ifeq "$(ARCH)" "arm" -OBJS += plugins/gpu_unai_old/gpu_arm.o -endif -plugins/gpu_unai_old/gpulib_if.o: CFLAGS += -DREARMED -O3 -CC_LINK = $(CXX) -endif ifeq "$(BUILTIN_GPU)" "unai" OBJS += plugins/gpu_unai/gpulib_if.o ifeq "$(ARCH)" "arm" OBJS += plugins/gpu_unai/gpu_arm.o endif -plugins/gpu_unai/gpulib_if.o: CFLAGS += -DREARMED -DUSE_GPULIB=1 -O3 +ifeq "$(THREAD_RENDERING)" "1" +CFLAGS += -DTHREAD_RENDERING +OBJS += plugins/gpulib/gpulib_thread_if.o +endif +ifneq "$(GPU_UNAI_NO_OLD)" "1" +OBJS += plugins/gpu_unai/old/if.o +else +CFLAGS += -DGPU_UNAI_NO_OLD +endif +plugins/gpu_unai/gpulib_if.o: CFLAGS += -DREARMED -DUSE_GPULIB=1 +plugins/gpu_unai/gpulib_if.o \ +plugins/gpu_unai/old/if.o: CFLAGS += -O3 CC_LINK = $(CXX) endif diff --git a/configure b/configure index 0d315b68..3bc436e5 100755 --- a/configure +++ b/configure @@ -39,13 +39,13 @@ check_define_val() platform_list="generic pandora maemo caanoo" platform="generic" -builtin_gpu_list="neon peops unai unai_old" +builtin_gpu_list="neon peops unai" dynarec_list="ari64 lightrec none" builtin_gpu="" sound_driver_list="oss alsa pulseaudio sdl" sound_drivers="" plugins="plugins/spunull/spunull.so \ -plugins/dfxvideo/gpu_peops.so plugins/gpu_unai_old/gpu_unai_old.so plugins/gpu_unai/gpu_unai.so" +plugins/dfxvideo/gpu_peops.so plugins/gpu_unai/gpu_unai.so" drc_cache_base="no" have_armv5="" have_armv6="" @@ -263,7 +263,7 @@ arm*) builtin_gpu="neon" elif [ "$have_armv7" != "yes" ]; then # pre-ARMv7 hardware is usually not fast enough for peops - builtin_gpu="unai_old" + builtin_gpu="unai" else builtin_gpu="peops" fi diff --git a/frontend/libretro.c b/frontend/libretro.c index 3edcc2c9..68ec65ff 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -2641,6 +2641,17 @@ static void update_variables(bool in_flight) * pcsx_rearmed_gpu_unai_scale_hires */ pl_rearmed_cbs.gpu_unai.pixel_skip = 0; + var.key = "pcsx_rearmed_gpu_unai_old_renderer"; + var.value = NULL; + + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + if (strcmp(var.value, "enabled") == 0) + pl_rearmed_cbs.gpu_unai.old_renderer = 1; + else + pl_rearmed_cbs.gpu_unai.old_renderer = 0; + } + var.key = "pcsx_rearmed_gpu_unai_lighting"; var.value = NULL; diff --git a/frontend/libretro_core_options.h b/frontend/libretro_core_options.h index 7fe90812..ed2f41c3 100644 --- a/frontend/libretro_core_options.h +++ b/frontend/libretro_core_options.h @@ -726,6 +726,22 @@ struct retro_core_option_v2_definition option_defs_us[] = { }, "disabled", }, +#ifndef GPU_UNAI_NO_OLD + { + "pcsx_rearmed_gpu_unai_old_renderer", + "(GPU) Old renderer", + "Old renderer", + "This enables faster, but less accurate code.", + NULL, + "gpu_unai", + { + { "disabled", NULL }, + { "enabled", NULL }, + { NULL, NULL}, + }, + "disabled", + }, +#endif { "pcsx_rearmed_gpu_unai_blending", "(GPU) Texture Blending", diff --git a/frontend/main.c b/frontend/main.c index 963f6c81..abf97e69 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -136,15 +136,13 @@ void emu_set_default_config(void) pl_rearmed_cbs.gpu_neon.enhancement_tex_adj = 1; pl_rearmed_cbs.gpu_peops.iUseDither = 0; pl_rearmed_cbs.gpu_peops.dwActFixes = 1<<7; + pl_rearmed_cbs.gpu_unai.old_renderer = 0; pl_rearmed_cbs.gpu_unai.ilace_force = 0; pl_rearmed_cbs.gpu_unai.pixel_skip = 0; pl_rearmed_cbs.gpu_unai.lighting = 1; pl_rearmed_cbs.gpu_unai.fast_lighting = 0; pl_rearmed_cbs.gpu_unai.blending = 1; pl_rearmed_cbs.gpu_unai.dithering = 0; - pl_rearmed_cbs.gpu_unai_old.abe_hack = - pl_rearmed_cbs.gpu_unai_old.no_light = - pl_rearmed_cbs.gpu_unai_old.no_blend = 0; memset(&pl_rearmed_cbs.gpu_peopsgl, 0, sizeof(pl_rearmed_cbs.gpu_peopsgl)); pl_rearmed_cbs.gpu_peopsgl.iVRamSize = 64; pl_rearmed_cbs.gpu_peopsgl.iTexGarbageCollection = 1; diff --git a/frontend/menu.c b/frontend/menu.c index 95d4edf6..532ab714 100644 --- a/frontend/menu.c +++ b/frontend/menu.c @@ -443,10 +443,7 @@ static const struct { CE_INTVAL_V(frameskip, 4), CE_INTVAL_P(gpu_peops.iUseDither), CE_INTVAL_P(gpu_peops.dwActFixes), - CE_INTVAL_P(gpu_unai_old.lineskip), - CE_INTVAL_P(gpu_unai_old.abe_hack), - CE_INTVAL_P(gpu_unai_old.no_light), - CE_INTVAL_P(gpu_unai_old.no_blend), + CE_INTVAL_P(gpu_unai.old_renderer), CE_INTVAL_P(gpu_unai.ilace_force), CE_INTVAL_P(gpu_unai.pixel_skip), CE_INTVAL_P(gpu_unai.lighting), @@ -1444,24 +1441,9 @@ static int menu_loop_plugin_gpu_neon(int id, int keys) #endif -static menu_entry e_menu_plugin_gpu_unai_old[] = -{ - mee_onoff ("Skip every 2nd line", 0, pl_rearmed_cbs.gpu_unai_old.lineskip, 1), - mee_onoff ("Abe's Odyssey hack", 0, pl_rearmed_cbs.gpu_unai_old.abe_hack, 1), - mee_onoff ("Disable lighting", 0, pl_rearmed_cbs.gpu_unai_old.no_light, 1), - mee_onoff ("Disable blending", 0, pl_rearmed_cbs.gpu_unai_old.no_blend, 1), - mee_end, -}; - -static int menu_loop_plugin_gpu_unai_old(int id, int keys) -{ - int sel = 0; - me_loop(e_menu_plugin_gpu_unai_old, &sel); - return 0; -} - static menu_entry e_menu_plugin_gpu_unai[] = { + mee_onoff ("Old renderer", 0, pl_rearmed_cbs.gpu_unai.old_renderer, 1), mee_onoff ("Interlace", 0, pl_rearmed_cbs.gpu_unai.ilace_force, 1), mee_onoff ("Dithering", 0, pl_rearmed_cbs.gpu_unai.dithering, 1), mee_onoff ("Lighting", 0, pl_rearmed_cbs.gpu_unai.lighting, 1), @@ -1579,15 +1561,13 @@ static const char h_plugin_gpu[] = "builtin_gpu is the NEON GPU, very fast and accurate\n" #endif "gpu_peops is Pete's soft GPU, slow but accurate\n" - "gpu_unai_old is from old PCSX4ALL, fast but glitchy\n" - "gpu_unai is newer, more accurate but slower\n" + "gpu_unai is the GPU renderer from PCSX4ALL\n" "gpu_gles Pete's hw GPU, uses 3D chip but is glitchy\n" "must save config and reload the game if changed"; static const char h_plugin_spu[] = "spunull effectively disables sound\n" "must save config and reload the game if changed"; static const char h_gpu_peops[] = "Configure P.E.Op.S. SoftGL Driver V1.17"; static const char h_gpu_peopsgl[]= "Configure P.E.Op.S. MesaGL Driver V1.78"; -static const char h_gpu_unai_old[] = "Configure Unai/PCSX4ALL Team GPU plugin (old)"; static const char h_gpu_unai[] = "Configure Unai/PCSX4ALL Team plugin (new)"; static const char h_spu[] = "Configure built-in P.E.Op.S. Sound Driver V1.7"; @@ -1600,7 +1580,6 @@ static menu_entry e_menu_plugin_options[] = mee_handler_h ("Configure built-in GPU plugin", menu_loop_plugin_gpu_neon, h_gpu_neon), #endif mee_handler_h ("Configure gpu_peops plugin", menu_loop_plugin_gpu_peops, h_gpu_peops), - mee_handler_h ("Configure gpu_unai_old GPU plugin", menu_loop_plugin_gpu_unai_old, h_gpu_unai_old), mee_handler_h ("Configure gpu_unai GPU plugin", menu_loop_plugin_gpu_unai, h_gpu_unai), mee_handler_h ("Configure gpu_gles GPU plugin", menu_loop_plugin_gpu_peopsgl, h_gpu_peopsgl), mee_handler_h ("Configure built-in SPU plugin", menu_loop_plugin_spu, h_spu), diff --git a/frontend/plugin_lib.h b/frontend/plugin_lib.h index c7ca247e..b2ba69af 100644 --- a/frontend/plugin_lib.h +++ b/frontend/plugin_lib.h @@ -94,11 +94,7 @@ struct rearmed_cbs { int dwFrameRateTicks; } gpu_peops; struct { - int abe_hack; - int no_light, no_blend; - int lineskip; - } gpu_unai_old; - struct { + int old_renderer; int ilace_force; int pixel_skip; int lighting; diff --git a/plugins/gpu_unai/Makefile b/plugins/gpu_unai/Makefile index 756d19aa..8fe90cb5 100644 --- a/plugins/gpu_unai/Makefile +++ b/plugins/gpu_unai/Makefile @@ -8,7 +8,7 @@ CFLAGS += -DUSE_GPULIB=1 include ../../config.mak SRC_STANDALONE += gpu.cpp -SRC_GPULIB += gpulib_if.cpp +SRC_GPULIB += gpulib_if.cpp old/if.cpp ifeq "$(ARCH)" "arm" SRC += gpu_arm.S diff --git a/plugins/gpu_unai/gpu.h b/plugins/gpu_unai/gpu.h index f5eb69b4..17f80eb3 100644 --- a/plugins/gpu_unai/gpu.h +++ b/plugins/gpu_unai/gpu.h @@ -46,6 +46,7 @@ struct gpu_unai_config_t { uint8_t fast_lighting:1; uint8_t blending:1; uint8_t dithering:1; + uint8_t old_renderer:1; //senquack Only PCSX Rearmed's version of gpu_unai had this, and I // don't think it's necessary. It would require adding 'AH' flag to diff --git a/plugins/gpu_unai/gpu_fixedpoint.h b/plugins/gpu_unai/gpu_fixedpoint.h index 5df42cf0..f809905e 100644 --- a/plugins/gpu_unai/gpu_fixedpoint.h +++ b/plugins/gpu_unai/gpu_fixedpoint.h @@ -75,12 +75,14 @@ INLINE float FloatInv(const float x) /////////////////////////////////////////////////////////////////////////// // --- BEGIN INVERSE APPROXIMATION SECTION --- /////////////////////////////////////////////////////////////////////////// -#ifdef GPU_UNAI_USE_INT_DIV_MULTINV +#if defined(GPU_UNAI_USE_INT_DIV_MULTINV) || !defined(GPU_UNAI_NO_OLD) // big precision inverse table. #define TABLE_BITS 16 s32 s_invTable[(1< #include #include "../gpulib/gpu.h" +#include "old/if.h" #ifdef THREAD_RENDERING #include "../gpulib/gpulib_thread_if.h" @@ -68,6 +69,12 @@ ///////////////////////////////////////////////////////////////////////////// +#ifndef GPU_UNAI_NO_OLD +#define IS_OLD_RENDERER() gpu_unai.config.old_renderer +#else +#define IS_OLD_RENDERER() false +#endif + #define DOWNSCALE_VRAM_SIZE (1024 * 512 * 2 * 2 + 4096) INLINE void scale_640_to_320(le16_t *dest, const le16_t *src, bool isRGB24) { @@ -247,7 +254,7 @@ int renderer_init(void) //gpu_unai.config.enableAbbeyHack = gpu_unai_config_ext.abe_hack; gpu_unai.ilace_mask = gpu_unai.config.ilace_force; -#ifdef GPU_UNAI_USE_INT_DIV_MULTINV +#if defined(GPU_UNAI_USE_INT_DIV_MULTINV) || !defined(GPU_UNAI_NO_OLD) // s_invTable for(int i=1;i<=(1<gpu_unai.old_renderer; gpu_unai.config.ilace_force = cbs->gpu_unai.ilace_force; gpu_unai.config.pixel_skip = cbs->gpu_unai.pixel_skip; gpu_unai.config.lighting = cbs->gpu_unai.lighting; @@ -860,6 +875,7 @@ void renderer_set_config(const struct rearmed_cbs *cbs) } else { unmap_downscale_buffer(); } + oldunai_renderer_set_config(cbs); } void renderer_sync(void) diff --git a/plugins/gpu_unai_old/debug.h b/plugins/gpu_unai/old/debug.h similarity index 100% rename from plugins/gpu_unai_old/debug.h rename to plugins/gpu_unai/old/debug.h diff --git a/plugins/gpu_unai_old/gpu.cpp b/plugins/gpu_unai/old/gpu.cpp similarity index 100% rename from plugins/gpu_unai_old/gpu.cpp rename to plugins/gpu_unai/old/gpu.cpp diff --git a/plugins/gpu_unai_old/gpu.h b/plugins/gpu_unai/old/gpu.h similarity index 100% rename from plugins/gpu_unai_old/gpu.h rename to plugins/gpu_unai/old/gpu.h diff --git a/plugins/gpu_unai_old/gpu_arm.h b/plugins/gpu_unai/old/gpu_arm.h similarity index 100% rename from plugins/gpu_unai_old/gpu_arm.h rename to plugins/gpu_unai/old/gpu_arm.h diff --git a/plugins/gpu_unai_old/gpu_arm.s b/plugins/gpu_unai/old/gpu_arm.s similarity index 100% rename from plugins/gpu_unai_old/gpu_arm.s rename to plugins/gpu_unai/old/gpu_arm.s diff --git a/plugins/gpu_unai_old/gpu_blit.h b/plugins/gpu_unai/old/gpu_blit.h similarity index 100% rename from plugins/gpu_unai_old/gpu_blit.h rename to plugins/gpu_unai/old/gpu_blit.h diff --git a/plugins/gpu_unai_old/gpu_command.h b/plugins/gpu_unai/old/gpu_command.h similarity index 100% rename from plugins/gpu_unai_old/gpu_command.h rename to plugins/gpu_unai/old/gpu_command.h diff --git a/plugins/gpu_unai_old/gpu_fixedpoint.h b/plugins/gpu_unai/old/gpu_fixedpoint.h similarity index 99% rename from plugins/gpu_unai_old/gpu_fixedpoint.h rename to plugins/gpu_unai/old/gpu_fixedpoint.h index e72fda12..5dae806d 100644 --- a/plugins/gpu_unai_old/gpu_fixedpoint.h +++ b/plugins/gpu_unai/old/gpu_fixedpoint.h @@ -39,7 +39,7 @@ typedef s32 fixed; #define fixed_HALF ((fixed)((1<>1)) // big precision inverse table. -s32 s_invTable[(1<>FIXED_BITS); } diff --git a/plugins/gpu_unai_old/gpu_inner.h b/plugins/gpu_unai/old/gpu_inner.h similarity index 100% rename from plugins/gpu_unai_old/gpu_inner.h rename to plugins/gpu_unai/old/gpu_inner.h diff --git a/plugins/gpu_unai_old/gpu_inner_blend.h b/plugins/gpu_unai/old/gpu_inner_blend.h similarity index 100% rename from plugins/gpu_unai_old/gpu_inner_blend.h rename to plugins/gpu_unai/old/gpu_inner_blend.h diff --git a/plugins/gpu_unai_old/gpu_inner_light.h b/plugins/gpu_unai/old/gpu_inner_light.h similarity index 100% rename from plugins/gpu_unai_old/gpu_inner_light.h rename to plugins/gpu_unai/old/gpu_inner_light.h diff --git a/plugins/gpu_unai_old/gpu_raster_image.h b/plugins/gpu_unai/old/gpu_raster_image.h similarity index 100% rename from plugins/gpu_unai_old/gpu_raster_image.h rename to plugins/gpu_unai/old/gpu_raster_image.h diff --git a/plugins/gpu_unai_old/gpu_raster_line.h b/plugins/gpu_unai/old/gpu_raster_line.h similarity index 100% rename from plugins/gpu_unai_old/gpu_raster_line.h rename to plugins/gpu_unai/old/gpu_raster_line.h diff --git a/plugins/gpu_unai_old/gpu_raster_polygon.h b/plugins/gpu_unai/old/gpu_raster_polygon.h similarity index 100% rename from plugins/gpu_unai_old/gpu_raster_polygon.h rename to plugins/gpu_unai/old/gpu_raster_polygon.h diff --git a/plugins/gpu_unai_old/gpu_raster_sprite.h b/plugins/gpu_unai/old/gpu_raster_sprite.h similarity index 100% rename from plugins/gpu_unai_old/gpu_raster_sprite.h rename to plugins/gpu_unai/old/gpu_raster_sprite.h diff --git a/plugins/gpu_unai_old/gpulib_if.cpp b/plugins/gpu_unai/old/if.cpp similarity index 94% rename from plugins/gpu_unai_old/gpulib_if.cpp rename to plugins/gpu_unai/old/if.cpp index e0d2005f..8c67694e 100644 --- a/plugins/gpu_unai_old/gpulib_if.cpp +++ b/plugins/gpu_unai/old/if.cpp @@ -22,8 +22,9 @@ #include #include #include -#include "../gpulib/gpu.h" +#include "../../gpulib/gpu.h" #include "arm_features.h" +#include "if.h" #define u8 uint8_t #define s8 int8_t @@ -50,7 +51,8 @@ static bool blend = true; /* blending */ static bool FrameToRead = false; /* load image in progress */ static bool FrameToWrite = false; /* store image in progress */ -static bool enableAbbeyHack = false; /* Abe's Odyssey hack */ +//static bool enableAbbeyHack = false; /* Abe's Odyssey hack */ +#define enableAbbeyHack false static u8 BLEND_MODE; static u8 TEXT_MODE; @@ -136,10 +138,11 @@ static u32 GPU_GP1; ///////////////////////////////////////////////////////////////////////////// -int renderer_init(void) +void oldunai_renderer_init(void) { GPU_FrameBuffer = (u16 *)gpu.vram; +#if 0 // shared with "new" unai // s_invTable for(int i=1;i<=(1<gpu_unai_old.lineskip; - enableAbbeyHack = cbs->gpu_unai_old.abe_hack; - light = !cbs->gpu_unai_old.no_light; - blend = !cbs->gpu_unai_old.no_blend; + force_interlace = cbs->gpu_unai.ilace_force; + //enableAbbeyHack = cbs->gpu_unai_old.abe_hack; + light = cbs->gpu_unai.lighting; + blend = cbs->gpu_unai.blending; GPU_FrameBuffer = (u16 *)gpu.vram; } diff --git a/plugins/gpu_unai/old/if.h b/plugins/gpu_unai/old/if.h new file mode 100644 index 00000000..f7faaff0 --- /dev/null +++ b/plugins/gpu_unai/old/if.h @@ -0,0 +1,18 @@ +#ifndef GPU_UNAI_NO_OLD + +struct rearmed_cbs; + +void oldunai_renderer_init(void); +int oldunai_do_cmd_list(uint32_t *list, int list_len, + int *cycles_sum_out, int *cycles_last, int *last_cmd); +void oldunai_renderer_sync_ecmds(uint32_t *ecmds); +void oldunai_renderer_set_config(const struct rearmed_cbs *cbs); + +#else + +#define oldunai_renderer_init() +#define oldunai_do_cmd_list(...) 0 +#define oldunai_renderer_sync_ecmds(x) +#define oldunai_renderer_set_config(x) + +#endif diff --git a/plugins/gpu_unai_old/port.h b/plugins/gpu_unai/old/port.h similarity index 100% rename from plugins/gpu_unai_old/port.h rename to plugins/gpu_unai/old/port.h diff --git a/plugins/gpu_unai_old/profiler.h b/plugins/gpu_unai/old/profiler.h similarity index 100% rename from plugins/gpu_unai_old/profiler.h rename to plugins/gpu_unai/old/profiler.h diff --git a/plugins/gpu_unai_old/Makefile b/plugins/gpu_unai_old/Makefile deleted file mode 100644 index ed3eff0a..00000000 --- a/plugins/gpu_unai_old/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -CFLAGS += -ggdb -Wall -O3 -ffast-math -CFLAGS += -DREARMED -CFLAGS += -I../../include - -include ../../config.mak - -SRC_STANDALONE += gpu.cpp -SRC_GPULIB += gpulib_if.cpp - -ifeq "$(ARCH)" "arm" -SRC += gpu_arm.s -endif - -#BIN_STANDALONE = gpuPCSX4ALL.so -BIN_GPULIB = gpu_unai_old.so -include ../gpulib/gpulib.mak diff --git a/readme.txt b/readme.txt index 1f1f2d52..142ce08d 100644 --- a/readme.txt +++ b/readme.txt @@ -89,8 +89,6 @@ builtin_gpu - this is either Exophase's ARM NEON GPU (accurate and fast, gpu_peops or gpu_unai (depends on compile options). gpu_peops.so - P.E.Op.S. soft GPU, reasonably accurate but slow (also found with older emulators on PC) -gpu_unai_old.so- Unai's plugin from PCSX4ALL project. Faster than P.E.Op.S. - but has some glitches (old version). gpu_gles.so - experimental port of P.E.Op.S. MesaGL plugin to OpenGL ES. Occasionally faster but has lots of glitches and seems to be rather unstable (may crash the driver/system).