mirror of
https://github.com/cemu-project/Cemu.git
synced 2026-04-12 03:11:27 -06:00
Also check RAW hazards on descriptor images and mark them as read at the start of render pass
This commit is contained in:
parent
a8ddc1008d
commit
6e4d311ffc
@ -3222,6 +3222,14 @@ void VulkanRenderer::ProcessDestructionQueue()
|
||||
m_spinlockDestructionQueue.unlock();
|
||||
}
|
||||
|
||||
void VkDescriptorSetInfo::ForEachView(const std::function<void(LatteTextureViewVk*)>& fun)
|
||||
{
|
||||
for (auto& view : list_referencedViews)
|
||||
{
|
||||
fun(view);
|
||||
}
|
||||
}
|
||||
|
||||
VkDescriptorSetInfo::~VkDescriptorSetInfo()
|
||||
{
|
||||
for (auto& it : list_referencedViews)
|
||||
|
||||
@ -27,6 +27,8 @@ struct VkDescriptorSetInfo
|
||||
{
|
||||
VKRObjectDescriptorSet* m_vkObjDescriptorSet{};
|
||||
|
||||
void ForEachView(const std::function<void(LatteTextureViewVk*)>& fun);
|
||||
|
||||
~VkDescriptorSetInfo();
|
||||
|
||||
std::vector<LatteTextureViewVk*> list_referencedViews;
|
||||
|
||||
@ -1034,18 +1034,29 @@ void VulkanRenderer::sync_RenderPassLoadTextures(CachedFBOVk* fboVk)
|
||||
{
|
||||
bool flushRequired = false;
|
||||
|
||||
for (auto& tex : fboVk->GetTextures())
|
||||
{
|
||||
LatteTextureVk* texVk = (LatteTextureVk*)tex;
|
||||
|
||||
auto checkImageSyncHazard = [&](LatteTextureVk* texVk, bool isWrite = false) {
|
||||
//RAW / WAW
|
||||
if (texVk->m_vkFlushIndex_write == m_state.currentFlushIndex)
|
||||
flushRequired = true;
|
||||
//WAR
|
||||
if (texVk->m_vkFlushIndex_read == m_state.currentFlushIndex)
|
||||
if (isWrite && texVk->m_vkFlushIndex_read == m_state.currentFlushIndex)
|
||||
flushRequired = true;
|
||||
};
|
||||
|
||||
for (auto& tex : fboVk->GetTextures())
|
||||
checkImageSyncHazard((LatteTextureVk*)tex, true);
|
||||
|
||||
auto checkViewSync = [&](LatteTextureViewVk* view) {
|
||||
checkImageSyncHazard(view->GetBaseImage());
|
||||
};
|
||||
|
||||
if (m_state.activeVertexDS)
|
||||
m_state.activeVertexDS->ForEachView(checkViewSync);
|
||||
if (m_state.activeGeometryDS)
|
||||
m_state.activeGeometryDS->ForEachView(checkViewSync);
|
||||
if (m_state.activePixelDS)
|
||||
m_state.activePixelDS->ForEachView(checkViewSync);
|
||||
|
||||
}
|
||||
if (flushRequired)
|
||||
sync_performFlushBarrier();
|
||||
|
||||
@ -1054,6 +1065,19 @@ void VulkanRenderer::sync_RenderPassLoadTextures(CachedFBOVk* fboVk)
|
||||
LatteTextureVk* texVk = (LatteTextureVk*)tex;
|
||||
texVk->m_vkFlushIndex_read = m_state.currentFlushIndex;
|
||||
}
|
||||
|
||||
auto updateViewSync = [&](LatteTextureViewVk* view) {
|
||||
view->GetBaseImage()->m_vkFlushIndex_read = m_state.currentFlushIndex;
|
||||
};
|
||||
|
||||
if (m_state.activeVertexDS)
|
||||
m_state.activeVertexDS->ForEachView(updateViewSync);
|
||||
if (m_state.activeGeometryDS)
|
||||
m_state.activeGeometryDS->ForEachView(updateViewSync);
|
||||
if (m_state.activePixelDS)
|
||||
m_state.activePixelDS->ForEachView(updateViewSync);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void VulkanRenderer::sync_RenderPassStoreTextures(CachedFBOVk* fboVk)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user