mirror of https://github.com/PCSX2/pcsx2.git
GS/Vulkan: Ensure we don't leave a bound texture in copy state
Causes the validation layer to get angry, even though it's not used.
This commit is contained in:
parent
1067714c2c
commit
f836fe2056
|
@ -449,6 +449,8 @@ void GSDevice12::CopyRect(GSTexture* sTex, GSTexture* dTex, const GSVector4i& r,
|
|||
|
||||
sTexVK->TransitionToState(D3D12_RESOURCE_STATE_COPY_SOURCE);
|
||||
sTexVK->SetUsedThisCommandBuffer();
|
||||
if (m_tfx_textures[0] && sTexVK->GetSRVDescriptor() == m_tfx_textures[0])
|
||||
PSSetShaderResource(0, nullptr, false);
|
||||
|
||||
dTexVK->TransitionToState(D3D12_RESOURCE_STATE_COPY_DEST);
|
||||
dTexVK->SetUsedThisCommandBuffer();
|
||||
|
@ -2457,6 +2459,7 @@ void GSDevice12::RenderHW(GSHWDrawConfig& config)
|
|||
}
|
||||
if (config.pal)
|
||||
PSSetShaderResource(1, config.pal, true);
|
||||
|
||||
if (config.blend.constant_enable)
|
||||
SetBlendConstants(config.blend.constant);
|
||||
|
||||
|
@ -2538,7 +2541,9 @@ void GSDevice12::RenderHW(GSHWDrawConfig& config)
|
|||
}
|
||||
}
|
||||
|
||||
if (config.tex && config.tex == config.ds)
|
||||
if (config.tex)
|
||||
{
|
||||
if (config.tex == config.ds)
|
||||
{
|
||||
// requires a copy of the depth buffer. this is mainly for ico.
|
||||
copy_ds = static_cast<GSTexture12*>(CreateDepthStencil(rtsize.x, rtsize.y, GSTexture::Format::DepthStencil, false));
|
||||
|
@ -2555,6 +2560,14 @@ void GSDevice12::RenderHW(GSHWDrawConfig& config)
|
|||
PSSetShaderResource(0, copy_ds, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
// clear texture binding when it's bound to RT or DS
|
||||
else if (m_tfx_textures[0] &&
|
||||
((config.rt && static_cast<GSTexture12*>(config.rt)->GetSRVDescriptor() == m_tfx_textures[0]) ||
|
||||
(config.ds && static_cast<GSTexture12*>(config.ds)->GetSRVDescriptor() == m_tfx_textures[0])))
|
||||
{
|
||||
PSSetShaderResource(0, nullptr, false);
|
||||
}
|
||||
|
||||
// avoid restarting the render pass just to switch from rt+depth to rt and vice versa
|
||||
if (m_in_render_pass && !hdr_rt && !draw_ds && m_current_depth_target && m_current_render_target == draw_rt && config.tex != m_current_depth_target)
|
||||
|
|
|
@ -553,9 +553,14 @@ void GSDeviceVK::CopyRect(GSTexture* sTex, GSTexture* dTex, const GSVector4i& r,
|
|||
|
||||
dTexVK->TransitionToLayout(VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
|
||||
dTexVK->SetUsedThisCommandBuffer();
|
||||
|
||||
sTexVK->TransitionToLayout(VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
|
||||
sTexVK->SetUsedThisCommandBuffer();
|
||||
|
||||
// ensure we don't leave this bound later on
|
||||
if (m_tfx_textures[0] == sTexVK->GetView())
|
||||
PSSetShaderResource(0, nullptr, false);
|
||||
|
||||
vkCmdCopyImage(g_vulkan_context->GetCurrentCommandBuffer(), sTexVK->GetImage(),
|
||||
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, dTexVK->GetImage(), VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &ic);
|
||||
|
||||
|
@ -712,14 +717,15 @@ void GSDeviceVK::BlitRect(GSTexture* sTex, const GSVector4i& sRect, u32 sLevel,
|
|||
GSTextureVK* sTexVK = static_cast<GSTextureVK*>(sTex);
|
||||
GSTextureVK* dTexVK = static_cast<GSTextureVK*>(dTex);
|
||||
|
||||
//const VkImageLayout old_src_layout = sTexVK->GetTexture().GetLayout();
|
||||
//const VkImageLayout old_dst_layout = dTexVK->GetTexture().GetLayout();
|
||||
|
||||
EndRenderPass();
|
||||
|
||||
sTexVK->TransitionToLayout(VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
|
||||
dTexVK->TransitionToLayout(VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
|
||||
|
||||
// ensure we don't leave this bound later on
|
||||
if (m_tfx_textures[0] == sTexVK->GetView())
|
||||
PSSetShaderResource(0, nullptr, false);
|
||||
|
||||
pxAssert(
|
||||
(sTexVK->GetType() == GSTexture::Type::DepthStencil) == (dTexVK->GetType() == GSTexture::Type::DepthStencil));
|
||||
const VkImageAspectFlags aspect =
|
||||
|
@ -2885,6 +2891,7 @@ void GSDeviceVK::RenderHW(GSHWDrawConfig& config)
|
|||
}
|
||||
if (config.pal)
|
||||
PSSetShaderResource(1, config.pal, true);
|
||||
|
||||
if (config.blend.constant_enable)
|
||||
SetBlendConstants(config.blend.constant);
|
||||
|
||||
|
|
Loading…
Reference in New Issue