[Impeller] Correct attachment description for offscreen MSAA resolve. (flutter/engine#42753)
Two issues: 1. The resolve texture is created from the same impeller attachment as the msaa attachment, so the store mode was getting set to dont care instead of store. 2. the image layout for the resolve attachment should be ePresentSrcKHR, at least from following the guide at https://vulkan-tutorial.com/Multisampling Fixing both of these locally fixes all of the weird offscreen cursed rendering. Fixes https://github.com/flutter/flutter/issues/128600
This commit is contained in:
@@ -466,7 +466,7 @@ constexpr vk::AttachmentDescription CreateAttachmentDescription(
|
||||
switch (kind) {
|
||||
case AttachmentKind::kColor:
|
||||
vk_attachment.initialLayout = current_layout;
|
||||
vk_attachment.finalLayout = vk::ImageLayout::eColorAttachmentOptimal;
|
||||
vk_attachment.finalLayout = vk::ImageLayout::eGeneral;
|
||||
break;
|
||||
case AttachmentKind::kDepth:
|
||||
case AttachmentKind::kStencil:
|
||||
|
||||
@@ -49,6 +49,8 @@ static vk::AttachmentDescription CreateAttachmentDescription(
|
||||
|
||||
if (desc.storage_mode == StorageMode::kDeviceTransient) {
|
||||
store_action = StoreAction::kDontCare;
|
||||
} else if (resolve_texture) {
|
||||
store_action = StoreAction::kStore;
|
||||
}
|
||||
|
||||
const auto attachment_desc =
|
||||
@@ -93,9 +95,8 @@ SharedHandleVK<vk::RenderPass> RenderPassVK::CreateVKRenderPass(
|
||||
vk::ImageLayout::eColorAttachmentOptimal};
|
||||
attachments.emplace_back(CreateAttachmentDescription(color));
|
||||
if (color.resolve_texture) {
|
||||
resolve_refs[bind_point] =
|
||||
vk::AttachmentReference{static_cast<uint32_t>(attachments.size()),
|
||||
vk::ImageLayout::eColorAttachmentOptimal};
|
||||
resolve_refs[bind_point] = vk::AttachmentReference{
|
||||
static_cast<uint32_t>(attachments.size()), vk::ImageLayout::eGeneral};
|
||||
attachments.emplace_back(CreateAttachmentDescription(color, true));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user