@@ -23,25 +23,44 @@ ContentContext::ContentContext(std::shared_ptr<Context> context)
2323 std::make_unique<SolidStrokePipeline>(*context_);
2424
2525 // Pipelines that are variants of the base pipelines with custom descriptors.
26+ // TODO(98684): Rework this API to allow fetching the descriptor without
27+ // waiting for the pipeline to build.
2628 if (auto solid_fill_pipeline = solid_fill_pipelines_[{}]->WaitAndGet ()) {
27- auto clip_pipeline_descriptor = solid_fill_pipeline->GetDescriptor ();
28- clip_pipeline_descriptor.SetLabel (" Clip Pipeline" );
29- // Write to the stencil buffer.
30- StencilAttachmentDescriptor stencil0;
31- stencil0.stencil_compare = CompareFunction::kGreaterEqual ;
32- stencil0.depth_stencil_pass = StencilOperation::kSetToReferenceValue ;
33- clip_pipeline_descriptor.SetStencilAttachmentDescriptors (stencil0);
34- // Disable write to all color attachments.
35- auto color_attachments =
36- clip_pipeline_descriptor.GetColorAttachmentDescriptors ();
37- for (auto & color_attachment : color_attachments) {
38- color_attachment.second .write_mask =
39- static_cast <uint64_t >(ColorWriteMask::kNone );
29+ // Clip pipeline.
30+ {
31+ auto clip_pipeline_descriptor = solid_fill_pipeline->GetDescriptor ();
32+ clip_pipeline_descriptor.SetLabel (" Clip Pipeline" );
33+ // Write to the stencil buffer.
34+ StencilAttachmentDescriptor stencil0;
35+ stencil0.stencil_compare = CompareFunction::kEqual ;
36+ stencil0.depth_stencil_pass = StencilOperation::kIncrementClamp ;
37+ clip_pipeline_descriptor.SetStencilAttachmentDescriptors (stencil0);
38+ // Disable write to all color attachments.
39+ auto color_attachments =
40+ clip_pipeline_descriptor.GetColorAttachmentDescriptors ();
41+ for (auto & color_attachment : color_attachments) {
42+ color_attachment.second .write_mask =
43+ static_cast <uint64_t >(ColorWriteMask::kNone );
44+ }
45+ clip_pipeline_descriptor.SetColorAttachmentDescriptors (
46+ std::move (color_attachments));
47+ clip_pipelines_[{}] =
48+ std::make_unique<ClipPipeline>(*context_, clip_pipeline_descriptor);
49+ }
50+
51+ // Clip restoration pipeline.
52+ {
53+ auto clip_pipeline_descriptor =
54+ clip_pipelines_[{}]->WaitAndGet ()->GetDescriptor ();
55+ clip_pipeline_descriptor.SetLabel (" Clip Restoration Pipeline" );
56+ // Write to the stencil buffer.
57+ StencilAttachmentDescriptor stencil0;
58+ stencil0.stencil_compare = CompareFunction::kLess ;
59+ stencil0.depth_stencil_pass = StencilOperation::kSetToReferenceValue ;
60+ clip_pipeline_descriptor.SetStencilAttachmentDescriptors (stencil0);
61+ clip_restoration_pipelines_[{}] = std::make_unique<ClipPipeline>(
62+ *context_, std::move (clip_pipeline_descriptor));
4063 }
41- clip_pipeline_descriptor.SetColorAttachmentDescriptors (
42- std::move (color_attachments));
43- clip_pipelines_[{}] = std::make_unique<ClipPipeline>(
44- *context_, std::move (clip_pipeline_descriptor));
4564 } else {
4665 return ;
4766 }
0 commit comments