diff --git a/src/util/d3d11_texture.cpp b/src/util/d3d11_texture.cpp index f7cb6ae61..b015d572e 100644 --- a/src/util/d3d11_texture.cpp +++ b/src/util/d3d11_texture.cpp @@ -126,7 +126,7 @@ void D3D11Texture::CommitClear(ID3D11DeviceContext1* context) else context->ClearDepthStencilView(GetD3DDSV(), D3D11_CLEAR_DEPTH, GetClearDepth(), 0); } - else if (IsRenderTarget()) + else if (IsRenderTarget() || IsRWTexture()) { if (m_state == GPUTexture::State::Invalidated) context->DiscardView(GetD3DRTV()); diff --git a/src/util/d3d12_device.cpp b/src/util/d3d12_device.cpp index 6b7301579..d3395e7b1 100644 --- a/src/util/d3d12_device.cpp +++ b/src/util/d3d12_device.cpp @@ -1417,7 +1417,7 @@ void D3D12Device::ClearDepth(GPUTexture* t, float d) void D3D12Device::InvalidateRenderTarget(GPUTexture* t) { GPUDevice::InvalidateRenderTarget(t); - if (InRenderPass() && (t->IsRenderTarget() ? IsRenderTargetBound(t) : (m_current_depth_target == t))) + if (InRenderPass() && (t->IsDepthStencil() ? (m_current_depth_target == t) : IsRenderTargetBound(t))) EndRenderPass(); } @@ -2077,7 +2077,7 @@ void D3D12Device::UnbindTexture(D3D12Texture* tex) } } - if (tex->IsRenderTarget()) + if (tex->IsRenderTarget() || tex->IsRWTexture()) { for (u32 i = 0; i < m_num_current_render_targets; i++) { diff --git a/src/util/vulkan_device.cpp b/src/util/vulkan_device.cpp index b4848c842..67e39fd5e 100644 --- a/src/util/vulkan_device.cpp +++ b/src/util/vulkan_device.cpp @@ -2823,10 +2823,10 @@ void VulkanDevice::ClearDepth(GPUTexture* t, float d) void VulkanDevice::InvalidateRenderTarget(GPUTexture* t) { GPUDevice::InvalidateRenderTarget(t); - if (InRenderPass() && (t->IsRenderTarget() ? (IsRenderTargetBoundIndex(t) >= 0) : (m_current_depth_target == t))) + if (InRenderPass() && (t->IsDepthStencil() ? (m_current_depth_target == t) : (IsRenderTargetBoundIndex(t) >= 0))) { // Invalidate includes leaving whatever's in the current buffer. - GL_INS_FMT("Invalidating current {}", t->IsRenderTarget() ? "RT" : "DS"); + GL_INS_FMT("Invalidating current {}", t->IsDepthStencil() ? "DS" : "RT"); t->SetState(GPUTexture::State::Dirty); } } @@ -3760,7 +3760,7 @@ void VulkanDevice::UnbindTexture(VulkanTexture* tex) } } - if (tex->IsRenderTarget()) + if (tex->IsRenderTarget() || tex->IsDepthStencil()) { for (u32 i = 0; i < m_num_current_render_targets; i++) {