mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
D3D: Make state cache part of Renderer and not static
This commit is contained in:
@ -263,6 +263,21 @@ void StateManager::SetTextureByMask(u32 textureSlotMask, ID3D11ShaderResourceVie
|
||||
|
||||
} // namespace D3D
|
||||
|
||||
StateCache::~StateCache()
|
||||
{
|
||||
for (auto& it : m_depth)
|
||||
SAFE_RELEASE(it.second);
|
||||
|
||||
for (auto& it : m_raster)
|
||||
SAFE_RELEASE(it.second);
|
||||
|
||||
for (auto& it : m_blend)
|
||||
SAFE_RELEASE(it.second);
|
||||
|
||||
for (auto& it : m_sampler)
|
||||
SAFE_RELEASE(it.second);
|
||||
}
|
||||
|
||||
ID3D11SamplerState* StateCache::Get(SamplerState state)
|
||||
{
|
||||
auto it = m_sampler.find(state.hex);
|
||||
@ -471,33 +486,6 @@ ID3D11DepthStencilState* StateCache::Get(DepthState state)
|
||||
return res;
|
||||
}
|
||||
|
||||
void StateCache::Clear()
|
||||
{
|
||||
for (auto it : m_depth)
|
||||
{
|
||||
SAFE_RELEASE(it.second);
|
||||
}
|
||||
m_depth.clear();
|
||||
|
||||
for (auto it : m_raster)
|
||||
{
|
||||
SAFE_RELEASE(it.second);
|
||||
}
|
||||
m_raster.clear();
|
||||
|
||||
for (auto it : m_blend)
|
||||
{
|
||||
SAFE_RELEASE(it.second);
|
||||
}
|
||||
m_blend.clear();
|
||||
|
||||
for (auto it : m_sampler)
|
||||
{
|
||||
SAFE_RELEASE(it.second);
|
||||
}
|
||||
m_sampler.clear();
|
||||
}
|
||||
|
||||
D3D11_PRIMITIVE_TOPOLOGY StateCache::GetPrimitiveTopology(PrimitiveType primitive)
|
||||
{
|
||||
static constexpr std::array<D3D11_PRIMITIVE_TOPOLOGY, 4> primitives = {
|
||||
|
Reference in New Issue
Block a user