D3D: Moved setting texture by slot mask into StateManager
This commit is contained in:
parent
764aee6995
commit
5688c27610
|
@ -215,6 +215,17 @@ u32 StateManager::UnsetTexture(ID3D11ShaderResourceView* srv)
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StateManager::SetTextureByMask(u32 textureSlotMask, ID3D11ShaderResourceView* srv)
|
||||||
|
{
|
||||||
|
while (textureSlotMask)
|
||||||
|
{
|
||||||
|
unsigned long index;
|
||||||
|
_BitScanForward(&index, textureSlotMask);
|
||||||
|
SetTexture(index, srv);
|
||||||
|
textureSlotMask &= ~(1 << index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace D3D
|
} // namespace D3D
|
||||||
|
|
||||||
ID3D11SamplerState* StateCache::Get(SamplerState state)
|
ID3D11SamplerState* StateCache::Get(SamplerState state)
|
||||||
|
|
|
@ -235,7 +235,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// removes currently set texture from all slots, returns mask of previously bound slots
|
// removes currently set texture from all slots, returns mask of previously bound slots
|
||||||
u32 StateManager::UnsetTexture(ID3D11ShaderResourceView* srv);
|
u32 UnsetTexture(ID3D11ShaderResourceView* srv);
|
||||||
|
void SetTextureByMask(u32 textureSlotMask, ID3D11ShaderResourceView* srv);
|
||||||
|
|
||||||
// call this immediately before any drawing operation or to explicitly apply pending resource state changes
|
// call this immediately before any drawing operation or to explicitly apply pending resource state changes
|
||||||
void Apply();
|
void Apply();
|
||||||
|
|
|
@ -174,13 +174,7 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
|
||||||
g_renderer->RestoreAPIState();
|
g_renderer->RestoreAPIState();
|
||||||
|
|
||||||
// Restore old texture in all previously used slots, if any
|
// Restore old texture in all previously used slots, if any
|
||||||
while (textureSlotMask)
|
D3D::stateman->SetTextureByMask(textureSlotMask, texture->GetSRV());
|
||||||
{
|
|
||||||
unsigned long index;
|
|
||||||
_BitScanForward(&index, textureSlotMask);
|
|
||||||
D3D::stateman->SetTexture(index, texture->GetSRV());
|
|
||||||
textureSlotMask &= ~(1 << index);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_ActiveConfig.bCopyEFBToTexture)
|
if (!g_ActiveConfig.bCopyEFBToTexture)
|
||||||
|
|
Loading…
Reference in New Issue