Files
dolphin/Source/Core/VideoBackends/OGL/SamplerCache.h
T

47 lines
1.0 KiB
C++
Raw Normal View History

2015-05-24 06:32:32 +02:00
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
2017-09-09 18:30:15 +10:00
#include <array>
#include <map>
#include <memory>
2015-09-26 16:13:54 -04:00
#include "Common/CommonTypes.h"
#include "Common/GL/GLUtil.h"
#include "VideoBackends/OGL/Render.h"
namespace OGL
{
2017-08-04 23:57:12 +02:00
class SamplerCache
{
public:
SamplerCache();
~SamplerCache();
2017-08-04 23:57:12 +02:00
SamplerCache(const SamplerCache&) = delete;
SamplerCache& operator=(const SamplerCache&) = delete;
SamplerCache(SamplerCache&&) = delete;
SamplerCache& operator=(SamplerCache&&) = delete;
2017-09-09 18:30:15 +10:00
void SetSamplerState(u32 stage, const SamplerState& state);
void InvalidateBinding(u32 stage);
void Clear();
void BindNearestSampler(int stage);
void BindLinearSampler(int stage);
private:
2017-09-09 18:30:15 +10:00
static void SetParameters(GLuint sampler_id, const SamplerState& params);
2017-09-09 18:30:15 +10:00
std::map<SamplerState, GLuint> m_cache;
std::array<std::pair<SamplerState, GLuint>, 8> m_active_samplers{};
2017-09-09 18:30:15 +10:00
GLuint m_point_sampler;
GLuint m_linear_sampler;
};
extern std::unique_ptr<SamplerCache> g_sampler_cache;
}