Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[Impeller] Allow 3D scenes to render when MSAA is not supported. #47217

Merged
merged 2 commits into from
Oct 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 38 additions & 17 deletions impeller/entity/contents/scene_contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,44 @@ bool SceneContents::Render(const ContentContext& renderer,
coverage = Rect::MakeSize(pass.GetRenderTargetSize());
}

RenderTarget subpass_target = RenderTarget::CreateOffscreenMSAA(
*renderer.GetContext(), // context
*renderer.GetRenderTargetCache(), // allocator
ISize(coverage.value().size), // size
"SceneContents", // label
RenderTarget::AttachmentConfigMSAA{
.storage_mode = StorageMode::kDeviceTransient,
.resolve_storage_mode = StorageMode::kDevicePrivate,
.load_action = LoadAction::kClear,
.store_action = StoreAction::kMultisampleResolve,
}, // color_attachment_config
RenderTarget::AttachmentConfig{
.storage_mode = StorageMode::kDeviceTransient,
.load_action = LoadAction::kDontCare,
.store_action = StoreAction::kDontCare,
} // stencil_attachment_config
);
RenderTarget subpass_target;
if (renderer.GetContext()->GetCapabilities()->SupportsOffscreenMSAA()) {
subpass_target = RenderTarget::CreateOffscreenMSAA(
*renderer.GetContext(), // context
*renderer.GetRenderTargetCache(), // allocator
ISize(coverage.value().size), // size
"SceneContents", // label
RenderTarget::AttachmentConfigMSAA{
.storage_mode = StorageMode::kDeviceTransient,
.resolve_storage_mode = StorageMode::kDevicePrivate,
.load_action = LoadAction::kClear,
.store_action = StoreAction::kMultisampleResolve,
}, // color_attachment_config
RenderTarget::AttachmentConfig{
.storage_mode = StorageMode::kDeviceTransient,
.load_action = LoadAction::kDontCare,
.store_action = StoreAction::kDontCare,
} // stencil_attachment_config
);
} else {
subpass_target = RenderTarget::CreateOffscreen(
*renderer.GetContext(), // context
*renderer.GetRenderTargetCache(), // allocator
ISize(coverage.value().size), // size
"SceneContents", // label
RenderTarget::AttachmentConfig{
.storage_mode = StorageMode::kDevicePrivate,
.load_action = LoadAction::kClear,
.store_action = StoreAction::kStore,
}, // color_attachment_config
RenderTarget::AttachmentConfig{
.storage_mode = StorageMode::kDeviceTransient,
.load_action = LoadAction::kClear,
.store_action = StoreAction::kDontCare,
} // stencil_attachment_config
);
}

if (!subpass_target.IsValid()) {
return false;
}
Expand Down