17 #include "include/private/base/SkAPI.h"
18 #include "include/private/base/SkTArray.h"
23 #include <string_view>
31 namespace SkSL {
struct Program; }
75 enum class Type : uint32_t {
90 enum class Type : uint32_t {
140 SkSpan<const Varying> varyings,
145 SkSpan<const Varying> varyings,
151 SkSpan<const Varying> varyings,
157 SkSpan<const Attribute>
attributes()
const {
return SkSpan(fAttributes); }
170 SkSpan<const Uniform>
uniforms()
const {
return SkSpan(fUniforms); }
173 SkSpan<const Child>
children()
const {
return SkSpan(fChildren); }
187 size_t stride()
const {
return fStride; }
192 enum class ColorType {
198 static Result MakeFromSourceWithStructs(SkSpan<const Attribute>
attributes,
200 SkSpan<const Varying> varyings,
208 SkSpan<const Varying>,
209 int passthroughLocalCoordsVaryingIndex,
210 uint32_t deadVaryingMask,
213 std::unique_ptr<const SkSL::Program>,
214 std::unique_ptr<const SkSL::Program>,
225 const std::vector<Attribute> fAttributes;
226 const std::vector<Varying> fVaryings;
227 const std::vector<Uniform> fUniforms;
228 const std::vector<Child> fChildren;
229 const std::unique_ptr<const SkSL::Program> fVS;
230 const std::unique_ptr<const SkSL::Program> fFS;
231 const size_t fStride;
233 const int fPassthroughLocalCoordsVaryingIndex;
234 const uint32_t fDeadVaryingMask;
235 const ColorType fColorType;
265 virtual size_t size()
const = 0;
282 virtual size_t size()
const = 0;
365 SkSpan<const ChildPtr>
children()
const {
return SkSpan(fChildren); }
372 std::tuple<bool, SkString> validate()
const;
380 skia_private::STArray<2, ChildPtr> fChildren;
SkAlphaType
Describes how to interpret the alpha component of a pixel.
Definition: SkAlphaType.h:26
@ kNone
glyph outlines unchanged
Definition: GrDirectContext.h:62
Definition: SkColorSpace.h:107
SkData holds an immutable data buffer.
Definition: SkData.h:25
A specification for custom meshes.
Definition: SkMesh.h:65
const Uniform * findUniform(std::string_view name) const
Returns a pointer to the named uniform variable's description, or nullptr if not found.
static constexpr size_t kStrideAlignment
Definition: SkMesh.h:70
const Child * findChild(std::string_view name) const
Returns a pointer to the named child's description, or nullptr if not found.
size_t stride() const
Definition: SkMesh.h:187
static constexpr size_t kMaxVaryings
Definition: SkMesh.h:72
static Result Make(SkSpan< const Attribute > attributes, size_t vertexStride, SkSpan< const Varying > varyings, const SkString &vs, const SkString &fs, sk_sp< SkColorSpace > cs, SkAlphaType at)
const Attribute * findAttribute(std::string_view name) const
Returns a pointer to the named attribute, or nullptr if not found.
static constexpr size_t kMaxAttributes
Definition: SkMesh.h:69
static constexpr size_t kOffsetAlignment
Definition: SkMesh.h:71
static Result Make(SkSpan< const Attribute > attributes, size_t vertexStride, SkSpan< const Varying > varyings, const SkString &vs, const SkString &fs)
If successful the return is a specification and an empty error string.
SkSpan< const Child > children() const
Provides basic info about individual children: names, indices and runtime effect type.
Definition: SkMesh.h:173
const Varying * findVarying(std::string_view name) const
Returns a pointer to the named varying, or nullptr if not found.
static constexpr size_t kMaxStride
These values are enforced when creating a specification.
Definition: SkMesh.h:68
size_t uniformSize() const
Combined size of all 'uniform' variables.
friend struct SkMeshSpecificationPriv
Definition: SkMesh.h:190
SkSpan< const Uniform > uniforms() const
Provides info about individual uniforms including the offset into an SkData where each uniform value ...
Definition: SkMesh.h:170
static Result Make(SkSpan< const Attribute > attributes, size_t vertexStride, SkSpan< const Varying > varyings, const SkString &vs, const SkString &fs, sk_sp< SkColorSpace > cs)
SkSpan< const Attribute > attributes() const
Definition: SkMesh.h:157
bool update(GrDirectContext *, const void *data, size_t offset, size_t size)
Modifies the data in the IndexBuffer by copying size bytes from data into the buffer at offset.
virtual size_t size() const =0
bool update(GrDirectContext *, const void *data, size_t offset, size_t size)
Modifies the data in the IndexBuffer by copying size bytes from data into the buffer at offset.
virtual size_t size() const =0
A vertex buffer, a topology, optionally an index buffer, and a compatible SkMeshSpecification.
Definition: SkMesh.h:261
SkSpan< const ChildPtr > children() const
Definition: SkMesh.h:365
static Result MakeIndexed(sk_sp< SkMeshSpecification >, Mode, sk_sp< VertexBuffer >, size_t vertexCount, size_t vertexOffset, sk_sp< IndexBuffer >, size_t indexCount, size_t indexOffset, sk_sp< const SkData > uniforms, SkSpan< ChildPtr > children, const SkRect &bounds)
Creates an indexed SkMesh.
VertexBuffer * vertexBuffer() const
Definition: SkMesh.h:351
SkMesh & operator=(const SkMesh &)
sk_sp< SkMeshSpecification > refSpec() const
Definition: SkMesh.h:345
const SkData * uniforms() const
Definition: SkMesh.h:363
IndexBuffer * indexBuffer() const
Definition: SkMesh.h:357
size_t vertexCount() const
Definition: SkMesh.h:354
size_t vertexOffset() const
Definition: SkMesh.h:353
SkMesh & operator=(SkMesh &&)
Mode mode() const
Definition: SkMesh.h:348
SkMeshSpecification * spec() const
Definition: SkMesh.h:346
size_t indexCount() const
Definition: SkMesh.h:360
sk_sp< VertexBuffer > refVertexBuffer() const
Definition: SkMesh.h:350
static Result Make(sk_sp< SkMeshSpecification >, Mode, sk_sp< VertexBuffer >, size_t vertexCount, size_t vertexOffset, sk_sp< const SkData > uniforms, SkSpan< ChildPtr > children, const SkRect &bounds)
Creates a non-indexed SkMesh.
SkRect bounds() const
Definition: SkMesh.h:367
size_t indexOffset() const
Definition: SkMesh.h:359
sk_sp< IndexBuffer > refIndexBuffer() const
Definition: SkMesh.h:356
sk_sp< const SkData > refUniforms() const
Definition: SkMesh.h:362
Mode
Definition: SkMesh.h:306
Definition: SkRefCnt.h:160
Definition: SkRefCnt.h:119
Definition: SkRuntimeEffect.h:183
Light weight class for managing strings.
Definition: SkString.h:118
T * get() const
Definition: SkRefCnt.h:303
SK_API sk_sp< SkMesh::IndexBuffer > MakeIndexBuffer(const void *data, size_t size)
Makes a CPU-backed index buffer to be used with SkMeshes.
SK_API sk_sp< SkMesh::IndexBuffer > CopyIndexBuffer(const sk_sp< SkMesh::IndexBuffer > &)
Makes a copy of an index buffer.
SK_API sk_sp< SkMesh::VertexBuffer > MakeVertexBuffer(const void *, size_t size)
Makes a CPU-backed vertex buffer to be used with SkMeshes.
SK_API sk_sp< SkMesh::VertexBuffer > CopyVertexBuffer(const sk_sp< SkMesh::VertexBuffer > &)
Makes a copy of a vertex buffer.
Definition: SkCapabilities.h:15
size_t offset
Definition: SkMesh.h:85
Type type
Definition: SkMesh.h:84
SkString name
Definition: SkMesh.h:86
Type
Definition: SkMesh.h:75
sk_sp< SkMeshSpecification > specification
Definition: SkMesh.h:112
SkString error
Definition: SkMesh.h:113
SkString name
Definition: SkMesh.h:103
Type
Definition: SkMesh.h:90
Type type
Definition: SkMesh.h:102
SkString error
Definition: SkMesh.h:393
SkMesh mesh
Definition: SkMesh.h:393
SkRect holds four float coordinates describing the upper and lower bounds of a rectangle.
Definition: SkRect.h:582
static constexpr SkRect MakeEmpty()
Returns constructed SkRect set to (0, 0, 0, 0).
Definition: SkRect.h:595
Definition: SkRuntimeEffect.h:117