X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=plugins%2Fdfxvideo%2Fgpulib_if.c;h=ac86f37947117a30135f811e19b4a7e8c344ce30;hb=fe564285d821692def083c0d3579ce71496f687a;hp=c0066b5ac2aee6b18197faf4cb223ec93f534cf8;hpb=6fe8a1d4501485790b5a58f1a4c62130dd70afb4;p=pcsx_rearmed.git diff --git a/plugins/dfxvideo/gpulib_if.c b/plugins/dfxvideo/gpulib_if.c index c0066b5a..ac86f379 100644 --- a/plugins/dfxvideo/gpulib_if.c +++ b/plugins/dfxvideo/gpulib_if.c @@ -16,6 +16,11 @@ #include #include #include "../gpulib/gpu.h" +#include "../../include/arm_features.h" + +#if defined(__GNUC__) && (__GNUC__ >= 6 || (defined(__clang_major__) && __clang_major__ >= 10)) +#pragma GCC diagnostic ignored "-Wmisleading-indentation" +#endif #ifdef THREAD_RENDERING #include "../gpulib/gpulib_thread_if.h" @@ -84,16 +89,15 @@ #endif -#define GETLEs16(X) ((int16_t)GETLE16((uint16_t *)X)) -#define GETLEs32(X) ((int16_t)GETLE32((uint16_t *)X)) +#define GETLEs16(X) ((int16_t)GETLE16((uint16_t *)(X))) -#define GETLE16(X) LE2HOST16(*(uint16_t *)X) -#define GETLE32_(X) LE2HOST32(*(uint32_t *)X) -#define GETLE16D(X) ({uint32_t val = GETLE32(X); (val<<16 | val >> 16);}) -#define PUTLE16(X, Y) do{*((uint16_t *)X)=HOST2LE16((uint16_t)Y);}while(0) -#define PUTLE32_(X, Y) do{*((uint32_t *)X)=HOST2LE32((uint32_t)Y);}while(0) -#ifdef __arm__ -#define GETLE32(X) (*(uint16_t *)(X)|(((uint16_t *)(X))[1]<<16)) +#define GETLE16(X) LE2HOST16(*(uint16_t *)(X)) +#define GETLE32_(X) LE2HOST32(*(uint32_t *)(X)) +#define PUTLE16(X, Y) do{*((uint16_t *)(X))=HOST2LE16((uint16_t)(Y));}while(0) +#define PUTLE32_(X, Y) do{*((uint32_t *)(X))=HOST2LE32((uint32_t)(Y));}while(0) +#if defined(__arm__) && !defined(HAVE_ARMV6) +// for (very) old ARMs with no unaligned loads? +#define GETLE32(X) (*(uint16_t *)(X)|((uint32_t)((uint16_t *)(X))[1]<<16)) #define PUTLE32(X, Y) do{uint16_t *p_=(uint16_t *)(X);uint32_t y_=Y;p_[0]=y_;p_[1]=y_>>16;}while(0) #else #define GETLE32 GETLE32_ @@ -249,12 +253,8 @@ extern int32_t drawH; PSXDisplay_t PSXDisplay; unsigned char *psxVub; -signed char *psxVsb; unsigned short *psxVuw; unsigned short *psxVuw_eom; -signed short *psxVsw; -uint32_t *psxVul; -int32_t *psxVsl; long lGPUstatusRet; uint32_t lGPUInfoVals[16]; @@ -270,6 +270,10 @@ unsigned short sSetMask = 0; unsigned long lSetMask = 0; long lLowerpart; +#if defined(__GNUC__) && __GNUC__ >= 6 +#pragma GCC diagnostic ignored "-Wmisleading-indentation" +#endif + #include "soft.c" #include "prim.c" @@ -278,13 +282,7 @@ long lLowerpart; static void set_vram(void *vram) { psxVub=vram; - - psxVsb=(signed char *)psxVub; // different ways of accessing PSX VRAM - psxVsw=(signed short *)psxVub; - psxVsl=(int32_t *)psxVub; psxVuw=(unsigned short *)psxVub; - psxVul=(uint32_t *)psxVub; - psxVuw_eom=psxVuw+1024*512; // pre-calc of end of vram } @@ -317,6 +315,10 @@ void renderer_notify_res_change(void) { } +void renderer_notify_scanout_x_change(int x, int w) +{ +} + extern const unsigned char cmd_lengths[256]; int do_cmd_list(uint32_t *list, int list_len, int *last_cmd) @@ -335,7 +337,7 @@ int do_cmd_list(uint32_t *list, int list_len, int *last_cmd) } #ifndef TEST - if (cmd == 0xa0 || cmd == 0xc0) + if (0x80 <= cmd && cmd < 0xe0) break; // image i/o, forward to upper layer else if ((cmd & 0xf8) == 0xe0) gpu.ex_regs[cmd & 7] = GETLE32(list); @@ -414,8 +416,16 @@ breakloop: return list - list_start; } -void renderer_sync_ecmds(uint32_t *ecmds) +void renderer_sync_ecmds(uint32_t *ecmds_) { +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + // the funcs below expect LE + uint32_t i, ecmds[8]; + for (i = 1; i <= 6; i++) + ecmds[i] = HTOLE32(ecmds_[i]); +#else + uint32_t *ecmds = ecmds_; +#endif cmdTexturePage((unsigned char *)&ecmds[1]); cmdTextureWindow((unsigned char *)&ecmds[2]); cmdDrawAreaStart((unsigned char *)&ecmds[3]); @@ -424,7 +434,7 @@ void renderer_sync_ecmds(uint32_t *ecmds) cmdSTP((unsigned char *)&ecmds[6]); } -void renderer_update_caches(int x, int y, int w, int h) +void renderer_update_caches(int x, int y, int w, int h, int state_changed) { }