diff options
| author | bunnei <bunneidev@gmail.com> | 2020-02-01 20:41:40 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-01 20:41:40 -0500 |
| commit | b5bbe7e752d5d36839a86638bfaa4b4c348497cd (patch) | |
| tree | b16b3f8ce5ec6233f9f822ad56418d74f0cd47ae /src/video_core/guest_driver.cpp | |
| parent | 2916c1bc2588cc189080dc87818f57875ae1d4a4 (diff) | |
| parent | bb8eb15d392d69693f8cda0427669d011e23db97 (diff) | |
Merge pull request #3282 from FernandoS27/indexed-samplers
Partially implement Indexed samplers in general and specific code in GLSL
Diffstat (limited to 'src/video_core/guest_driver.cpp')
| -rw-r--r-- | src/video_core/guest_driver.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/video_core/guest_driver.cpp b/src/video_core/guest_driver.cpp new file mode 100644 index 000000000..6adef459e --- /dev/null +++ b/src/video_core/guest_driver.cpp @@ -0,0 +1,36 @@ +// Copyright 2020 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include <algorithm> +#include <limits> + +#include "video_core/guest_driver.h" + +namespace VideoCore { + +void GuestDriverProfile::DeduceTextureHandlerSize(std::vector<u32>&& bound_offsets) { + if (texture_handler_size_deduced) { + return; + } + const std::size_t size = bound_offsets.size(); + if (size < 2) { + return; + } + std::sort(bound_offsets.begin(), bound_offsets.end(), std::less{}); + u32 min_val = std::numeric_limits<u32>::max(); + for (std::size_t i = 1; i < size; ++i) { + if (bound_offsets[i] == bound_offsets[i - 1]) { + continue; + } + const u32 new_min = bound_offsets[i] - bound_offsets[i - 1]; + min_val = std::min(min_val, new_min); + } + if (min_val > 2) { + return; + } + texture_handler_size_deduced = true; + texture_handler_size = min_texture_handler_size * min_val; +} + +} // namespace VideoCore |
