Hash subpass dependencies in RP cache

This commit is contained in:
Billy Laws 2023-02-13 17:51:30 +00:00
parent 99bf7dbb36
commit bb20b145a8
2 changed files with 27 additions and 1 deletions

View File

@ -23,7 +23,8 @@ namespace skyline::gpu::cache {
RenderPassCache::RenderPassMetadata::RenderPassMetadata(const vk::RenderPassCreateInfo &createInfo) RenderPassCache::RenderPassMetadata::RenderPassMetadata(const vk::RenderPassCreateInfo &createInfo)
: attachments{createInfo.pAttachments, createInfo.pAttachments + createInfo.attachmentCount}, : 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) #define HASH(x) boost::hash_combine(hash, x)
@ -71,6 +72,17 @@ namespace skyline::gpu::cache {
HASH(index); HASH(index);
} }
HASH(key.dependencies.size());
for (const auto &dependency : key.dependencies) {
HASH(dependency.srcSubpass);
HASH(dependency.dstSubpass);
HASH(static_cast<VkDependencyFlags>(dependency.dependencyFlags));
HASH(static_cast<VkPipelineStageFlags>(dependency.srcStageMask));
HASH(static_cast<VkPipelineStageFlags>(dependency.dstStageMask));
HASH(static_cast<VkAccessFlags>(dependency.srcAccessMask));
HASH(static_cast<VkAccessFlags>(dependency.dstAccessMask));
}
return hash; return hash;
} }
@ -119,6 +131,17 @@ namespace skyline::gpu::cache {
HASH(index); HASH(index);
} }
HASH(key.dependencyCount);
for (const auto &dependency : span<const vk::SubpassDependency>{key.pDependencies, key.dependencyCount}) {
HASH(dependency.srcSubpass);
HASH(dependency.dstSubpass);
HASH(static_cast<VkDependencyFlags>(dependency.dependencyFlags));
HASH(static_cast<VkPipelineStageFlags>(dependency.srcStageMask));
HASH(static_cast<VkPipelineStageFlags>(dependency.dstStageMask));
HASH(static_cast<VkAccessFlags>(dependency.srcAccessMask));
HASH(static_cast<VkAccessFlags>(dependency.dstAccessMask));
}
return hash; return hash;
} }
@ -157,6 +180,8 @@ namespace skyline::gpu::cache {
vkSubpass++; vkSubpass++;
} }
RETARRNEQ(lhs.dependencies, rhs.pDependencies, rhs.dependencyCount)
#undef RETF #undef RETF
return true; return true;

View File

@ -38,6 +38,7 @@ namespace skyline::gpu::cache {
struct RenderPassMetadata { struct RenderPassMetadata {
std::vector<vk::AttachmentDescription> attachments; std::vector<vk::AttachmentDescription> attachments;
std::vector<SubpassDescription> subpasses; std::vector<SubpassDescription> subpasses;
std::vector<vk::SubpassDependency> dependencies;
RenderPassMetadata(const vk::RenderPassCreateInfo &createInfo); RenderPassMetadata(const vk::RenderPassCreateInfo &createInfo);