forked from firka/flutter
[Impeller] Allow 3D scenes to render when MSAA is not supported. (flutter/engine#47217)
Before, Impeller Scene would render nothing on the GLES backend when used through Aiks.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user