From bb20b145a88dac28f008e5a240e024d905f26756 Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Mon, 13 Feb 2023 17:51:30 +0000 Subject: [PATCH] Hash subpass dependencies in RP cache --- .../skyline/gpu/cache/renderpass_cache.cpp | 27 ++++++++++++++++++- .../cpp/skyline/gpu/cache/renderpass_cache.h | 1 + 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/app/src/main/cpp/skyline/gpu/cache/renderpass_cache.cpp b/app/src/main/cpp/skyline/gpu/cache/renderpass_cache.cpp index 24c5c191..ea2830c1 100644 --- a/app/src/main/cpp/skyline/gpu/cache/renderpass_cache.cpp +++ b/app/src/main/cpp/skyline/gpu/cache/renderpass_cache.cpp @@ -23,7 +23,8 @@ namespace skyline::gpu::cache { RenderPassCache::RenderPassMetadata::RenderPassMetadata(const vk::RenderPassCreateInfo &createInfo) : attachments{createInfo.pAttachments, createInfo.pAttachments + createInfo.attachmentCount}, - subpasses{createInfo.pSubpasses, createInfo.pSubpasses + createInfo.subpassCount} {} + subpasses{createInfo.pSubpasses, createInfo.pSubpasses + createInfo.subpassCount}, + dependencies{createInfo.pDependencies, createInfo.pDependencies + createInfo.dependencyCount} {} #define HASH(x) boost::hash_combine(hash, x) @@ -71,6 +72,17 @@ namespace skyline::gpu::cache { HASH(index); } + HASH(key.dependencies.size()); + for (const auto &dependency : key.dependencies) { + HASH(dependency.srcSubpass); + HASH(dependency.dstSubpass); + HASH(static_cast(dependency.dependencyFlags)); + HASH(static_cast(dependency.srcStageMask)); + HASH(static_cast(dependency.dstStageMask)); + HASH(static_cast(dependency.srcAccessMask)); + HASH(static_cast(dependency.dstAccessMask)); + } + return hash; } @@ -119,6 +131,17 @@ namespace skyline::gpu::cache { HASH(index); } + HASH(key.dependencyCount); + for (const auto &dependency : span{key.pDependencies, key.dependencyCount}) { + HASH(dependency.srcSubpass); + HASH(dependency.dstSubpass); + HASH(static_cast(dependency.dependencyFlags)); + HASH(static_cast(dependency.srcStageMask)); + HASH(static_cast(dependency.dstStageMask)); + HASH(static_cast(dependency.srcAccessMask)); + HASH(static_cast(dependency.dstAccessMask)); + } + return hash; } @@ -157,6 +180,8 @@ namespace skyline::gpu::cache { vkSubpass++; } + RETARRNEQ(lhs.dependencies, rhs.pDependencies, rhs.dependencyCount) + #undef RETF return true; diff --git a/app/src/main/cpp/skyline/gpu/cache/renderpass_cache.h b/app/src/main/cpp/skyline/gpu/cache/renderpass_cache.h index 8a854581..c6cdeda7 100644 --- a/app/src/main/cpp/skyline/gpu/cache/renderpass_cache.h +++ b/app/src/main/cpp/skyline/gpu/cache/renderpass_cache.h @@ -38,6 +38,7 @@ namespace skyline::gpu::cache { struct RenderPassMetadata { std::vector attachments; std::vector subpasses; + std::vector dependencies; RenderPassMetadata(const vk::RenderPassCreateInfo &createInfo);