@@ -281,11 +281,13 @@ using TiledTextureExternalPipeline =
281281struct ContentContextOptions {
282282 SampleCount sample_count = SampleCount::kCount1 ;
283283 BlendMode blend_mode = BlendMode::kSourceOver ;
284+ CompareFunction depth_compare = CompareFunction::kGreater ;
284285 CompareFunction stencil_compare = CompareFunction::kEqual ;
285286 StencilOperation stencil_operation = StencilOperation::kKeep ;
286287 PrimitiveType primitive_type = PrimitiveType::kTriangle ;
287288 PixelFormat color_attachment_pixel_format = PixelFormat::kUnknown ;
288289 bool has_depth_stencil_attachments = true ;
290+ bool depth_write_enabled = false ;
289291 bool wireframe = false ;
290292 bool is_for_rrect_blur_clear = false ;
291293
@@ -294,6 +296,7 @@ struct ContentContextOptions {
294296 static_assert (sizeof (o.sample_count ) == 1 );
295297 static_assert (sizeof (o.blend_mode ) == 1 );
296298 static_assert (sizeof (o.sample_count ) == 1 );
299+ static_assert (sizeof (o.depth_compare ) == 1 );
297300 static_assert (sizeof (o.stencil_compare ) == 1 );
298301 static_assert (sizeof (o.stencil_operation ) == 1 );
299302 static_assert (sizeof (o.primitive_type ) == 1 );
@@ -302,11 +305,13 @@ struct ContentContextOptions {
302305 return (o.is_for_rrect_blur_clear ? 1llu : 0llu) << 0 |
303306 (o.wireframe ? 1llu : 0llu) << 1 |
304307 (o.has_depth_stencil_attachments ? 1llu : 0llu) << 2 |
308+ (o.depth_write_enabled ? 1llu : 0llu) << 3 |
305309 // enums
306- static_cast <uint64_t >(o.color_attachment_pixel_format ) << 16 |
307- static_cast <uint64_t >(o.primitive_type ) << 24 |
308- static_cast <uint64_t >(o.stencil_operation ) << 32 |
309- static_cast <uint64_t >(o.stencil_compare ) << 40 |
310+ static_cast <uint64_t >(o.color_attachment_pixel_format ) << 8 |
311+ static_cast <uint64_t >(o.primitive_type ) << 16 |
312+ static_cast <uint64_t >(o.stencil_operation ) << 24 |
313+ static_cast <uint64_t >(o.stencil_compare ) << 32 |
314+ static_cast <uint64_t >(o.depth_compare ) << 40 |
310315 static_cast <uint64_t >(o.blend_mode ) << 48 |
311316 static_cast <uint64_t >(o.sample_count ) << 56 ;
312317 }
@@ -317,6 +322,8 @@ struct ContentContextOptions {
317322 const ContentContextOptions& rhs) const {
318323 return lhs.sample_count == rhs.sample_count &&
319324 lhs.blend_mode == rhs.blend_mode &&
325+ lhs.depth_write_enabled == rhs.depth_write_enabled &&
326+ lhs.depth_compare == rhs.depth_compare &&
320327 lhs.stencil_compare == rhs.stencil_compare &&
321328 lhs.stencil_operation == rhs.stencil_operation &&
322329 lhs.primitive_type == rhs.primitive_type &&
@@ -822,6 +829,10 @@ class ContentContext {
822829 VALIDATION_LOG << " Failed to create default pipeline." ;
823830 return ;
824831 }
832+ PixelFormat depth_stencil_format =
833+ context.GetCapabilities ()->GetDefaultDepthStencilFormat ();
834+ desc->SetDepthPixelFormat (depth_stencil_format);
835+ desc->SetStencilPixelFormat (depth_stencil_format);
825836 desc->SetUseSubpassInput (subpass_input);
826837 options.ApplyToPipelineDescriptor (*desc);
827838 SetDefault (options, std::make_unique<PipelineT>(context, desc));
0 commit comments