mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 08:11:51 +00:00
rsx: Avoid using push_back/emplace_back on empty STL containers
- Reckless management of STL containers causes significant slowdown - Also reorders vertex compare steps to fail quickly on simpler checks
This commit is contained in:
parent
9cb58a47cd
commit
459a7ba5a2
@ -26,9 +26,11 @@ bool vertex_program_compare::operator()(const RSXVertexProgram &binary1, const R
|
||||
{
|
||||
if (binary1.output_mask != binary2.output_mask)
|
||||
return false;
|
||||
if (binary1.data.size() != binary2.data.size())
|
||||
return false;
|
||||
if (binary1.rsx_vertex_inputs != binary2.rsx_vertex_inputs)
|
||||
return false;
|
||||
if (binary1.data.size() != binary2.data.size()) return false;
|
||||
|
||||
const qword *instBuffer1 = (const qword*)binary1.data.data();
|
||||
const qword *instBuffer2 = (const qword*)binary2.data.data();
|
||||
size_t instIndex = 0;
|
||||
@ -40,6 +42,7 @@ bool vertex_program_compare::operator()(const RSXVertexProgram &binary1, const R
|
||||
return false;
|
||||
instIndex++;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -109,6 +112,7 @@ bool fragment_program_compare::operator()(const RSXFragmentProgram& binary1, con
|
||||
binary1.front_back_color_enabled != binary2.front_back_color_enabled || binary1.alpha_func != binary2.alpha_func ||
|
||||
binary1.shadow_textures != binary2.shadow_textures || binary1.redirected_textures != binary2.redirected_textures)
|
||||
return false;
|
||||
|
||||
const qword *instBuffer1 = (const qword*)binary1.addr;
|
||||
const qword *instBuffer2 = (const qword*)binary2.addr;
|
||||
size_t instIndex = 0;
|
||||
@ -119,6 +123,7 @@ bool fragment_program_compare::operator()(const RSXFragmentProgram& binary1, con
|
||||
|
||||
if (inst1.dword[0] != inst2.dword[0] || inst1.dword[1] != inst2.dword[1])
|
||||
return false;
|
||||
|
||||
instIndex++;
|
||||
// Skip constants
|
||||
if (fragment_program_utils::is_constant(inst1.word[1]) ||
|
||||
|
@ -273,7 +273,7 @@ namespace rsx
|
||||
|
||||
void thread::begin()
|
||||
{
|
||||
rsx::method_registers.current_draw_clause.inline_vertex_array.clear();
|
||||
rsx::method_registers.current_draw_clause.inline_vertex_array.resize(0);
|
||||
in_begin_end = true;
|
||||
}
|
||||
|
||||
@ -865,6 +865,7 @@ namespace rsx
|
||||
RSXVertexProgram result = {};
|
||||
const u32 transform_program_start = rsx::method_registers.transform_program_start();
|
||||
result.data.reserve((512 - transform_program_start) * 4);
|
||||
result.rsx_vertex_inputs.reserve(rsx::limits::vertex_count);
|
||||
|
||||
for (int i = transform_program_start; i < 512; ++i)
|
||||
{
|
||||
@ -881,7 +882,7 @@ namespace rsx
|
||||
|
||||
const u32 input_mask = rsx::method_registers.vertex_attrib_input_mask();
|
||||
const u32 modulo_mask = rsx::method_registers.frequency_divider_operation_mask();
|
||||
result.rsx_vertex_inputs.clear();
|
||||
|
||||
for (u8 index = 0; index < rsx::limits::vertex_count; ++index)
|
||||
{
|
||||
bool enabled = !!(input_mask & (1 << index));
|
||||
|
Loading…
Reference in New Issue
Block a user