diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-06-05 04:03:49 +0200 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-06-05 05:24:51 +0200 |
commit | 5b2b6d594c6cfa77c3fb92faee63ad524bfe7204 (patch) | |
tree | 807efa01ce6b050f9660ab50a15d355d0be05bd5 /src/video_core/shader/registry.cpp | |
parent | shader/track: Move bindless tracking to a separate function (diff) | |
download | yuzu-5b2b6d594c6cfa77c3fb92faee63ad524bfe7204.tar yuzu-5b2b6d594c6cfa77c3fb92faee63ad524bfe7204.tar.gz yuzu-5b2b6d594c6cfa77c3fb92faee63ad524bfe7204.tar.bz2 yuzu-5b2b6d594c6cfa77c3fb92faee63ad524bfe7204.tar.lz yuzu-5b2b6d594c6cfa77c3fb92faee63ad524bfe7204.tar.xz yuzu-5b2b6d594c6cfa77c3fb92faee63ad524bfe7204.tar.zst yuzu-5b2b6d594c6cfa77c3fb92faee63ad524bfe7204.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/shader/registry.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/video_core/shader/registry.cpp b/src/video_core/shader/registry.cpp index af70b3f35..cdf274e54 100644 --- a/src/video_core/shader/registry.cpp +++ b/src/video_core/shader/registry.cpp @@ -93,6 +93,26 @@ std::optional<SamplerDescriptor> Registry::ObtainBoundSampler(u32 offset) { return value; } +std::optional<Tegra::Engines::SamplerDescriptor> Registry::ObtainSeparateSampler( + std::pair<u32, u32> buffers, std::pair<u32, u32> offsets) { + SeparateSamplerKey key; + key.buffers = buffers; + key.offsets = offsets; + const auto iter = separate_samplers.find(key); + if (iter != separate_samplers.end()) { + return iter->second; + } + if (!engine) { + return std::nullopt; + } + + const u32 handle_1 = engine->AccessConstBuffer32(stage, key.buffers.first, key.offsets.first); + const u32 handle_2 = engine->AccessConstBuffer32(stage, key.buffers.second, key.offsets.second); + const SamplerDescriptor value = engine->AccessSampler(handle_1 | handle_2); + separate_samplers.emplace(key, value); + return value; +} + std::optional<Tegra::Engines::SamplerDescriptor> Registry::ObtainBindlessSampler(u32 buffer, u32 offset) { const std::pair key = {buffer, offset}; |