[Impeller] disable depth-stencil and MSAA for gaussian and downsample. (#165137)

Using MSAA w/ depth stencil requires extra work on the GPU to track
multiple samples and clear the depth/stencil textures.

See also:
https://docs.qualcomm.com/bundle/publicresource/topics/80-78185-2/best_practices.html

Its unclear _how_ much this matters, but adreno recommends minimizing
bin count and as such minimizing msaa samples. Well, we can fully
minimize it by not enabling it. Removing depth stencil was also
considered in the past, this should be removed as it requires us to
clear, which isn't free.

Its likely this won't have a huge performance impact, but seems like a
good best practice.
This commit is contained in:
Jonah Williams
2025-03-13 14:42:54 -07:00
committed by GitHub
parent 5122ffd069
commit 91b7617fc5
2 changed files with 19 additions and 8 deletions

View File

@@ -307,6 +307,12 @@ ContentContext::ContentContext(
.primitive_type = PrimitiveType::kTriangleStrip,
.color_attachment_pixel_format =
context_->GetCapabilities()->GetDefaultColorFormat()};
auto options_no_msaa_no_depth_stencil = ContentContextOptions{
.sample_count = SampleCount::kCount1,
.primitive_type = PrimitiveType::kTriangleStrip,
.color_attachment_pixel_format =
context_->GetCapabilities()->GetDefaultColorFormat(),
.has_depth_stencil_attachments = false};
const auto supports_decal = static_cast<Scalar>(
context_->GetCapabilities()->SupportsDecalSamplerAddressMode());
@@ -380,14 +386,14 @@ ContentContext::ContentContext(
clip_pipelines_.SetDefault(
options,
std::make_unique<ClipPipeline>(*context_, clip_pipeline_descriptor));
texture_downsample_pipelines_.CreateDefault(*context_,
options_trianglestrip);
texture_downsample_pipelines_.CreateDefault(
*context_, options_no_msaa_no_depth_stencil);
rrect_blur_pipelines_.CreateDefault(*context_, options_trianglestrip);
texture_strict_src_pipelines_.CreateDefault(*context_, options);
tiled_texture_pipelines_.CreateDefault(*context_, options,
{supports_decal});
gaussian_blur_pipelines_.CreateDefault(*context_, options_trianglestrip,
{supports_decal});
gaussian_blur_pipelines_.CreateDefault(
*context_, options_no_msaa_no_depth_stencil, {supports_decal});
border_mask_blur_pipelines_.CreateDefault(*context_, options_trianglestrip);
color_matrix_color_filter_pipelines_.CreateDefault(*context_,
options_trianglestrip);

View File

@@ -377,7 +377,9 @@ fml::StatusOr<RenderTarget> MakeDownsampleSubpass(
return pass.Draw().ok();
};
return renderer.MakeSubpass("Gaussian Blur Filter", pass_args.subpass_size,
command_buffer, subpass_callback);
command_buffer, subpass_callback,
/*msaa_enabled=*/false,
/*depth_stencil_enabled=*/false);
} else {
// This assumes we don't scale below 1/16.
Scalar edge = 1.0;
@@ -446,7 +448,9 @@ fml::StatusOr<RenderTarget> MakeDownsampleSubpass(
return pass.Draw().ok();
};
return renderer.MakeSubpass("Gaussian Blur Filter", pass_args.subpass_size,
command_buffer, subpass_callback);
command_buffer, subpass_callback,
/*msaa_enabled=*/false,
/*depth_stencil_enabled=*/false);
}
}
@@ -511,8 +515,9 @@ fml::StatusOr<RenderTarget> MakeBlurSubpass(
destination_target.value(), command_buffer,
subpass_callback);
} else {
return renderer.MakeSubpass("Gaussian Blur Filter", subpass_size,
command_buffer, subpass_callback);
return renderer.MakeSubpass(
"Gaussian Blur Filter", subpass_size, command_buffer, subpass_callback,
/*msaa_enabled=*/false, /*depth_stencil_enabled=*/false);
}
}