Flutter Engine
The Flutter Engine
Static Public Member Functions | List of all members
skgpu::tess::FixedCountWedges Class Reference

#include <FixedCountBufferUtils.h>

Static Public Member Functions

static constexpr int PreallocCount (int totalCombinedPathVerbCnt)
 
static int VertexCount (const LinearTolerances &tolerances)
 
static constexpr size_t VertexBufferSize ()
 
static constexpr size_t IndexBufferSize ()
 
static void WriteVertexBuffer (VertexWriter, size_t bufferSize)
 
static void WriteIndexBuffer (VertexWriter, size_t bufferSize)
 

Detailed Description

Definition at line 75 of file FixedCountBufferUtils.h.

Member Function Documentation

◆ IndexBufferSize()

static constexpr size_t skgpu::tess::FixedCountWedges::IndexBufferSize ( )
inlinestaticconstexpr

Definition at line 96 of file FixedCountBufferUtils.h.

96 {
97 return (NumCurveTrianglesAtResolveLevel(kMaxResolveLevel) + 1/*fan triangle*/) *
98 3 * sizeof(uint16_t);
99 }
static constexpr int NumCurveTrianglesAtResolveLevel(int resolveLevel)
Definition: Tessellation.h:66
static constexpr int kMaxResolveLevel
Definition: Tessellation.h:34

◆ PreallocCount()

static constexpr int skgpu::tess::FixedCountWedges::PreallocCount ( int  totalCombinedPathVerbCnt)
inlinestaticconstexpr

Definition at line 81 of file FixedCountBufferUtils.h.

81 {
82 // Over-allocate enough wedges for 1 in 4 to chop, i.e., ceil(maxWedges * 5/4)
83 return (totalCombinedPathVerbCnt * 5 + 3) / 4;
84 }

◆ VertexBufferSize()

static constexpr size_t skgpu::tess::FixedCountWedges::VertexBufferSize ( )
inlinestaticconstexpr

Definition at line 92 of file FixedCountBufferUtils.h.

92 {
93 return ((kMaxParametricSegments + 1) + 1/*fan vertex*/) * (2 * sizeof(float));
94 }
static constexpr int kMaxParametricSegments
Definition: Tessellation.h:41

◆ VertexCount()

static int skgpu::tess::FixedCountWedges::VertexCount ( const LinearTolerances tolerances)
inlinestatic

Definition at line 86 of file FixedCountBufferUtils.h.

86 {
87 // Emit 3 vertices per curve triangle, plus 3 more for the wedge fan triangle.
88 int resolveLevel = std::min(tolerances.requiredResolveLevel(), kMaxResolveLevel);
89 return (NumCurveTrianglesAtResolveLevel(resolveLevel) + 1) * 3;
90 }
static float min(float r, float g, float b)
Definition: hsl.cpp:48

◆ WriteIndexBuffer()

void skgpu::tess::FixedCountWedges::WriteIndexBuffer ( VertexWriter  vertexWriter,
size_t  bufferSize 
)
static

Definition at line 117 of file FixedCountBufferUtils.cpp.

117 {
118 SkASSERT(bufferSize >= sizeof(uint16_t) * 3);
119
120 // Start out with the fan triangle.
121 vertexWriter << (uint16_t)0 << (uint16_t)1 << (uint16_t)2;
122
123 // The rest is the same as for curves, with a baseIndex of 1.
124 write_curve_index_buffer_base_index(std::move(vertexWriter),
125 bufferSize - sizeof(uint16_t) * 3,
126 /*baseIndex=*/1);
127}
#define SkASSERT(cond)
Definition: SkAssert.h:116

◆ WriteVertexBuffer()

void skgpu::tess::FixedCountWedges::WriteVertexBuffer ( VertexWriter  vertexWriter,
size_t  bufferSize 
)
static

Definition at line 107 of file FixedCountBufferUtils.cpp.

107 {
108 SkASSERT(bufferSize >= sizeof(SkPoint));
109
110 // Start out with the fan point. A negative resolve level indicates the fan point.
111 vertexWriter << -1.f/*resolveLevel*/ << -1.f/*idx*/;
112
113 // The rest is the same as for curves.
114 FixedCountCurves::WriteVertexBuffer(std::move(vertexWriter), bufferSize - sizeof(SkPoint));
115}
static void WriteVertexBuffer(VertexWriter, size_t bufferSize)

The documentation for this class was generated from the following files: