8 #include "fml/logging.h"
31 : coverage_rect_(coverage_rect),
32 is_axis_aligned_rect_(is_axis_aligned_rect) {}
37 clip_geometry_ = std::move(clip_geometry);
45 const std::optional<Rect>& current_clip_coverage)
const {
46 if (!current_clip_coverage.has_value()) {
54 .is_difference_or_non_square =
true,
55 .coverage = current_clip_coverage
58 if (coverage_rect_.
IsEmpty() || !current_clip_coverage.has_value()) {
59 return {.coverage = std::nullopt};
62 .is_difference_or_non_square = !is_axis_aligned_rect_,
63 .coverage = current_clip_coverage->Intersection(coverage_rect_),
71 uint32_t clip_depth)
const {
88 options.depth_write_enabled =
false;
89 options.primitive_type = clip_geometry_.
type;
91 switch (clip_geometry_.
mode) {
94 options.stencil_mode =
99 options.stencil_mode =
105 options.stencil_mode =
114 if (!pass.
Draw().ok()) {
120 options.depth_write_enabled =
true;
126 options.stencil_mode =
133 cover_area = coverage_rect_;
145 return pass.
Draw().ok();
155 std::optional<Rect> restore_coverage) {
161 options.stencil_mode =
173 std::array<VS::PerVertexData, 4> vertices = {
174 VS::PerVertexData{
Point(ltrb[0], ltrb[1])},
175 VS::PerVertexData{
Point(ltrb[2], ltrb[1])},
176 VS::PerVertexData{
Point(ltrb[0], ltrb[3])},
177 VS::PerVertexData{
Point(ltrb[2], ltrb[3])},
187 return pass.
Draw().ok();
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 & GetTransientsBuffer() const
Retrieve the currnent host buffer for transient storage.
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.
VertexShader_ VertexShader
static Scalar GetShaderClipDepth(uint32_t clip_depth)
GlyphAtlasPipeline::VertexShader VS
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 &host_buffer)
Create an index-less vertex buffer from a fixed size array.
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 bool IsEmpty() const
Returns true if either of the width or height are 0, negative, or NaN.
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 static TRect MakeSize(const TSize< U > &size)