aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornotaz2011-12-09 00:31:22 +0200
committernotaz2011-12-09 01:29:54 +0200
commit8aea5f5ac9382379622991974bded6b08f328ddc (patch)
tree54956a418884c920832f7df7b5b4e36ea9cb09b7
parent914455e692f4720c43f4bc2122a4795e6c45bc7c (diff)
downloadpcsx_rearmed-8aea5f5ac9382379622991974bded6b08f328ddc.tar.gz
pcsx_rearmed-8aea5f5ac9382379622991974bded6b08f328ddc.tar.bz2
pcsx_rearmed-8aea5f5ac9382379622991974bded6b08f328ddc.zip
gpu_neon: fix unai rasterizer
it can't work directly on the list because modifies it
-rw-r--r--plugins/gpu_neon/peops_if.c2
-rw-r--r--plugins/gpu_neon/unai_if.cpp67
2 files changed, 37 insertions, 32 deletions
diff --git a/plugins/gpu_neon/peops_if.c b/plugins/gpu_neon/peops_if.c
index d6c47e2..a492f3a 100644
--- a/plugins/gpu_neon/peops_if.c
+++ b/plugins/gpu_neon/peops_if.c
@@ -347,7 +347,7 @@ void do_cmd_list(unsigned int *list, int list_len)
}
if(num_vertexes > 2)
- len += ((num_vertexes * 2) - 2);
+ len += (num_vertexes - 2) * 2;
break;
}
diff --git a/plugins/gpu_neon/unai_if.cpp b/plugins/gpu_neon/unai_if.cpp
index 0497dda..488d26c 100644
--- a/plugins/gpu_neon/unai_if.cpp
+++ b/plugins/gpu_neon/unai_if.cpp
@@ -32,15 +32,13 @@
#define s32 int32_t
#define s64 int64_t
-#define INLINE
+#define INLINE static
#define FRAME_BUFFER_SIZE (1024*512*2)
#define FRAME_WIDTH 1024
#define FRAME_HEIGHT 512
#define FRAME_OFFSET(x,y) (((y)<<10)+(x))
-//#define VIDEO_WIDTH 320
-
static bool isSkip = false; /* skip frame (info coming from GPU) */
static int linesInterlace = 0; /* internal lines interlace */
@@ -91,12 +89,12 @@ static u32 tInc, tMsk;
union GPUPacket
{
- u32 *U4;
- s32 *S4;
- u16 *U2;
- s16 *S2;
- u8 *U1;
- s8 *S1;
+ u32 U4[16];
+ s32 S4[16];
+ u16 U2[32];
+ s16 S2[32];
+ u8 U1[64];
+ s8 S1[64];
};
static GPUPacket PacketBuffer;
@@ -137,8 +135,8 @@ static u32 GPU_GP1;
// GPU command buffer execution/store
#include "../gpu_unai/gpu_command.h"
-#define unai_do_prim(cmd, list) \
- PacketBuffer.U4 = list; \
+#define unai_do_prim(cmd, list, len) \
+ memcpy(PacketBuffer.U4, list, (len) * 4); \
gpuSendPacketFunction(cmd)
/////////////////////////////////////////////////////////////////////////////
@@ -172,25 +170,29 @@ void do_cmd_list(unsigned int *list, int list_len)
for (; list < list_end; list += 1 + len)
{
- short *slist = (short *)list;
cmd = *list >> 24;
len = cmd_lengths[cmd];
- unai_do_prim(cmd, list);
-
switch(cmd)
{
case 0x48 ... 0x4F:
{
u32 num_vertexes = 1;
u32 *list_position = &(list[2]);
+ u32 PRIM = cmd;
+
+ memcpy(&PacketBuffer.U4[0], list, 4 * 3);
+ gpuDrawLF(gpuPixelDrivers [ (Blending_Mode | Masking | Blending | (PixelMSB>>3)) >> 1]);
while(1)
{
if((*list_position & 0xf000f000) == 0x50005000 || list_position >= list_end)
break;
- list_position++;
+ PacketBuffer.U4[1] = PacketBuffer.U4[2];
+ PacketBuffer.U4[2] = *list_position++;
+ gpuDrawLF(gpuPixelDrivers [ (Blending_Mode | Masking | Blending | (PixelMSB>>3)) >> 1]);
+
num_vertexes++;
}
@@ -204,43 +206,46 @@ void do_cmd_list(unsigned int *list, int list_len)
{
u32 num_vertexes = 1;
u32 *list_position = &(list[2]);
+ u32 PRIM = cmd;
+
+ memcpy(&PacketBuffer.U4[0], list, 4 * 4);
+ gpuDrawLG(gpuPixelDrivers [ (Blending_Mode | Masking | Blending | (PixelMSB>>3)) >> 1]);
while(1)
{
if((*list_position & 0xf000f000) == 0x50005000 || list_position >= list_end)
break;
- list_position += 2;
+ PacketBuffer.U4[0] = PacketBuffer.U4[2];
+ PacketBuffer.U4[1] = PacketBuffer.U4[3];
+ PacketBuffer.U4[2] = *list_position++;
+ PacketBuffer.U4[3] = *list_position++;
+ gpuDrawLG(gpuPixelDrivers [ (Blending_Mode | Masking | Blending | (PixelMSB>>3)) >> 1]);
+
num_vertexes++;
}
if(num_vertexes > 2)
- len += ((num_vertexes * 2) - 2);
+ len += (num_vertexes - 2) * 2;
break;
}
- case 0xA0: // sys -> vid
- {
- u32 load_width = slist[4];
- u32 load_height = slist[5];
- u32 load_size = load_width * load_height;
-
- len += load_size / 2;
+ default:
+ unai_do_prim(cmd, list, len + 1);
break;
- }
}
}
}
void renderer_sync_ecmds(uint32_t *ecmds)
{
- unai_do_prim(0xe1, &ecmds[1]);
- unai_do_prim(0xe2, &ecmds[2]);
- unai_do_prim(0xe3, &ecmds[3]);
- unai_do_prim(0xe4, &ecmds[4]);
- unai_do_prim(0xe5, &ecmds[5]);
- unai_do_prim(0xe6, &ecmds[6]);
+ unai_do_prim(0xe1, &ecmds[1], 1);
+ unai_do_prim(0xe2, &ecmds[2], 1);
+ unai_do_prim(0xe3, &ecmds[3], 1);
+ unai_do_prim(0xe4, &ecmds[4], 1);
+ unai_do_prim(0xe5, &ecmds[5], 1);
+ unai_do_prim(0xe6, &ecmds[6], 1);
}
void renderer_invalidate_caches(int x, int y, int w, int h)