#endif
u32 gpu_parse(psx_gpu_struct *psx_gpu, u32 *list, u32 size,
- s32 *cpu_cycles_out, u32 *last_command)
+ s32 *cpu_cycles_sum_out, s32 *cpu_cycles_last, u32 *last_command)
{
vertex_struct vertexes[4] __attribute__((aligned(16))) = {};
- u32 current_command = 0, command_length, cpu_cycles = 0;
+ u32 current_command = 0, command_length;
+ u32 cpu_cycles_sum = 0, cpu_cycles = *cpu_cycles_last;
u32 *list_start = list;
u32 *list_end = list + (size / 4);
u32 color = list[0] & 0xFFFFFF;
do_fill(psx_gpu, x, y, width, height, color);
- cpu_cycles += gput_fill(width, height);
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_fill(width, height));
break;
}
get_vertex_data_xy(2, 6);
render_triangle(psx_gpu, vertexes, current_command);
- cpu_cycles += gput_poly_base();
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_poly_base());
break;
}
get_vertex_data_xy_uv(2, 10);
render_triangle(psx_gpu, vertexes, current_command);
- cpu_cycles += gput_poly_base_t();
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_poly_base_t());
break;
}
render_triangle(psx_gpu, vertexes, current_command);
render_triangle(psx_gpu, &(vertexes[1]), current_command);
- cpu_cycles += gput_quad_base();
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_quad_base());
break;
}
render_triangle(psx_gpu, vertexes, current_command);
render_triangle(psx_gpu, &(vertexes[1]), current_command);
- cpu_cycles += gput_quad_base_t();
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_quad_base_t());
break;
}
get_vertex_data_xy_rgb(2, 8);
render_triangle(psx_gpu, vertexes, current_command);
- cpu_cycles += gput_poly_base_g();
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_poly_base_g());
break;
}
get_vertex_data_xy_uv_rgb(2, 12);
render_triangle(psx_gpu, vertexes, current_command);
- cpu_cycles += gput_poly_base_gt();
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_poly_base_gt());
break;
}
render_triangle(psx_gpu, vertexes, current_command);
render_triangle(psx_gpu, &(vertexes[1]), current_command);
- cpu_cycles += gput_quad_base_g();
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_quad_base_g());
break;
}
render_triangle(psx_gpu, vertexes, current_command);
render_triangle(psx_gpu, &(vertexes[1]), current_command);
- cpu_cycles += gput_quad_base_gt();
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_quad_base_gt());
break;
}
vertexes[1].y = list_s16[5] + psx_gpu->offset_y;
render_line(psx_gpu, vertexes, current_command, list[0], 0);
- cpu_cycles += gput_line(0);
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_line(0));
break;
}
vertexes[1].y = (xy >> 16) + psx_gpu->offset_y;
render_line(psx_gpu, vertexes, current_command, list[0], 0);
- cpu_cycles += gput_line(0);
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_line(0));
list_position++;
num_vertexes++;
vertexes[1].y = list_s16[7] + psx_gpu->offset_y;
render_line(psx_gpu, vertexes, current_command, 0, 0);
- cpu_cycles += gput_line(0);
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_line(0));
break;
}
vertexes[1].y = (xy >> 16) + psx_gpu->offset_y;
render_line(psx_gpu, vertexes, current_command, 0, 0);
- cpu_cycles += gput_line(0);
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_line(0));
list_position += 2;
num_vertexes++;
render_sprite(psx_gpu, x, y, 0, 0, &width, &height,
current_command, list[0]);
- cpu_cycles += gput_sprite(width, height);
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_sprite(width, height));
break;
}
render_sprite(psx_gpu, x, y, uv & 0xFF, (uv >> 8) & 0xFF,
&width, &height, current_command, list[0]);
- cpu_cycles += gput_sprite(width, height);
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_sprite(width, height));
break;
}
render_sprite(psx_gpu, x, y, 0, 0, &width, &height,
current_command, list[0]);
- cpu_cycles += gput_sprite(1, 1);
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_sprite(1, 1));
break;
}
render_sprite(psx_gpu, x, y, 0, 0, &width, &height,
current_command, list[0]);
- cpu_cycles += gput_sprite(width, height);
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_sprite(width, height));
break;
}
render_sprite(psx_gpu, x, y, uv & 0xFF, (uv >> 8) & 0xFF,
&width, &height, current_command, list[0]);
- cpu_cycles += gput_sprite(width, height);
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_sprite(width, height));
break;
}
render_sprite(psx_gpu, x, y, 0, 0, &width, &height,
current_command, list[0]);
- cpu_cycles += gput_sprite(width, height);
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_sprite(width, height));
break;
}
render_sprite(psx_gpu, x, y, uv & 0xFF, (uv >> 8) & 0xFF,
&width, &height, current_command, list[0]);
- cpu_cycles += gput_sprite(width, height);
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_sprite(width, height));
break;
}
}
breakloop:
- *cpu_cycles_out += cpu_cycles;
+ *cpu_cycles_sum_out += cpu_cycles_sum;
+ *cpu_cycles_last = cpu_cycles;
*last_command = current_command;
return list - list_start;
}
#endif
u32 gpu_parse_enhanced(psx_gpu_struct *psx_gpu, u32 *list, u32 size,
- s32 *cpu_cycles_out, u32 *last_command)
+ s32 *cpu_cycles_sum_out, s32 *cpu_cycles_last, u32 *last_command)
{
vertex_struct vertexes[4] __attribute__((aligned(16))) = {};
- u32 current_command = 0, command_length, cpu_cycles = 0;
+ u32 current_command = 0, command_length;
+ u32 cpu_cycles_sum = 0, cpu_cycles = *cpu_cycles_last;
u32 *list_start = list;
u32 *list_end = list + (size / 4);
x &= ~0xF;
width = ((width + 0xF) & ~0xF);
- cpu_cycles += gput_fill(width, height);
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_fill(width, height));
if (width == 0 || height == 0)
break;
get_vertex_data_xy(2, 6);
do_triangle_enhanced(psx_gpu, vertexes, current_command);
- cpu_cycles += gput_poly_base();
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_poly_base());
break;
}
get_vertex_data_xy_uv(2, 10);
do_triangle_enhanced(psx_gpu, vertexes, current_command);
- cpu_cycles += gput_poly_base_t();
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_poly_base_t());
break;
}
get_vertex_data_xy(3, 8);
do_quad_enhanced(psx_gpu, vertexes, current_command);
- cpu_cycles += gput_quad_base();
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_quad_base());
break;
}
uv_hack(vertexes, 4);
do_quad_enhanced(psx_gpu, vertexes, current_command);
- cpu_cycles += gput_quad_base_t();
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_quad_base_t());
break;
}
get_vertex_data_xy_rgb(2, 8);
do_triangle_enhanced(psx_gpu, vertexes, current_command);
- cpu_cycles += gput_poly_base_g();
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_poly_base_g());
break;
}
get_vertex_data_xy_uv_rgb(2, 12);
do_triangle_enhanced(psx_gpu, vertexes, current_command);
- cpu_cycles += gput_poly_base_gt();
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_poly_base_gt());
break;
}
get_vertex_data_xy_rgb(3, 12);
do_quad_enhanced(psx_gpu, vertexes, current_command);
- cpu_cycles += gput_quad_base_g();
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_quad_base_g());
break;
}
uv_hack(vertexes, 4);
do_quad_enhanced(psx_gpu, vertexes, current_command);
- cpu_cycles += gput_quad_base_gt();
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_quad_base_gt());
break;
}
render_line(psx_gpu, vertexes, current_command, list[0], 0);
if (enhancement_enable(psx_gpu))
render_line(psx_gpu, vertexes, current_command, list[0], 1);
- cpu_cycles += gput_line(0);
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_line(0));
break;
}
render_line(psx_gpu, vertexes, current_command, list[0], 0);
if (enhancement_enable(psx_gpu))
render_line(psx_gpu, vertexes, current_command, list[0], 1);
- cpu_cycles += gput_line(0);
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_line(0));
list_position++;
num_vertexes++;
render_line(psx_gpu, vertexes, current_command, 0, 0);
if (enhancement_enable(psx_gpu))
render_line(psx_gpu, vertexes, current_command, 0, 1);
- cpu_cycles += gput_line(0);
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_line(0));
break;
}
render_line(psx_gpu, vertexes, current_command, 0, 0);
if (enhancement_enable(psx_gpu))
render_line(psx_gpu, vertexes, current_command, 0, 1);
- cpu_cycles += gput_line(0);
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_line(0));
list_position += 2;
num_vertexes++;
if (check_enhanced_range(psx_gpu, x, x + width))
do_sprite_enhanced(psx_gpu, x, y, 0, 0, width, height, list[0]);
- cpu_cycles += gput_sprite(width, height);
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_sprite(width, height));
break;
}
if (check_enhanced_range(psx_gpu, x, x + width))
do_sprite_enhanced(psx_gpu, x, y, u, v, width, height, list[0]);
- cpu_cycles += gput_sprite(width, height);
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_sprite(width, height));
break;
}
if (check_enhanced_range(psx_gpu, x, x + 1))
do_sprite_enhanced(psx_gpu, x, y, 0, 0, width, height, list[0]);
- cpu_cycles += gput_sprite(1, 1);
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_sprite(1, 1));
break;
}
if (check_enhanced_range(psx_gpu, x, x + 8))
do_sprite_enhanced(psx_gpu, x, y, 0, 0, width, height, list[0]);
- cpu_cycles += gput_sprite(width, height);
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_sprite(width, height));
break;
}
if (check_enhanced_range(psx_gpu, x, x + 8))
do_sprite_enhanced(psx_gpu, x, y, u, v, width, height, list[0]);
- cpu_cycles += gput_sprite(width, height);
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_sprite(width, height));
break;
}
if (check_enhanced_range(psx_gpu, x, x + 16))
do_sprite_enhanced(psx_gpu, x, y, 0, 0, width, height, list[0]);
- cpu_cycles += gput_sprite(width, height);
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_sprite(width, height));
break;
}
if (check_enhanced_range(psx_gpu, x, x + 16))
do_sprite_enhanced(psx_gpu, x, y, u, v, width, height, list[0]);
- cpu_cycles += gput_sprite(width, height);
+ gput_sum(cpu_cycles_sum, cpu_cycles, gput_sprite(width, height));
break;
}
enhancement_disable();
breakloop:
- *cpu_cycles_out += cpu_cycles;
+ *cpu_cycles_sum_out += cpu_cycles_sum;
+ *cpu_cycles_last = cpu_cycles;
*last_command = current_command;
return list - list_start;
}