@@ -286,11 +286,41 @@ struct PendingCommandBuffers {
286286// / Flutter application may easily require building hundreds of PSOs in total,
287287// / but they shouldn't require e.g. 10s of thousands.
288288struct ContentContextOptions {
289+ enum class StencilMode : uint8_t {
290+ // Operations used for stencil-then-cover
291+
292+ // / Turn the stencil test off. Used when drawing without stencil-then-cover.
293+ kIgnore ,
294+ // / Overwrite the stencil content to the ref value. Used for resetting the
295+ // / stencil buffer after a stencil-then-cover operation.
296+ kSetToRef ,
297+ // / Draw the stencil for the nonzero fill path rule.
298+ kNonZeroWrite ,
299+ // / Draw the stencil for the evenoff fill path rule.
300+ kEvenOddWrite ,
301+ // / Used for draw calls which fill in the stenciled area. Intended to be
302+ // / used after `kNonZeroWrite` or `kEvenOddWrite` is used to set up the
303+ // / stencil buffer.
304+ kCoverCompare ,
305+
306+ // Operations to control the legacy clip implementation, which forms a
307+ // heightmap on the stencil buffer.
308+
309+ // / Slice the clip heightmap to a new maximum height.
310+ kLegacyClipRestore ,
311+ // / Increment the stencil heightmap.
312+ kLegacyClipIncrement ,
313+ // / Decrement the stencil heightmap (used for difference clipping only).
314+ kLegacyClipDecrement ,
315+ // / Used for applying clips to all non-clip draw calls.
316+ kLegacyClipCompare ,
317+ };
318+
289319 SampleCount sample_count = SampleCount::kCount1 ;
290320 BlendMode blend_mode = BlendMode::kSourceOver ;
291321 CompareFunction depth_compare = CompareFunction::kAlways ;
292- CompareFunction stencil_compare = CompareFunction:: kEqual ;
293- StencilOperation stencil_operation = StencilOperation:: kKeep ;
322+ StencilMode stencil_mode =
323+ ContentContextOptions::StencilMode:: kLegacyClipCompare ;
294324 PrimitiveType primitive_type = PrimitiveType::kTriangle ;
295325 PixelFormat color_attachment_pixel_format = PixelFormat::kUnknown ;
296326 bool has_depth_stencil_attachments = true ;
@@ -304,8 +334,7 @@ struct ContentContextOptions {
304334 static_assert (sizeof (o.blend_mode ) == 1 );
305335 static_assert (sizeof (o.sample_count ) == 1 );
306336 static_assert (sizeof (o.depth_compare ) == 1 );
307- static_assert (sizeof (o.stencil_compare ) == 1 );
308- static_assert (sizeof (o.stencil_operation ) == 1 );
337+ static_assert (sizeof (o.stencil_mode ) == 1 );
309338 static_assert (sizeof (o.primitive_type ) == 1 );
310339 static_assert (sizeof (o.color_attachment_pixel_format ) == 1 );
311340
@@ -316,11 +345,10 @@ struct ContentContextOptions {
316345 // enums
317346 static_cast <uint64_t >(o.color_attachment_pixel_format ) << 8 |
318347 static_cast <uint64_t >(o.primitive_type ) << 16 |
319- static_cast <uint64_t >(o.stencil_operation ) << 24 |
320- static_cast <uint64_t >(o.stencil_compare ) << 32 |
321- static_cast <uint64_t >(o.depth_compare ) << 40 |
322- static_cast <uint64_t >(o.blend_mode ) << 48 |
323- static_cast <uint64_t >(o.sample_count ) << 56 ;
348+ static_cast <uint64_t >(o.stencil_mode ) << 24 |
349+ static_cast <uint64_t >(o.depth_compare ) << 32 |
350+ static_cast <uint64_t >(o.blend_mode ) << 40 |
351+ static_cast <uint64_t >(o.sample_count ) << 48 ;
324352 }
325353 };
326354
@@ -331,8 +359,7 @@ struct ContentContextOptions {
331359 lhs.blend_mode == rhs.blend_mode &&
332360 lhs.depth_write_enabled == rhs.depth_write_enabled &&
333361 lhs.depth_compare == rhs.depth_compare &&
334- lhs.stencil_compare == rhs.stencil_compare &&
335- lhs.stencil_operation == rhs.stencil_operation &&
362+ lhs.stencil_mode == rhs.stencil_mode &&
336363 lhs.primitive_type == rhs.primitive_type &&
337364 lhs.color_attachment_pixel_format ==
338365 rhs.color_attachment_pixel_format &&
0 commit comments