X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=plugins%2Fgpu_unai%2Fgpu_unai.h;h=4ab5a52f1a6bb43ecd0afeec37cbfc9bc3f8f031;hb=8999ff503db4e575aec00a3f383f78c7df2e516e;hp=8fb2293f488473cbe853f7fb39a0e6319f255b0e;hpb=28d1bea2e828cd079593abc8c97ea6ff4fd7d4f4;p=pcsx_rearmed.git diff --git a/plugins/gpu_unai/gpu_unai.h b/plugins/gpu_unai/gpu_unai.h index 8fb2293f..4ab5a52f 100644 --- a/plugins/gpu_unai/gpu_unai.h +++ b/plugins/gpu_unai/gpu_unai.h @@ -54,25 +54,67 @@ #define s32 int32_t #define s64 int64_t +typedef struct { + u32 v; +} le32_t; + +typedef struct { + u16 v; +} le16_t; + +static inline u32 le32_to_u32(le32_t le) +{ + return LE32TOH(le.v); +} + +static inline s32 le32_to_s32(le32_t le) +{ + return (int32_t) LE32TOH(le.v); +} + +static inline u32 le32_raw(le32_t le) +{ + return le.v; +} + +static inline le32_t u32_to_le32(u32 u) +{ + return (le32_t){ .v = HTOLE32(u) }; +} + +static inline u16 le16_to_u16(le16_t le) +{ + return LE16TOH(le.v); +} + +static inline s16 le16_to_s16(le16_t le) +{ + return (int16_t) LE16TOH(le.v); +} + +static inline u16 le16_raw(le16_t le) +{ + return le.v; +} + +static inline le16_t u16_to_le16(u16 u) +{ + return (le16_t){ .v = HTOLE16(u) }; +} + union PtrUnion { - u32 *U4; - s32 *S4; - u16 *U2; - s16 *S2; + le32_t *U4; + le16_t *U2; u8 *U1; - s8 *S1; void *ptr; }; union GPUPacket { - u32 U4[16]; - s32 S4[16]; - u16 U2[32]; - s16 S2[32]; + le32_t U4[16]; + le16_t U2[32]; u8 U1[64]; - s8 S1[64]; }; template static inline void SwapValues(T &x, T &y) @@ -136,8 +178,11 @@ static inline s32 GPU_DIV(s32 rs, s32 rt) struct gpu_unai_t { u32 GPU_GP1; GPUPacket PacketBuffer; - u16 *vram; + le16_t *vram; +#ifdef USE_GPULIB + le16_t *downscale_vram; +#endif //////////////////////////////////////////////////////////////////////////// // Variables used only by older standalone version of gpu_unai (gpu.cpp) #ifndef USE_GPULIB @@ -161,7 +206,7 @@ struct gpu_unai_t { struct { s32 px,py; s32 x_end,y_end; - u16* pvram; + le16_t* pvram; u32 *last_dma; // Last dma pointer bool FrameToRead; // Load image in progress bool FrameToWrite; // Store image in progress @@ -194,8 +239,8 @@ struct gpu_unai_t { s16 DrawingOffset[2]; // [0] : Drawing offset X (signed) // [1] : Drawing offset Y (signed) - u16* TBA; // Ptr to current texture in VRAM - u16* CBA; // Ptr to current CLUT in VRAM + le16_t* TBA; // Ptr to current texture in VRAM + le16_t* CBA; // Ptr to current CLUT in VRAM //////////////////////////////////////////////////////////////////////////// // Inner Loop parameters @@ -307,7 +352,7 @@ static inline bool ProgressiveInterlaceEnabled() // running on higher-res device or a resampling downscaler is enabled. static inline bool PixelSkipEnabled() { - return gpu_unai.config.pixel_skip; + return gpu_unai.config.pixel_skip || gpu_unai.config.scale_hires; } static inline bool LineSkipEnabled()