[Impeller] Make RenderTarget::CreateOffscreen utilities have a stencil by default (flutter/engine#39636)
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user