Commit 50070481 by Shahbaz Youssefi Committed by Commit Bot

Vulkan: Render pass creation cleanup

Bug: angleproject:4836 Change-Id: If7b0beef4b32149bebb0f63558ac34d0c3cd79c7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2444098 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarTim Van Patten <timvp@google.com>
parent c5494728
...@@ -736,6 +736,8 @@ angle::Result InitializeRenderPassFromDesc(Context *context, ...@@ -736,6 +736,8 @@ angle::Result InitializeRenderPassFromDesc(Context *context,
const AttachmentOpsArray &ops, const AttachmentOpsArray &ops,
RenderPass *renderPass) RenderPass *renderPass)
{ {
RendererVk *renderer = context->getRenderer();
constexpr VkAttachmentReference kUnusedAttachment = {VK_ATTACHMENT_UNUSED, constexpr VkAttachmentReference kUnusedAttachment = {VK_ATTACHMENT_UNUSED,
VK_IMAGE_LAYOUT_UNDEFINED}; VK_IMAGE_LAYOUT_UNDEFINED};
constexpr VkAttachmentReference2 kUnusedAttachment2 = { constexpr VkAttachmentReference2 kUnusedAttachment2 = {
...@@ -751,6 +753,9 @@ angle::Result InitializeRenderPassFromDesc(Context *context, ...@@ -751,6 +753,9 @@ angle::Result InitializeRenderPassFromDesc(Context *context,
// The list of attachments includes all non-resolve and resolve attachments. // The list of attachments includes all non-resolve and resolve attachments.
FramebufferAttachmentArray<VkAttachmentDescription> attachmentDescs; FramebufferAttachmentArray<VkAttachmentDescription> attachmentDescs;
const bool hasUnresolveAttachments =
desc.getColorUnresolveAttachmentMask().any() || desc.hasDepthStencilUnresolveAttachment();
// Pack color attachments // Pack color attachments
PackedAttachmentIndex attachmentCount(0); PackedAttachmentIndex attachmentCount(0);
for (uint32_t colorIndexGL = 0; colorIndexGL < desc.colorAttachmentRange(); ++colorIndexGL) for (uint32_t colorIndexGL = 0; colorIndexGL < desc.colorAttachmentRange(); ++colorIndexGL)
...@@ -772,7 +777,7 @@ angle::Result InitializeRenderPassFromDesc(Context *context, ...@@ -772,7 +777,7 @@ angle::Result InitializeRenderPassFromDesc(Context *context,
angle::FormatID formatID = desc[colorIndexGL]; angle::FormatID formatID = desc[colorIndexGL];
ASSERT(formatID != angle::FormatID::NONE); ASSERT(formatID != angle::FormatID::NONE);
const vk::Format &format = context->getRenderer()->getFormat(formatID); const vk::Format &format = renderer->getFormat(formatID);
VkAttachmentReference colorRef; VkAttachmentReference colorRef;
colorRef.attachment = attachmentCount.get(); colorRef.attachment = attachmentCount.get();
...@@ -794,7 +799,7 @@ angle::Result InitializeRenderPassFromDesc(Context *context, ...@@ -794,7 +799,7 @@ angle::Result InitializeRenderPassFromDesc(Context *context,
angle::FormatID formatID = desc[depthStencilIndexGL]; angle::FormatID formatID = desc[depthStencilIndexGL];
ASSERT(formatID != angle::FormatID::NONE); ASSERT(formatID != angle::FormatID::NONE);
const vk::Format &format = context->getRenderer()->getFormat(formatID); const vk::Format &format = renderer->getFormat(formatID);
depthStencilAttachmentRef.attachment = attachmentCount.get(); depthStencilAttachmentRef.attachment = attachmentCount.get();
...@@ -828,7 +833,7 @@ angle::Result InitializeRenderPassFromDesc(Context *context, ...@@ -828,7 +833,7 @@ angle::Result InitializeRenderPassFromDesc(Context *context,
ASSERT(desc.isColorAttachmentEnabled(colorIndexGL)); ASSERT(desc.isColorAttachmentEnabled(colorIndexGL));
const vk::Format &format = context->getRenderer()->getFormat(desc[colorIndexGL]); const vk::Format &format = renderer->getFormat(desc[colorIndexGL]);
VkAttachmentReference colorRef; VkAttachmentReference colorRef;
colorRef.attachment = attachmentCount.get(); colorRef.attachment = attachmentCount.get();
...@@ -849,7 +854,7 @@ angle::Result InitializeRenderPassFromDesc(Context *context, ...@@ -849,7 +854,7 @@ angle::Result InitializeRenderPassFromDesc(Context *context,
uint32_t depthStencilIndexGL = static_cast<uint32_t>(desc.depthStencilAttachmentIndex()); uint32_t depthStencilIndexGL = static_cast<uint32_t>(desc.depthStencilAttachmentIndex());
const vk::Format &format = context->getRenderer()->getFormat(desc[depthStencilIndexGL]); const vk::Format &format = renderer->getFormat(desc[depthStencilIndexGL]);
depthStencilResolveAttachmentRef.attachment = attachmentCount.get(); depthStencilResolveAttachmentRef.attachment = attachmentCount.get();
depthStencilResolveAttachmentRef.layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; depthStencilResolveAttachmentRef.layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
...@@ -873,7 +878,7 @@ angle::Result InitializeRenderPassFromDesc(Context *context, ...@@ -873,7 +878,7 @@ angle::Result InitializeRenderPassFromDesc(Context *context,
VkAttachmentReference unresolveDepthStencilAttachmentRef = kUnusedAttachment; VkAttachmentReference unresolveDepthStencilAttachmentRef = kUnusedAttachment;
FramebufferAttachmentsVector<VkAttachmentReference> unresolveInputAttachmentRefs; FramebufferAttachmentsVector<VkAttachmentReference> unresolveInputAttachmentRefs;
FramebufferAttachmentsVector<uint32_t> unresolvePreserveAttachmentRefs; FramebufferAttachmentsVector<uint32_t> unresolvePreserveAttachmentRefs;
if (desc.getColorUnresolveAttachmentMask().any() || desc.hasDepthStencilUnresolveAttachment()) if (hasUnresolveAttachments)
{ {
subpassDesc.push_back({}); subpassDesc.push_back({});
InitializeUnresolveSubpass( InitializeUnresolveSubpass(
...@@ -919,7 +924,7 @@ angle::Result InitializeRenderPassFromDesc(Context *context, ...@@ -919,7 +924,7 @@ angle::Result InitializeRenderPassFromDesc(Context *context,
} }
std::vector<VkSubpassDependency> subpassDependencies; std::vector<VkSubpassDependency> subpassDependencies;
if (desc.getColorUnresolveAttachmentMask().any() || desc.hasDepthStencilUnresolveAttachment()) if (hasUnresolveAttachments)
{ {
InitializeUnresolveSubpassDependencies( InitializeUnresolveSubpassDependencies(
subpassDesc, desc.getColorUnresolveAttachmentMask().any(), subpassDesc, desc.getColorUnresolveAttachmentMask().any(),
......
...@@ -1002,12 +1002,8 @@ angle::Result CommandBufferHelper::flushToPrimary(ContextVk *contextVk, ...@@ -1002,12 +1002,8 @@ angle::Result CommandBufferHelper::flushToPrimary(ContextVk *contextVk,
{ {
mCommandBuffer.executeQueuedResetQueryPoolCommands(primary->getHandle()); mCommandBuffer.executeQueuedResetQueryPoolCommands(primary->getHandle());
// Pull a RenderPass from the cache. // Pull a RenderPass from the cache.
RenderPassCache &renderPassCache = contextVk->getRenderPassCache();
Serial serial = contextVk->getCurrentQueueSerial();
RenderPass *renderPass = nullptr; RenderPass *renderPass = nullptr;
ANGLE_TRY(renderPassCache.getRenderPassWithOps(contextVk, serial, mRenderPassDesc, ANGLE_TRY(contextVk->getRenderPassWithOps(mRenderPassDesc, mAttachmentOps, &renderPass));
mAttachmentOps, &renderPass));
VkRenderPassBeginInfo beginInfo = {}; VkRenderPassBeginInfo beginInfo = {};
beginInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO; beginInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment