summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/OGL/SamplerCache.h
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2017-09-09 18:30:15 +1000
committerStenzek <stenzek@gmail.com>2017-09-11 20:01:54 +1000
commit24ddea04ce3c843dd1de3d34d775e9a49d195225 (patch)
tree5fb17c3d07988499767c51908b49dac2d8d9c881 /Source/Core/VideoBackends/OGL/SamplerCache.h
parent340aabbb06404481b8a496f506ebc9bae75fad6c (diff)
VideoBackends: Move SamplerState to common
Diffstat (limited to 'Source/Core/VideoBackends/OGL/SamplerCache.h')
-rw-r--r--Source/Core/VideoBackends/OGL/SamplerCache.h45
1 files changed, 9 insertions, 36 deletions
diff --git a/Source/Core/VideoBackends/OGL/SamplerCache.h b/Source/Core/VideoBackends/OGL/SamplerCache.h
index c6bd76dae1..7b437e326b 100644
--- a/Source/Core/VideoBackends/OGL/SamplerCache.h
+++ b/Source/Core/VideoBackends/OGL/SamplerCache.h
@@ -4,6 +4,7 @@
#pragma once
+#include <array>
#include <map>
#include <memory>
@@ -24,49 +25,21 @@ public:
SamplerCache(SamplerCache&&) = delete;
SamplerCache& operator=(SamplerCache&&) = delete;
- void SetSamplerState(int stage, const TexMode0& tm0, const TexMode1& tm1, bool custom_tex);
+ void SetSamplerState(u32 stage, const SamplerState& state);
+ void InvalidateBinding(u32 stage);
+
void Clear();
void BindNearestSampler(int stage);
void BindLinearSampler(int stage);
private:
- struct Params
- {
- union
- {
- struct
- {
- TexMode0 tm0;
- TexMode1 tm1;
- };
-
- u64 hex;
- };
-
- Params() : hex() {}
- Params(const TexMode0& _tm0, const TexMode1& _tm1) : tm0(_tm0), tm1(_tm1)
- {
- static_assert(sizeof(Params) == 8, "Assuming I can treat this as a 64bit int.");
- }
-
- bool operator<(const Params& other) const { return hex < other.hex; }
- bool operator!=(const Params& other) const { return hex != other.hex; }
- };
-
- struct Value
- {
- Value() : sampler_id() {}
- GLuint sampler_id;
- };
-
- void SetParameters(GLuint sampler_id, const Params& params);
- Value& GetEntry(const Params& params);
+ static void SetParameters(GLuint sampler_id, const SamplerState& params);
- std::map<Params, Value> m_cache;
- std::pair<Params, Value> m_active_samplers[8];
+ std::map<SamplerState, GLuint> m_cache;
+ std::array<std::pair<SamplerState, GLuint>, 8> m_active_samplers{};
- int m_last_max_anisotropy;
- u32 m_sampler_id[2];
+ GLuint m_point_sampler;
+ GLuint m_linear_sampler;
};
extern std::unique_ptr<SamplerCache> g_sampler_cache;