summaryrefslogtreecommitdiffstats
path: root/src/video_core/shader/const_buffer_locker.h
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2019-09-26 00:19:41 +0200
committerFernandoS27 <fsahmkow27@gmail.com>2019-10-25 15:01:31 +0200
commitfa2c297f3eddc718123767142dbc296270f58f7a (patch)
tree27aca17aa5abec9743aeb69399a2cac67df9903e /src/video_core/shader/const_buffer_locker.h
parentgl_shader_decompiler: Move entries to a separate function (diff)
downloadyuzu-fa2c297f3eddc718123767142dbc296270f58f7a.tar
yuzu-fa2c297f3eddc718123767142dbc296270f58f7a.tar.gz
yuzu-fa2c297f3eddc718123767142dbc296270f58f7a.tar.bz2
yuzu-fa2c297f3eddc718123767142dbc296270f58f7a.tar.lz
yuzu-fa2c297f3eddc718123767142dbc296270f58f7a.tar.xz
yuzu-fa2c297f3eddc718123767142dbc296270f58f7a.tar.zst
yuzu-fa2c297f3eddc718123767142dbc296270f58f7a.zip
Diffstat (limited to 'src/video_core/shader/const_buffer_locker.h')
-rw-r--r--src/video_core/shader/const_buffer_locker.h76
1 files changed, 23 insertions, 53 deletions
diff --git a/src/video_core/shader/const_buffer_locker.h b/src/video_core/shader/const_buffer_locker.h
index 54459977f..417d5a16f 100644
--- a/src/video_core/shader/const_buffer_locker.h
+++ b/src/video_core/shader/const_buffer_locker.h
@@ -23,78 +23,48 @@ public:
explicit ConstBufferLocker(Tegra::Engines::ShaderType shader_stage,
Tegra::Engines::ConstBufferEngineInterface& engine);
- // Checks if an engine is setup, it may be possible that during disk shader
- // cache run, the engines have not been created yet.
- bool IsEngineSet() const;
-
- // Use this to set/change the engine used for this shader.
- void SetEngine(Tegra::Engines::ConstBufferEngineInterface& engine);
-
- // Retrieves a key from the locker, if it's registered, it will give the
- // registered value, if not it will obtain it from maxwell3d and register it.
+ /// Retrieves a key from the locker, if it's registered, it will give the registered value, if
+ /// not it will obtain it from maxwell3d and register it.
std::optional<u32> ObtainKey(u32 buffer, u32 offset);
std::optional<Tegra::Engines::SamplerDescriptor> ObtainBoundSampler(u32 offset);
std::optional<Tegra::Engines::SamplerDescriptor> ObtainBindlessSampler(u32 buffer, u32 offset);
- // Manually inserts a key.
+ /// Inserts a key.
void InsertKey(u32 buffer, u32 offset, u32 value);
+ /// Inserts a bound sampler key.
void InsertBoundSampler(u32 offset, Tegra::Engines::SamplerDescriptor sampler);
+ /// Inserts a bindless sampler key.
void InsertBindlessSampler(u32 buffer, u32 offset, Tegra::Engines::SamplerDescriptor sampler);
- // Retrieves the number of keys registered.
- std::size_t NumKeys() const {
- if (!keys) {
- return 0;
- }
- return keys->size();
- }
-
- std::size_t NumBoundSamplers() const {
- if (!bound_samplers) {
- return 0;
- }
- return bound_samplers->size();
- }
-
- std::size_t NumBindlessSamplers() const {
- if (!bindless_samplers) {
- return 0;
- }
- return bindless_samplers->size();
- }
+ /// Checks keys and samplers against engine's current const buffers. Returns true if they are
+ /// the same value, false otherwise;
+ bool IsConsistent() const;
- // Gives an accessor to the key's database.
- // Pre: NumKeys > 0
- const KeyMap& AccessKeys() const {
- return *keys;
+ /// Gives an getter to the const buffer keys in the database.
+ const KeyMap& GetKeys() const {
+ return keys;
}
- // Gives an accessor to the sampler's database.
- // Pre: NumBindlessSamplers > 0
- const BoundSamplerMap& AccessBoundSamplers() const {
- return *bound_samplers;
+ /// Gets samplers database.
+ const BoundSamplerMap& GetBoundSamplers() const {
+ return bound_samplers;
}
- // Gives an accessor to the sampler's database.
- // Pre: NumBindlessSamplers > 0
- const BindlessSamplerMap& AccessBindlessSamplers() const {
- return *bindless_samplers;
+ /// Gets bindless samplers database.
+ const BindlessSamplerMap& GetBindlessSamplers() const {
+ return bindless_samplers;
}
- // Checks keys & samplers against engine's current const buffers. Returns true if they
- // are the same value, false otherwise;
- bool IsConsistent() const;
-
private:
- Tegra::Engines::ConstBufferEngineInterface* engine;
- Tegra::Engines::ShaderType shader_stage;
- // All containers are lazy initialized as most shaders don't use them.
- std::shared_ptr<KeyMap> keys{};
- std::shared_ptr<BoundSamplerMap> bound_samplers{};
- std::shared_ptr<BindlessSamplerMap> bindless_samplers{};
+ const Tegra::Engines::ShaderType stage;
+ Tegra::Engines::ConstBufferEngineInterface* engine = nullptr;
+ KeyMap keys;
+ BoundSamplerMap bound_samplers;
+ BindlessSamplerMap bindless_samplers;
};
+
} // namespace VideoCommon::Shader