Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSX: ProgramStateCache placebo microoptimizations #16741

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions rpcs3/Emu/RSX/Program/ProgramStateCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ bool vertex_program_compare::operator()(const RSXVertexProgram &binary1, const R
const void* instBuffer1 = binary1.data.data();
const void* instBuffer2 = binary2.data.data();
usz instIndex = 0;
for (unsigned i = 0; i < binary1.data.size() / 4; i++)
do
{
if (binary1.instruction_mask[instIndex])
{
Expand All @@ -379,7 +379,7 @@ bool vertex_program_compare::operator()(const RSXVertexProgram &binary1, const R
}

instIndex++;
}
} while (instIndex < (binary1.data.size() / 4));

return true;
}
Expand Down Expand Up @@ -564,7 +564,7 @@ bool fragment_program_compare::operator()(const RSXFragmentProgram& binary1, con
const void* instBuffer1 = binary1.get_data();
const void* instBuffer2 = binary2.get_data();
usz instIndex = 0;
while (true)
do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're using the index counter now a for loop would be more readable and should cost the same.

{
const auto inst1 = v128::loadu(instBuffer1, instIndex);
const auto inst2 = v128::loadu(instBuffer2, instIndex);
Expand All @@ -578,13 +578,9 @@ bool fragment_program_compare::operator()(const RSXFragmentProgram& binary1, con
// Skip constants
if (fragment_program_utils::is_any_src_constant(inst1))
instIndex++;

const bool end = ((inst1._u32[0] >> 8) & 0x1);
if (end)
{
return true;
}
}
} while (instIndex < (binary1.ucode_length / 16));

return true;
}

namespace rsx
Expand Down