summaryrefslogtreecommitdiff
path: root/src/video_core/shader
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2019-09-26 00:23:08 -0300
committerGravatar FernandoS272019-10-25 09:01:32 -0400
commit78f3e8a75792c976eb5bfa6df4c020d898642684 (patch)
tree4c7103c396f180654850362c89d01b46358e58cb /src/video_core/shader
parentgl_shader_disk_cache: Store and load fast BRX (diff)
downloadyuzu-78f3e8a75792c976eb5bfa6df4c020d898642684.tar.gz
yuzu-78f3e8a75792c976eb5bfa6df4c020d898642684.tar.xz
yuzu-78f3e8a75792c976eb5bfa6df4c020d898642684.zip
gl_shader_cache: Implement locker variants invalidation
Diffstat (limited to 'src/video_core/shader')
-rw-r--r--src/video_core/shader/const_buffer_locker.cpp28
-rw-r--r--src/video_core/shader/const_buffer_locker.h3
2 files changed, 19 insertions, 12 deletions
diff --git a/src/video_core/shader/const_buffer_locker.cpp b/src/video_core/shader/const_buffer_locker.cpp
index fda9e3c38..592bbf657 100644
--- a/src/video_core/shader/const_buffer_locker.cpp
+++ b/src/video_core/shader/const_buffer_locker.cpp
@@ -82,23 +82,27 @@ bool ConstBufferLocker::IsConsistent() const {
82 return false; 82 return false;
83 } 83 }
84 return std::all_of(keys.begin(), keys.end(), 84 return std::all_of(keys.begin(), keys.end(),
85 [](const auto& key) { 85 [this](const auto& pair) {
86 const auto [value, other_value] = key.first; 86 const auto [cbuf, offset] = pair.first;
87 return value == other_value; 87 const auto value = pair.second;
88 return value == engine->AccessConstBuffer32(stage, cbuf, offset);
88 }) && 89 }) &&
89 std::all_of(bound_samplers.begin(), bound_samplers.end(), 90 std::all_of(bound_samplers.begin(), bound_samplers.end(),
90 [this](const auto& sampler) { 91 [this](const auto& sampler) {
91 const auto [key, value] = sampler; 92 const auto [key, value] = sampler;
92 const auto other_value = engine->AccessBoundSampler(stage, key); 93 return value == engine->AccessBoundSampler(stage, key);
93 return value == other_value;
94 }) && 94 }) &&
95 std::all_of( 95 std::all_of(bindless_samplers.begin(), bindless_samplers.end(),
96 bindless_samplers.begin(), bindless_samplers.end(), [this](const auto& sampler) { 96 [this](const auto& sampler) {
97 const auto [cbuf, offset] = sampler.first; 97 const auto [cbuf, offset] = sampler.first;
98 const auto value = sampler.second; 98 const auto value = sampler.second;
99 const auto other_value = engine->AccessBindlessSampler(stage, cbuf, offset); 99 return value == engine->AccessBindlessSampler(stage, cbuf, offset);
100 return value == other_value; 100 });
101 }); 101}
102
103bool ConstBufferLocker::HasEqualKeys(const ConstBufferLocker& rhs) const {
104 return keys == rhs.keys && bound_samplers == rhs.bound_samplers &&
105 bindless_samplers == rhs.bindless_samplers;
102} 106}
103 107
104} // namespace VideoCommon::Shader 108} // namespace VideoCommon::Shader
diff --git a/src/video_core/shader/const_buffer_locker.h b/src/video_core/shader/const_buffer_locker.h
index 417d5a16f..966537fd6 100644
--- a/src/video_core/shader/const_buffer_locker.h
+++ b/src/video_core/shader/const_buffer_locker.h
@@ -44,6 +44,9 @@ public:
44 /// the same value, false otherwise; 44 /// the same value, false otherwise;
45 bool IsConsistent() const; 45 bool IsConsistent() const;
46 46
47 /// Returns true if the keys are equal to the other ones in the locker.
48 bool HasEqualKeys(const ConstBufferLocker& rhs) const;
49
47 /// Gives an getter to the const buffer keys in the database. 50 /// Gives an getter to the const buffer keys in the database.
48 const KeyMap& GetKeys() const { 51 const KeyMap& GetKeys() const {
49 return keys; 52 return keys;