Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
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
8 changes: 6 additions & 2 deletions impeller/entity/contents/content_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,13 @@ std::shared_ptr<Texture> ContentContext::MakeSubpass(
RenderTarget subpass_target;
if (context->GetDeviceCapabilities().SupportsOffscreenMSAA() &&
msaa_enabled) {
subpass_target = RenderTarget::CreateOffscreenMSAA(*context, texture_size);
subpass_target = RenderTarget::CreateOffscreenMSAA(
*context, texture_size, "Contents Offscreen MSAA",
RenderTarget::kDefaultColorAttachmentConfigMSAA, std::nullopt);
} else {
subpass_target = RenderTarget::CreateOffscreen(*context, texture_size);
subpass_target = RenderTarget::CreateOffscreen(
*context, texture_size, "Contents Offscreen",
RenderTarget::kDefaultColorAttachmentConfig, std::nullopt);
}
auto subpass_texture = subpass_target.GetRenderTargetTexture();
if (!subpass_texture) {
Expand Down
19 changes: 13 additions & 6 deletions impeller/renderer/render_target.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,38 @@ class RenderTarget {
StoreAction store_action;
};

static constexpr AttachmentConfig kDefaultAttachmentConfig = {
static constexpr AttachmentConfig kDefaultColorAttachmentConfig = {
.storage_mode = StorageMode::kDevicePrivate,
.load_action = LoadAction::kClear,
.store_action = StoreAction::kStore};

static constexpr AttachmentConfigMSAA kDefaultAttachmentConfigMSAA = {
static constexpr AttachmentConfigMSAA kDefaultColorAttachmentConfigMSAA = {
.storage_mode = StorageMode::kDeviceTransient,
.resolve_storage_mode = StorageMode::kDevicePrivate,
.load_action = LoadAction::kClear,
.store_action = StoreAction::kMultisampleResolve};

static constexpr AttachmentConfig kDefaultStencilAttachmentConfig = {
.storage_mode = StorageMode::kDeviceTransient,
.load_action = LoadAction::kClear,
.store_action = StoreAction::kDontCare};

static RenderTarget CreateOffscreen(
const Context& context,
ISize size,
const std::string& label = "Offscreen",
AttachmentConfig color_attachment_config = kDefaultAttachmentConfig,
std::optional<AttachmentConfig> stencil_attachment_config = std::nullopt);
AttachmentConfig color_attachment_config = kDefaultColorAttachmentConfig,
std::optional<AttachmentConfig> stencil_attachment_config =
kDefaultStencilAttachmentConfig);

static RenderTarget CreateOffscreenMSAA(
const Context& context,
ISize size,
const std::string& label = "Offscreen MSAA",
AttachmentConfigMSAA color_attachment_config =
kDefaultAttachmentConfigMSAA,
std::optional<AttachmentConfig> stencil_attachment_config = std::nullopt);
kDefaultColorAttachmentConfigMSAA,
std::optional<AttachmentConfig> stencil_attachment_config =
kDefaultStencilAttachmentConfig);

RenderTarget();

Expand Down