8 #include "fml/logging.h"
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 {
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 =
115 if (!pass.
Draw().ok()) {
121 options.depth_write_enabled =
true;
127 options.stencil_mode =
134 cover_area = coverage_rect_;
146 return pass.
Draw().ok();
156 std::optional<Rect> restore_coverage) {
162 options.stencil_mode =
174 std::array<VS::PerVertexData, 4> vertices = {
175 VS::PerVertexData{
Point(ltrb[0], ltrb[1])},
176 VS::PerVertexData{
Point(ltrb[2], ltrb[1])},
177 VS::PerVertexData{
Point(ltrb[0], ltrb[3])},
178 VS::PerVertexData{
Point(ltrb[2], ltrb[3])},
188 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)
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.
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 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)
std::vector< Point > points