D3D: State cache now reduces number of blend state permutations by collapsing some states that have blending disabled

This commit is contained in:
Yuriy O'Donnell 2014-10-16 18:27:43 +02:00
parent bea68c95a4
commit 9bdfd4a833
1 changed files with 8 additions and 0 deletions

View File

@ -172,6 +172,14 @@ ID3D11SamplerState* StateCache::Get(SamplerState state)
ID3D11BlendState* StateCache::Get(BlendState state) ID3D11BlendState* StateCache::Get(BlendState state)
{ {
if (!state.blend_enable)
{
state.src_blend = D3D11_BLEND_ONE;
state.dst_blend = D3D11_BLEND_ZERO;
state.blend_op = D3D11_BLEND_OP_ADD;
state.use_dst_alpha = false;
}
auto it = m_blend.find(state.packed); auto it = m_blend.find(state.packed);
if (it != m_blend.end()) if (it != m_blend.end())