GS/VK: Make sure layout changes are propagated to descriptors.

This commit is contained in:
TJnotJT
2026-05-18 08:41:26 +02:00
committed by lightningterror
parent 58a0ced8be
commit 534330aa99
+17 -1
View File
@@ -3611,6 +3611,8 @@ void GSDeviceVK::OMSetRenderTargets(
{ {
// need to update descriptors to reflect the new layout // need to update descriptors to reflect the new layout
m_dirty_flags |= (DIRTY_FLAG_TFX_TEXTURE_0 << TFX_TEXTURE_RT); m_dirty_flags |= (DIRTY_FLAG_TFX_TEXTURE_0 << TFX_TEXTURE_RT);
if (m_tfx_textures[TFX_TEXTURE_TEXTURE] == vkRt)
m_dirty_flags |= DIRTY_FLAG_TFX_TEXTURE_0 << TFX_TEXTURE_TEXTURE;
vkRt->TransitionToLayout(GSTextureVK::Layout::FeedbackLoop); vkRt->TransitionToLayout(GSTextureVK::Layout::FeedbackLoop);
} }
} }
@@ -3633,6 +3635,8 @@ void GSDeviceVK::OMSetRenderTargets(
if (vkDs->GetLayout() != GSTextureVK::Layout::FeedbackLoop) if (vkDs->GetLayout() != GSTextureVK::Layout::FeedbackLoop)
{ {
m_dirty_flags |= (DIRTY_FLAG_TFX_TEXTURE_0 << TFX_TEXTURE_DEPTH); m_dirty_flags |= (DIRTY_FLAG_TFX_TEXTURE_0 << TFX_TEXTURE_DEPTH);
if (m_tfx_textures[TFX_TEXTURE_TEXTURE] == vkDs)
m_dirty_flags |= DIRTY_FLAG_TFX_TEXTURE_0 << TFX_TEXTURE_TEXTURE;
vkDs->TransitionToLayout(GSTextureVK::Layout::FeedbackLoop); vkDs->TransitionToLayout(GSTextureVK::Layout::FeedbackLoop);
} }
} }
@@ -3641,6 +3645,8 @@ void GSDeviceVK::OMSetRenderTargets(
if (vkDs->GetLayout() != GSTextureVK::Layout::FeedbackLoop) if (vkDs->GetLayout() != GSTextureVK::Layout::FeedbackLoop)
{ {
m_dirty_flags |= (DIRTY_FLAG_TFX_TEXTURE_0 << TFX_TEXTURE_TEXTURE); m_dirty_flags |= (DIRTY_FLAG_TFX_TEXTURE_0 << TFX_TEXTURE_TEXTURE);
if (m_tfx_textures[TFX_TEXTURE_TEXTURE] == vkDs)
m_dirty_flags |= DIRTY_FLAG_TFX_TEXTURE_0 << TFX_TEXTURE_TEXTURE;
vkDs->TransitionToLayout(GSTextureVK::Layout::FeedbackLoop); vkDs->TransitionToLayout(GSTextureVK::Layout::FeedbackLoop);
} }
} }
@@ -5266,6 +5272,7 @@ void GSDeviceVK::SetLineWidth(float width)
void GSDeviceVK::PSSetShaderResource(int i, GSTexture* sr, bool check_state) void GSDeviceVK::PSSetShaderResource(int i, GSTexture* sr, bool check_state)
{ {
GSTextureVK* vkTex = static_cast<GSTextureVK*>(sr); GSTextureVK* vkTex = static_cast<GSTextureVK*>(sr);
bool update_layout = false;
if (vkTex) if (vkTex)
{ {
if (check_state) if (check_state)
@@ -5274,6 +5281,7 @@ void GSDeviceVK::PSSetShaderResource(int i, GSTexture* sr, bool check_state)
{ {
GL_INS("Ending render pass due to resource transition"); GL_INS("Ending render pass due to resource transition");
EndRenderPass(); EndRenderPass();
update_layout = true;
} }
vkTex->CommitClear(); vkTex->CommitClear();
@@ -5286,7 +5294,7 @@ void GSDeviceVK::PSSetShaderResource(int i, GSTexture* sr, bool check_state)
vkTex = m_null_texture.get(); vkTex = m_null_texture.get();
} }
if (m_tfx_textures[i] == vkTex) if (m_tfx_textures[i] == vkTex && !update_layout)
return; return;
m_tfx_textures[i] = vkTex; m_tfx_textures[i] = vkTex;
@@ -6022,11 +6030,19 @@ void GSDeviceVK::RenderHW(GSHWDrawConfig& config)
pxAssertMsg(m_features.texture_barrier, "Texture barriers enabled"); pxAssertMsg(m_features.texture_barrier, "Texture barriers enabled");
PSSetShaderResource(TFX_TEXTURE_RT, draw_rt, false); PSSetShaderResource(TFX_TEXTURE_RT, draw_rt, false);
} }
else
{
PSSetShaderResource(TFX_TEXTURE_RT, nullptr, false); // Unbind to avoid layout conflicts
}
if (pipe.IsDepthFeedbackLoop()) if (pipe.IsDepthFeedbackLoop())
{ {
pxAssertMsg(m_features.texture_barrier, "Texture barriers enabled"); pxAssertMsg(m_features.texture_barrier, "Texture barriers enabled");
PSSetShaderResource(TFX_TEXTURE_DEPTH, draw_ds, false); PSSetShaderResource(TFX_TEXTURE_DEPTH, draw_ds, false);
} }
else
{
PSSetShaderResource(TFX_TEXTURE_DEPTH, nullptr, false); // Unbind to avoid layout conflicts
}
// Begin render pass if new target or out of the area. // Begin render pass if new target or out of the area.
if (!InRenderPass()) if (!InRenderPass())
{ {