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

Commit bd3fe68

Browse files
committed
Fixes
1 parent 9064445 commit bd3fe68

File tree

7 files changed

+24
-15
lines changed

7 files changed

+24
-15
lines changed

impeller/entity/contents/content_context.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ void ContentContextOptions::ApplyToPipelineDescriptor(
136136
}
137137
desc.SetColorAttachmentDescriptor(0u, color0);
138138

139-
if (!has_stencil_attachment) {
139+
if (!has_depth_stencil_attachments) {
140+
desc.ClearDepthAttachment();
140141
desc.ClearStencilAttachments();
141142
}
142143

impeller/entity/contents/content_context.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ struct ContentContextOptions {
285285
StencilOperation stencil_operation = StencilOperation::kKeep;
286286
PrimitiveType primitive_type = PrimitiveType::kTriangle;
287287
PixelFormat color_attachment_pixel_format = PixelFormat::kUnknown;
288-
bool has_stencil_attachment = true;
288+
bool has_depth_stencil_attachments = true;
289289
bool wireframe = false;
290290
bool is_for_rrect_blur_clear = false;
291291

@@ -301,7 +301,7 @@ struct ContentContextOptions {
301301

302302
return (o.is_for_rrect_blur_clear ? 1llu : 0llu) << 0 |
303303
(o.wireframe ? 1llu : 0llu) << 1 |
304-
(o.has_stencil_attachment ? 1llu : 0llu) << 2 |
304+
(o.has_depth_stencil_attachments ? 1llu : 0llu) << 2 |
305305
// enums
306306
static_cast<uint64_t>(o.color_attachment_pixel_format) << 16 |
307307
static_cast<uint64_t>(o.primitive_type) << 24 |
@@ -322,7 +322,8 @@ struct ContentContextOptions {
322322
lhs.primitive_type == rhs.primitive_type &&
323323
lhs.color_attachment_pixel_format ==
324324
rhs.color_attachment_pixel_format &&
325-
lhs.has_stencil_attachment == rhs.has_stencil_attachment &&
325+
lhs.has_depth_stencil_attachments ==
326+
rhs.has_depth_stencil_attachments &&
326327
lhs.wireframe == rhs.wireframe &&
327328
lhs.is_for_rrect_blur_clear == rhs.is_for_rrect_blur_clear;
328329
}

impeller/entity/contents/contents.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ ContentContextOptions OptionsFromPass(const RenderPass& pass) {
2121
ContentContextOptions opts;
2222
opts.sample_count = pass.GetSampleCount();
2323
opts.color_attachment_pixel_format = pass.GetRenderTargetPixelFormat();
24-
opts.has_stencil_attachment = pass.HasStencilAttachment();
24+
opts.has_depth_stencil_attachments = pass.HasStencilAttachment();
2525
return opts;
2626
}
2727

impeller/entity/entity_unittests.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2619,9 +2619,9 @@ TEST_P(EntityTest, SpecializationConstantsAreAppliedToVariants) {
26192619
ContentContext(GetContext(), TypographerContextSkia::Make());
26202620

26212621
auto default_color_burn = content_context.GetBlendColorBurnPipeline(
2622-
{.has_stencil_attachment = false});
2622+
{.has_depth_stencil_attachments = false});
26232623
auto alt_color_burn = content_context.GetBlendColorBurnPipeline(
2624-
{.has_stencil_attachment = true});
2624+
{.has_depth_stencil_attachments = true});
26252625

26262626
ASSERT_NE(default_color_burn, alt_color_burn);
26272627
ASSERT_EQ(default_color_burn->GetDescriptor().GetSpecializationConstants(),
@@ -2690,7 +2690,7 @@ TEST_P(EntityTest, ContentContextOptionsHasReasonableHashFunctions) {
26902690
opts.blend_mode = BlendMode::kColorBurn;
26912691
auto hash_b = ContentContextOptions::Hash{}(opts);
26922692

2693-
opts.has_stencil_attachment = false;
2693+
opts.has_depth_stencil_attachments = false;
26942694
auto hash_c = ContentContextOptions::Hash{}(opts);
26952695

26962696
opts.primitive_type = PrimitiveType::kPoint;

impeller/renderer/compute_subgroup_unittests.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ TEST_P(ComputeSubgroupTest, PathPlayground) {
140140
options.sample_count = pass.GetRenderTarget().GetSampleCount();
141141
options.color_attachment_pixel_format =
142142
pass.GetRenderTarget().GetRenderTargetPixelFormat();
143-
options.has_stencil_attachment =
143+
options.has_depth_stencil_attachment =
144144
pass.GetRenderTarget().GetStencilAttachment().has_value();
145145
options.blend_mode = BlendMode::kSourceIn;
146146
options.primitive_type = PrimitiveType::kTriangleStrip;
@@ -337,7 +337,7 @@ TEST_P(ComputeSubgroupTest, LargePath) {
337337
options.sample_count = pass.GetRenderTarget().GetSampleCount();
338338
options.color_attachment_pixel_format =
339339
pass.GetRenderTarget().GetRenderTargetPixelFormat();
340-
options.has_stencil_attachment =
340+
options.has_depth_stencil_attachment =
341341
pass.GetRenderTarget().GetStencilAttachment().has_value();
342342
options.blend_mode = BlendMode::kSourceIn;
343343
options.primitive_type = PrimitiveType::kTriangleStrip;
@@ -415,7 +415,7 @@ TEST_P(ComputeSubgroupTest, QuadAndCubicInOnePath) {
415415
options.sample_count = pass.GetRenderTarget().GetSampleCount();
416416
options.color_attachment_pixel_format =
417417
pass.GetRenderTarget().GetRenderTargetPixelFormat();
418-
options.has_stencil_attachment =
418+
options.has_depth_stencil_attachment =
419419
pass.GetRenderTarget().GetStencilAttachment().has_value();
420420
options.blend_mode = BlendMode::kSourceIn;
421421
options.primitive_type = PrimitiveType::kTriangleStrip;

impeller/renderer/pipeline_builder.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,22 @@ struct PipelineBuilder {
107107
desc.SetColorAttachmentDescriptor(0u, color0);
108108
}
109109

110+
// Setup default depth buffer descriptions.
111+
{
112+
DepthAttachmentDescriptor depth0;
113+
depth0.depth_compare = CompareFunction::kGreater;
114+
desc.SetDepthStencilAttachmentDescriptor(depth0);
115+
desc.SetDepthPixelFormat(
116+
context.GetCapabilities()->GetDefaultDepthStencilFormat());
117+
}
118+
110119
// Setup default stencil buffer descriptions.
111120
{
112121
StencilAttachmentDescriptor stencil0;
113122
stencil0.stencil_compare = CompareFunction::kEqual;
114123
desc.SetStencilAttachmentDescriptors(stencil0);
115124
desc.SetStencilPixelFormat(
116-
context.GetCapabilities()->GetDefaultStencilFormat());
125+
context.GetCapabilities()->GetDefaultDepthStencilFormat());
117126
}
118127

119128
return true;

impeller/renderer/render_target.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ RenderTarget RenderTarget::CreateOffscreenMSAA(
350350
target.SetupDepthStencilAttachments(context, allocator, size, true, label,
351351
stencil_attachment_config.value());
352352
} else {
353+
target.SetDepthAttachment(std::nullopt);
353354
target.SetStencilAttachment(std::nullopt);
354355
}
355356

@@ -416,9 +417,6 @@ size_t RenderTarget::GetTotalAttachmentCount() const {
416417
if (stencil_.has_value()) {
417418
count++;
418419
}
419-
if (depth_.has_value()) {
420-
count++;
421-
}
422420
return count;
423421
}
424422

0 commit comments

Comments
 (0)