D3D11Device: Fix redundant SRV set on RT change

This commit is contained in:
Stenzek 2024-06-01 17:33:01 +10:00
parent 05395c8c1a
commit 0675716162
No known key found for this signature in database

View file

@ -977,7 +977,7 @@ void D3D11Device::SetRenderTargets(GPUTexture* const* rts, u32 num_rts, GPUTextu
const ID3D11ShaderResourceView* srv = static_cast<D3D11Texture*>(ds)->GetD3DSRV(); const ID3D11ShaderResourceView* srv = static_cast<D3D11Texture*>(ds)->GetD3DSRV();
for (u32 i = 0; i < MAX_TEXTURE_SAMPLERS; i++) for (u32 i = 0; i < MAX_TEXTURE_SAMPLERS; i++)
{ {
if (m_current_textures[i] == srv) if (m_current_textures[i] && m_current_textures[i] == srv)
{ {
m_current_textures[i] = nullptr; m_current_textures[i] = nullptr;
m_context->PSSetShaderResources(i, 1, &m_current_textures[i]); m_context->PSSetShaderResources(i, 1, &m_current_textures[i]);
@ -996,7 +996,7 @@ void D3D11Device::SetRenderTargets(GPUTexture* const* rts, u32 num_rts, GPUTextu
const ID3D11ShaderResourceView* srv = dt->GetD3DSRV(); const ID3D11ShaderResourceView* srv = dt->GetD3DSRV();
for (u32 j = 0; j < MAX_TEXTURE_SAMPLERS; j++) for (u32 j = 0; j < MAX_TEXTURE_SAMPLERS; j++)
{ {
if (m_current_textures[j] == srv) if (m_current_textures[j] && m_current_textures[j] == srv)
{ {
m_current_textures[j] = nullptr; m_current_textures[j] = nullptr;
m_context->PSSetShaderResources(j, 1, &m_current_textures[j]); m_context->PSSetShaderResources(j, 1, &m_current_textures[j]);