Use lower_bound to speedup texture hostMapping lookup

This commit is contained in:
Billy Laws 2022-11-06 19:24:35 +00:00
parent e7fda28ac6
commit b6f49884b3

View File

@ -25,13 +25,11 @@ namespace skyline::gpu {
std::shared_ptr<Texture> match{}; std::shared_ptr<Texture> match{};
boost::container::small_vector<std::shared_ptr<Texture>, 4> matches{}; boost::container::small_vector<std::shared_ptr<Texture>, 4> matches{};
auto mappingEnd{std::upper_bound(textures.begin(), textures.end(), guestMapping, [](const auto &value, const auto &element) { auto mappingEnd{std::upper_bound(textures.begin(), textures.end(), guestMapping, [guestMapping](const auto &value, const auto &element) {
return value.end() < element.end(); return guestMapping.end() < element.end();
})}, hostMapping{mappingEnd}; })}, hostMapping{std::lower_bound(mappingEnd, textures.end(), guestMapping, [guestMapping](const auto &value, const auto &element) {
return guestMapping.begin() < element.end();
})};
while (hostMapping != textures.end() && guestMapping.begin() < hostMapping->end())
hostMapping++;
std::shared_ptr<Texture> fullMatch{}; std::shared_ptr<Texture> fullMatch{};
std::shared_ptr<Texture> layerMipMatch{}; std::shared_ptr<Texture> layerMipMatch{};