Skip to content

Commit

Permalink
Use lower_bound to speedup texture hostMapping lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
bylaws committed Nov 19, 2022
1 parent e7fda28 commit b6f4988
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions app/src/main/cpp/skyline/gpu/texture_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@ namespace skyline::gpu {

std::shared_ptr<Texture> match{};
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) {
return value.end() < element.end();
})}, hostMapping{mappingEnd};


while (hostMapping != textures.end() && guestMapping.begin() < hostMapping->end())
hostMapping++;
auto mappingEnd{std::upper_bound(textures.begin(), textures.end(), guestMapping, [guestMapping](const auto &value, const auto &element) {
return guestMapping.end() < element.end();
})}, hostMapping{std::lower_bound(mappingEnd, textures.end(), guestMapping, [guestMapping](const auto &value, const auto &element) {
return guestMapping.begin() < element.end();
})};

std::shared_ptr<Texture> fullMatch{};
std::shared_ptr<Texture> layerMipMatch{};
Expand Down

0 comments on commit b6f4988

Please sign in to comment.