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

Commit f193de9

Browse files
authored
[Impeller] Make RenderTarget::CreateOffscreen utilities have a stencil by default (#39636)
1 parent 727500b commit f193de9

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

impeller/entity/contents/content_context.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,13 @@ std::shared_ptr<Texture> ContentContext::MakeSubpass(
306306
RenderTarget subpass_target;
307307
if (context->GetDeviceCapabilities().SupportsOffscreenMSAA() &&
308308
msaa_enabled) {
309-
subpass_target = RenderTarget::CreateOffscreenMSAA(*context, texture_size);
309+
subpass_target = RenderTarget::CreateOffscreenMSAA(
310+
*context, texture_size, "Contents Offscreen MSAA",
311+
RenderTarget::kDefaultColorAttachmentConfigMSAA, std::nullopt);
310312
} else {
311-
subpass_target = RenderTarget::CreateOffscreen(*context, texture_size);
313+
subpass_target = RenderTarget::CreateOffscreen(
314+
*context, texture_size, "Contents Offscreen",
315+
RenderTarget::kDefaultColorAttachmentConfig, std::nullopt);
312316
}
313317
auto subpass_texture = subpass_target.GetRenderTargetTexture();
314318
if (!subpass_texture) {

impeller/renderer/render_target.h

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,31 +32,38 @@ class RenderTarget {
3232
StoreAction store_action;
3333
};
3434

35-
static constexpr AttachmentConfig kDefaultAttachmentConfig = {
35+
static constexpr AttachmentConfig kDefaultColorAttachmentConfig = {
3636
.storage_mode = StorageMode::kDevicePrivate,
3737
.load_action = LoadAction::kClear,
3838
.store_action = StoreAction::kStore};
3939

40-
static constexpr AttachmentConfigMSAA kDefaultAttachmentConfigMSAA = {
40+
static constexpr AttachmentConfigMSAA kDefaultColorAttachmentConfigMSAA = {
4141
.storage_mode = StorageMode::kDeviceTransient,
4242
.resolve_storage_mode = StorageMode::kDevicePrivate,
4343
.load_action = LoadAction::kClear,
4444
.store_action = StoreAction::kMultisampleResolve};
4545

46+
static constexpr AttachmentConfig kDefaultStencilAttachmentConfig = {
47+
.storage_mode = StorageMode::kDeviceTransient,
48+
.load_action = LoadAction::kClear,
49+
.store_action = StoreAction::kDontCare};
50+
4651
static RenderTarget CreateOffscreen(
4752
const Context& context,
4853
ISize size,
4954
const std::string& label = "Offscreen",
50-
AttachmentConfig color_attachment_config = kDefaultAttachmentConfig,
51-
std::optional<AttachmentConfig> stencil_attachment_config = std::nullopt);
55+
AttachmentConfig color_attachment_config = kDefaultColorAttachmentConfig,
56+
std::optional<AttachmentConfig> stencil_attachment_config =
57+
kDefaultStencilAttachmentConfig);
5258

5359
static RenderTarget CreateOffscreenMSAA(
5460
const Context& context,
5561
ISize size,
5662
const std::string& label = "Offscreen MSAA",
5763
AttachmentConfigMSAA color_attachment_config =
58-
kDefaultAttachmentConfigMSAA,
59-
std::optional<AttachmentConfig> stencil_attachment_config = std::nullopt);
64+
kDefaultColorAttachmentConfigMSAA,
65+
std::optional<AttachmentConfig> stencil_attachment_config =
66+
kDefaultStencilAttachmentConfig);
6067

6168
RenderTarget();
6269

0 commit comments

Comments
 (0)