32 : coverage_rect_(coverage_rect),
33 is_axis_aligned_rect_(is_axis_aligned_rect) {}
38 clip_geometry_ = std::move(clip_geometry);
46 const std::optional<Rect>& current_clip_coverage)
const {
47 if (!current_clip_coverage.has_value()) {
55 .is_difference_or_non_square =
true,
56 .coverage = current_clip_coverage
59 if (coverage_rect_.
IsEmpty() || !current_clip_coverage.has_value()) {
63 .is_difference_or_non_square = !is_axis_aligned_rect_,
64 .coverage = current_clip_coverage->Intersection(coverage_rect_),
72 uint32_t clip_depth)
const {
77 using VS = ClipPipeline::VertexShader;
89 options.depth_write_enabled =
false;
90 options.primitive_type = clip_geometry_.
type;
92 switch (clip_geometry_.
mode) {
95 options.stencil_mode =
100 options.stencil_mode =
106 options.stencil_mode =
113 VS::BindFrameInfo(pass,
122 options.depth_write_enabled =
true;
128 options.stencil_mode =
135 cover_area = coverage_rect_;
145 VS::BindFrameInfo(pass,
158 std::optional<Rect> restore_coverage) {
159 using VS = ClipPipeline::VertexShader;
164 options.stencil_mode =
176 std::array<VS::PerVertexData, 4> vertices = {
177 VS::PerVertexData{
Point(ltrb[0], ltrb[1])},
178 VS::PerVertexData{
Point(ltrb[2], ltrb[1])},
179 VS::PerVertexData{
Point(ltrb[0], ltrb[3])},
180 VS::PerVertexData{
Point(ltrb[2], ltrb[3])},
188 VS::BindFrameInfo(pass,
ClipContents(Rect coverage_rect, bool is_axis_aligned_rect)
void SetGeometry(GeometryResult geometry)
Set the pre-tessellated clip geometry.
ClipCoverage GetClipCoverage(const std::optional< Rect > ¤t_clip_coverage) const
Given the current pass space bounding rectangle of the clip buffer, return the expected clip coverage...
void SetClipOperation(Entity::ClipOperation clip_op)
bool Render(const ContentContext &renderer, RenderPass &pass, uint32_t clip_depth) const
HostBuffer & GetTransientsDataBuffer() const
Retrieve the current host buffer for transient storage of other non-index data.
PipelineRef GetClipPipeline(ContentContextOptions opts) const
float GetShaderClipDepth() const
BufferView EmplaceUniform(const UniformType &uniform)
Emplace uniform data onto the host buffer. Ensure that backend specific uniform alignment requirement...
Render passes encode render commands directed as one specific render target into an underlying comman...
virtual bool SetVertexBuffer(VertexBuffer buffer)
Specify the vertex and index buffer to use for this command.
virtual void SetStencilReference(uint32_t value)
const Matrix & GetOrthographicTransform() const
virtual void SetPipeline(PipelineRef pipeline)
The pipeline to use for this command.
ISize GetRenderTargetSize() const
virtual fml::Status Draw()
Record the currently pending command.
virtual void SetCommandLabel(std::string_view label)
The debugging label to use for the command.
#define FML_UNREACHABLE()
static Scalar GetShaderClipDepth(uint32_t clip_depth)
bool RenderClipRestore(const ContentContext &renderer, RenderPass &pass, uint32_t clip_depth, std::optional< Rect > restore_coverage)
Render a restore clip.
VertexBuffer CreateVertexBuffer(std::array< VertexType, size > input, HostBuffer &data_host_buffer)
Create an index-less vertex buffer from a fixed size array.
LinePipeline::VertexShader VS
ContentContextOptions OptionsFromPass(const RenderPass &pass)
std::optional< Rect > coverage
This coverage is the outer coverage of the clip.
@ kOverdrawPreventionRestore
@ kOverdrawPreventionIncrement
@ kNormal
The geometry has no overlapping triangles.
VertexBuffer vertex_buffer
constexpr std::array< TPoint< T >, 4 > GetPoints() const
Get the points that represent the 4 corners of this rectangle in a Z order that is compatible with tr...
constexpr bool IsEmpty() const
Returns true if either of the width or height are 0, negative, or NaN.
static constexpr TRect MakeSize(const TSize< U > &size)
std::vector< Point > points