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:
kd-11 2017-06-27 20:46:36 +03:00
parent 9cb58a47cd
commit 459a7ba5a2
2 changed files with 9 additions and 3 deletions

View file

@ -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]) ||