From 7321d49ca4f39688ea62cb0bc2e7b6db4991ccc9 Mon Sep 17 00:00:00 2001 From: David Guillen Fandos Date: Thu, 31 Aug 2023 00:26:42 +0200 Subject: [PATCH] Remove PSP special weirdness, has almost no perf impact. --- Makefile | 2 +- common.h | 5 +---- libretro/libretro.c | 37 ------------------------------------- mips/mips_emit.h | 8 +------- 4 files changed, 3 insertions(+), 49 deletions(-) diff --git a/Makefile b/Makefile index c284dee..098c159 100644 --- a/Makefile +++ b/Makefile @@ -219,7 +219,7 @@ else ifeq ($(platform), psp1) CC = psp-gcc$(EXE_EXT) CXX = psp-g++$(EXE_EXT) AR = psp-ar$(EXE_EXT) - CFLAGS += -DPSP -G0 -DUSE_BGR_FORMAT -DMIPS_HAS_R2_INSTS -DSMALL_TRANSLATION_CACHE + CFLAGS += -DPSP -G0 -DMIPS_HAS_R2_INSTS -DSMALL_TRANSLATION_CACHE CFLAGS += -I$(shell psp-config --pspsdk-path)/include CFLAGS += -march=allegrex -mfp32 -mgp32 -mlong32 -mabi=eabi CFLAGS += -fomit-frame-pointer -ffast-math diff --git a/common.h b/common.h index 2e95e93..3302522 100644 --- a/common.h +++ b/common.h @@ -78,10 +78,7 @@ typedef signed long long int s64; #endif -#ifdef USE_BGR_FORMAT - #define convert_palette(value) \ - (((value & 0x7FE0) << 1) | (value & 0x1F)) -#elif defined(USE_XBGR1555_FORMAT) +#if defined(USE_XBGR1555_FORMAT) #define convert_palette(value) \ (value & 0x7FFF) #else diff --git a/libretro/libretro.c b/libretro/libretro.c index 42c72c6..ec27bea 100644 --- a/libretro/libretro.c +++ b/libretro/libretro.c @@ -102,20 +102,6 @@ static void (*video_post_process)(void) = NULL; static bool post_process_cc = false; static bool post_process_mix = false; -#if defined(PSP) -static uint32_t next_pow2(uint32_t v) -{ - v--; - v |= v >> 1; - v |= v >> 2; - v |= v >> 4; - v |= v >> 8; - v |= v >> 16; - v++; - return v; -} -#endif - static void error_msg(const char* text) { if (log_cb) @@ -430,31 +416,8 @@ static void video_run(void) gba_screen_pixels_buf = gba_processed_pixels; } -#if defined(PSP) - static unsigned int __attribute__((aligned(16))) d_list[32]; - void* texture_vram_p = NULL; - int texture_size = (GBA_SCREEN_WIDTH*GBA_SCREEN_HEIGHT*2); - - texture_vram_p = (void*) (0x44200000 - texture_size); /* max VRAM address - frame size */ - - sceKernelDcacheWritebackRange(gba_screen_pixels_buf, texture_size); - - sceGuStart(GU_DIRECT, d_list); - sceGuTexMode(GU_PSM_5650, 0, 0, GU_FALSE); - sceGuCopyImage(GU_PSM_5650, 0, 0, GBA_SCREEN_WIDTH, GBA_SCREEN_HEIGHT, GBA_SCREEN_WIDTH, - gba_screen_pixels_buf, 0, 0, GBA_SCREEN_WIDTH, texture_vram_p); - sceGuTexImage(0, next_pow2(GBA_SCREEN_WIDTH), next_pow2(GBA_SCREEN_HEIGHT), GBA_SCREEN_WIDTH, texture_vram_p); - sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGB); - sceGuDisable(GU_BLEND); - - sceGuFinish(); - - video_cb(texture_vram_p, GBA_SCREEN_WIDTH, GBA_SCREEN_HEIGHT, - GBA_SCREEN_PITCH * 2); -#else video_cb(gba_screen_pixels_buf, GBA_SCREEN_WIDTH, GBA_SCREEN_HEIGHT, GBA_SCREEN_PITCH * 2); -#endif } #ifdef PERF_TEST diff --git a/mips/mips_emit.h b/mips/mips_emit.h index 2f625e0..6a4448d 100644 --- a/mips/mips_emit.h +++ b/mips/mips_emit.h @@ -2356,13 +2356,7 @@ static void emit_pmemst_stub( // Palette conversion functions. a1 contains the palette value (16 LSB) // Places the result in reg_temp, can use a0 as temporary register -#ifdef USE_BGR_FORMAT - /* 0BGR to BGR565, only for PSP (uses ins) */ - #define palette_convert() \ - mips_emit_sll(reg_temp, reg_a1, 1); \ - mips_emit_andi(reg_temp, reg_temp, 0xFFC0); \ - mips_emit_ins(reg_temp, reg_a1, 0, 5); -#elif defined(USE_XBGR1555_FORMAT) +#if defined(USE_XBGR1555_FORMAT) /* PS2's native format */ #define palette_convert() \ mips_emit_andi(reg_temp, reg_a1, 0x7FFF);