notaz.gp2x.de
/
pcsx_rearmed.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
psx_gpu: standalone test build + tweaks
[pcsx_rearmed.git]
/
plugins
/
gpu_neon
/
psx_gpu
/
psx_gpu_parse.c
diff --git
a/plugins/gpu_neon/psx_gpu/psx_gpu_parse.c
b/plugins/gpu_neon/psx_gpu/psx_gpu_parse.c
index
ac35631
..
920c638
100644
(file)
--- a/
plugins/gpu_neon/psx_gpu/psx_gpu_parse.c
+++ b/
plugins/gpu_neon/psx_gpu/psx_gpu_parse.c
@@
-199,12
+199,17
@@
void set_triangle_color(psx_gpu_struct *psx_gpu, u32 triangle_color)
get_vertex_data_xy(vertex_number, offset16); \
set_vertex_color_constant(vertex_number, color) \
get_vertex_data_xy(vertex_number, offset16); \
set_vertex_color_constant(vertex_number, color) \
+#ifndef SET_Ex
+#define SET_Ex(r, v)
+#endif
+
vertex_struct vertexes[4] __attribute__((aligned(32)));
vertex_struct vertexes[4] __attribute__((aligned(32)));
-
void gpu_parse(psx_gpu_struct *psx_gpu, u32 *list, u32 size
)
+
u32 gpu_parse(psx_gpu_struct *psx_gpu, u32 *list, u32 size, u32 *last_command
)
{
{
- u32 current_command, command_length;
-
+ u32 current_command = 0, command_length;
+
+ u32 *list_start = list;
u32 *list_end = list + (size / 4);
for(; list < list_end; list += 1 + command_length)
u32 *list_end = list + (size / 4);
for(; list < list_end; list += 1 + command_length)
@@
-212,6
+217,10
@@
void gpu_parse(psx_gpu_struct *psx_gpu, u32 *list, u32 size)
s16 *list_s16 = (void *)list;
current_command = *list >> 24;
command_length = command_lengths[current_command];
s16 *list_s16 = (void *)list;
current_command = *list >> 24;
command_length = command_lengths[current_command];
+ if (list + 1 + command_length > list_end) {
+ current_command = (u32)-1;
+ break;
+ }
switch(current_command)
{
switch(current_command)
{
@@
-403,31
+412,29
@@
void gpu_parse(psx_gpu_struct *psx_gpu, u32 *list, u32 size)
vertexes[1].x = (xy & 0xFFFF) + psx_gpu->offset_x;
vertexes[1].y = (xy >> 16) + psx_gpu->offset_y;
vertexes[1].x = (xy & 0xFFFF) + psx_gpu->offset_x;
vertexes[1].y = (xy >> 16) + psx_gpu->offset_y;
+ xy = *list_position;
while(1)
{
while(1)
{
- xy = *list_position;
-
- if((xy & 0xF000F000) == 0x50005000)
- break;
-
vertexes[0] = vertexes[1];
vertexes[1].x = (xy & 0xFFFF) + psx_gpu->offset_x;
vertexes[1].y = (xy >> 16) + psx_gpu->offset_y;
vertexes[0] = vertexes[1];
vertexes[1].x = (xy & 0xFFFF) + psx_gpu->offset_x;
vertexes[1].y = (xy >> 16) + psx_gpu->offset_y;
+ render_line(psx_gpu, vertexes, current_command, list[0]);
+
list_position++;
num_vertexes++;
list_position++;
num_vertexes++;
- if(list_position > list_end)
+ if(list_position >
=
list_end)
break;
break;
- render_line(psx_gpu, vertexes, current_command, list[0]);
+ xy = *list_position;
+ if((xy & 0xF000F000) == 0x50005000)
+ break;
}
}
- if(num_vertexes > 2)
- command_length += (num_vertexes - 2);
-
- break;
+ command_length += (num_vertexes - 2);
+ break;
}
case 0x50 ... 0x57:
}
case 0x50 ... 0x57:
@@
-461,12
+468,9
@@
void gpu_parse(psx_gpu_struct *psx_gpu, u32 *list, u32 size)
vertexes[1].x = (xy & 0xFFFF) + psx_gpu->offset_x;
vertexes[1].y = (xy >> 16) + psx_gpu->offset_y;
vertexes[1].x = (xy & 0xFFFF) + psx_gpu->offset_x;
vertexes[1].y = (xy >> 16) + psx_gpu->offset_y;
+ color = list_position[0];
while(1)
{
while(1)
{
- color = list_position[0];
- if((color & 0xF000F000) == 0x50005000)
- break;
-
xy = list_position[1];
vertexes[0] = vertexes[1];
xy = list_position[1];
vertexes[0] = vertexes[1];
@@
-477,19
+481,21
@@
void gpu_parse(psx_gpu_struct *psx_gpu, u32 *list, u32 size)
vertexes[1].x = (xy & 0xFFFF) + psx_gpu->offset_x;
vertexes[1].y = (xy >> 16) + psx_gpu->offset_y;
vertexes[1].x = (xy & 0xFFFF) + psx_gpu->offset_x;
vertexes[1].y = (xy >> 16) + psx_gpu->offset_y;
+ render_line(psx_gpu, vertexes, current_command, 0);
+
list_position += 2;
num_vertexes++;
list_position += 2;
num_vertexes++;
- if(list_position > list_end)
+ if(list_position >
=
list_end)
break;
break;
- render_line(psx_gpu, vertexes, current_command, 0);
+ color = list_position[0];
+ if((color & 0xF000F000) == 0x50005000)
+ break;
}
}
- if(num_vertexes > 2)
- command_length += ((num_vertexes * 2) - 2);
-
- break;
+ command_length += ((num_vertexes - 2) * 2);
+ break;
}
case 0x60 ... 0x63:
}
case 0x60 ... 0x63:
@@
-588,9
+594,15
@@
void gpu_parse(psx_gpu_struct *psx_gpu, u32 *list, u32 size)
case 0x80: // vid -> vid
render_block_move(psx_gpu, list_s16[2] & 0x3FF, list_s16[3] & 0x1FF,
case 0x80: // vid -> vid
render_block_move(psx_gpu, list_s16[2] & 0x3FF, list_s16[3] & 0x1FF,
- list_s16[4] & 0x3FF, list_s16[5] & 0x1FF, list_s16[6], list_s16[7]);
+ list_s16[4] & 0x3FF, list_s16[5] & 0x1FF,
+ ((list_s16[6] - 1) & 0x3FF) + 1, ((list_s16[7] - 1) & 0x1FF) + 1);
break;
break;
-
+
+#ifdef PCSX
+ case 0xA0: // sys -> vid
+ case 0xC0: // vid -> sys
+ goto breakloop;
+#else
case 0xA0: // sys -> vid
{
u32 load_x = list_s16[2] & 0x3FF;
case 0xA0: // sys -> vid
{
u32 load_x = list_s16[2] & 0x3FF;
@@
-608,10
+620,11
@@
void gpu_parse(psx_gpu_struct *psx_gpu, u32 *list, u32 size)
load_width, load_height, load_width);
break;
}
load_width, load_height, load_width);
break;
}
-
+
case 0xC0: // vid -> sys
break;
case 0xC0: // vid -> sys
break;
-
+#endif
+
case 0xE1:
set_texture(psx_gpu, list[0] & 0x1FF);
case 0xE1:
set_texture(psx_gpu, list[0] & 0x1FF);
@@
-621,6
+634,7
@@
void gpu_parse(psx_gpu_struct *psx_gpu, u32 *list, u32 size)
psx_gpu->render_state_base &= ~RENDER_STATE_DITHER;
psx_gpu->display_area_draw_enable = (list[0] >> 10) & 0x1;
psx_gpu->render_state_base &= ~RENDER_STATE_DITHER;
psx_gpu->display_area_draw_enable = (list[0] >> 10) & 0x1;
+ SET_Ex(1, list[0]);
break;
case 0xE2:
break;
case 0xE2:
@@
-653,6
+667,7
@@
void gpu_parse(psx_gpu_struct *psx_gpu, u32 *list, u32 size)
update_texture_ptr(psx_gpu);
}
update_texture_ptr(psx_gpu);
}
+ SET_Ex(2, list[0]);
break;
}
break;
}
@@
-666,6
+681,7
@@
void gpu_parse(psx_gpu_struct *psx_gpu, u32 *list, u32 size)
psx_gpu->viewport_start_y, psx_gpu->viewport_end_x,
psx_gpu->viewport_end_y);
#endif
psx_gpu->viewport_start_y, psx_gpu->viewport_end_x,
psx_gpu->viewport_end_y);
#endif
+ SET_Ex(3, list[0]);
break;
case 0xE4:
break;
case 0xE4:
@@
-678,6
+694,7
@@
void gpu_parse(psx_gpu_struct *psx_gpu, u32 *list, u32 size)
psx_gpu->viewport_start_y, psx_gpu->viewport_end_x,
psx_gpu->viewport_end_y);
#endif
psx_gpu->viewport_start_y, psx_gpu->viewport_end_x,
psx_gpu->viewport_end_y);
#endif
+ SET_Ex(4, list[0]);
break;
case 0xE5:
break;
case 0xE5:
@@
-687,6
+704,7
@@
void gpu_parse(psx_gpu_struct *psx_gpu, u32 *list, u32 size)
psx_gpu->offset_x = offset_x >> 21;
psx_gpu->offset_y = offset_y >> 21;
psx_gpu->offset_x = offset_x >> 21;
psx_gpu->offset_y = offset_y >> 21;
+ SET_Ex(5, list[0]);
break;
}
break;
}
@@
-706,6
+724,7
@@
void gpu_parse(psx_gpu_struct *psx_gpu, u32 *list, u32 size)
psx_gpu->mask_msb = mask_msb;
}
psx_gpu->mask_msb = mask_msb;
}
+ SET_Ex(6, list[0]);
break;
}
break;
}
@@
-713,5
+732,12
@@
void gpu_parse(psx_gpu_struct *psx_gpu, u32 *list, u32 size)
break;
}
}
break;
}
}
+
+#ifdef PCSX
+breakloop:
+#endif
+ if (last_command != NULL)
+ *last_command = current_command;
+ return list - list_start;
}
}