diff options
Diffstat (limited to 'src/gpu/sampler_cache.h')
| -rw-r--r-- | src/gpu/sampler_cache.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/gpu/sampler_cache.h b/src/gpu/sampler_cache.h index 5df3958..7149921 100644 --- a/src/gpu/sampler_cache.h +++ b/src/gpu/sampler_cache.h @@ -16,10 +16,14 @@ struct SamplerSpec { uint16_t anisotropy; bool operator<(const SamplerSpec& o) const { - if (u != o.u) return u < o.u; - if (v != o.v) return v < o.v; - if (mag != o.mag) return mag < o.mag; - if (min != o.min) return min < o.min; + if (u != o.u) + return u < o.u; + if (v != o.v) + return v < o.v; + if (mag != o.mag) + return mag < o.mag; + if (min != o.min) + return min < o.min; return anisotropy < o.anisotropy; } }; @@ -28,7 +32,7 @@ class SamplerCache { std::map<SamplerSpec, WGPUSampler> cache_; SamplerCache() = default; -public: + public: static SamplerCache& Get() { static SamplerCache instance; return instance; @@ -36,7 +40,8 @@ public: WGPUSampler get_or_create(WGPUDevice device, const SamplerSpec& spec) { auto it = cache_.find(spec); - if (it != cache_.end()) return it->second; + if (it != cache_.end()) + return it->second; WGPUSamplerDescriptor desc{}; desc.addressModeU = spec.u; |
