我使用 pResolveAttachment 在 Android 上使用 Vulkan 实现 MSAA,但结果翻转了。
VkSubpassDescription subpassDesc;
subpassDesc.flags = 0;
subpassDesc.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
subpassDesc.inputAttachmentCount = 0;
subpassDesc.pInputAttachments = nullptr;
subpassDesc.colorAttachmentCount = colorAttachmentCount;
subpassDesc.pColorAttachments = attachmentRefs.data();
subpassDesc.pResolveAttachments = resolveAttachmentCount > 0 ? resolveReferences.data() : nullptr;
subpassDesc.pDepthStencilAttachment = depthStencilAttachment;
subpassDesc.preserveAttachmentCount = 0;
subpassDesc.pPreserveAttachments = nullptr;
// TIPS
resolveReferences[resolveAttachmentCount].attachment = attachmentCount;
resolveReferences[resolveAttachmentCount].layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
resolveAttachmentCount++;
....
subpassDesc.pResolveAttachments = resolveAttachmentCount > 0 ? resolveReferences.data() : nullptr;