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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

48 lines
1.1 KiB
C++
Raw Normal View History

2015-05-24 06:32:32 +02:00
// Copyright 2013 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
2015-05-24 06:32:32 +02:00
#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 "VideoCommon/Constants.h"
2023-01-27 13:21:09 +13:00
#include "VideoCommon/RenderState.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();
2015-05-29 00:53:07 +02:00
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>, VideoCommon::MAX_PIXEL_SHADER_SAMPLERS>
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;
2019-05-05 23:48:12 +00:00
} // namespace OGL