copy changes from feedback_loop_fewer_barriers, again more validations errors but seems to make more sense this way

This commit is contained in:
goeiecool9999 2025-12-28 20:41:49 +01:00
parent 55bc72fb34
commit c0810797e1

View File

@ -1010,14 +1010,13 @@ bool VulkanRenderer::sync_isInputTexturesSyncRequired()
{
bool required = false;
auto checkSync = [&](const VkDescriptorSetInfo* info) {
if (info)
if (!info)
return;
for (auto& tex : info->list_fboCandidates)
{
for (auto& tex : m_state.activeVertexDS->list_fboCandidates)
{
tex->m_vkFlushIndex_read = m_state.currentFlushIndex;
if (tex->m_vkFlushIndex_write == m_state.currentFlushIndex)
required = true;
}
tex->m_vkFlushIndex_read = m_state.currentFlushIndex;
if (tex->m_vkFlushIndex_write == m_state.currentFlushIndex)
required = true;
}
};
checkSync(m_state.activeVertexDS);
@ -1029,6 +1028,7 @@ bool VulkanRenderer::sync_isInputTexturesSyncRequired()
void VulkanRenderer::sync_RenderPassLoadTextures(CachedFBOVk* fboVk)
{
bool flushRequired = false;
for (auto& tex : fboVk->GetTextures())
{
LatteTextureVk* texVk = (LatteTextureVk*)tex;
@ -1036,26 +1036,28 @@ void VulkanRenderer::sync_RenderPassLoadTextures(CachedFBOVk* fboVk)
//RAW / WAW
if (texVk->m_vkFlushIndex_write == m_state.currentFlushIndex)
flushRequired = true;
//WAR
if (texVk->m_vkFlushIndex_read == m_state.currentFlushIndex)
flushRequired = true;
texVk->m_vkFlushIndex_read = m_state.currentFlushIndex;
}
if (flushRequired)
sync_performFlushBarrier();
for (auto& tex : fboVk->GetTextures())
{
LatteTextureVk* texVk = (LatteTextureVk*)tex;
texVk->m_vkFlushIndex_read = m_state.currentFlushIndex;
}
}
void VulkanRenderer::sync_RenderPassStoreTextures(CachedFBOVk* fboVk)
{
bool flushRequired = false;
for (auto& tex : fboVk->GetTextures())
{
LatteTextureVk* texVk = (LatteTextureVk*)tex;
//WAR
if (texVk->m_vkFlushIndex_read == m_state.currentFlushIndex)
flushRequired = true;
texVk->m_vkFlushIndex_write = m_state.currentFlushIndex;
}
if (flushRequired)
sync_performFlushBarrier();
}
void VulkanRenderer::draw_prepareDescriptorSets(PipelineInfo* pipeline_info, VkDescriptorSetInfo*& vertexDS, VkDescriptorSetInfo*& pixelDS, VkDescriptorSetInfo*& geometryDS)
@ -1138,9 +1140,9 @@ void VulkanRenderer::draw_setRenderPass()
}
draw_endRenderPass();
sync_RenderPassLoadTextures(fboVk);
if (sync_isInputTexturesSyncRequired())
sync_performFlushBarrier();
sync_RenderPassLoadTextures(fboVk);
if (m_featureControl.deviceExtensions.dynamic_rendering)
{