rsx: Rewrite the find method to avoid unnecessary allocations

This commit is contained in:
kd-11 2023-06-09 00:07:55 +03:00 committed by kd-11
parent 97f7461aa9
commit 105205312b

View File

@ -481,13 +481,19 @@ namespace rsx
storage_type* find_vertex_range(uptr local_addr, upload_format fmt, u32 data_length) override
{
//const auto data_end = local_addr + data_length;
auto found = vertex_ranges.find(local_addr);
if (found == vertex_ranges.end())
{
return nullptr;
}
for (auto &v : vertex_ranges[local_addr])
for (auto &v : found->second)
{
// NOTE: This has to match exactly. Using sized shortcuts such as >= comparison causes artifacting in some applications (UC1)
if (v.buffer_format == fmt && v.data_length == data_length)
if (v.data_length == data_length && v.buffer_format == fmt)
{
return &v;
}
}
return nullptr;