#include "include/core/SkMesh.h"
#include "include/core/SkAlphaType.h"
#include "include/core/SkColorSpace.h"
#include "include/core/SkData.h"
#include "include/private/SkSLSampleUsage.h"
#include "include/private/base/SkAlign.h"
#include "include/private/base/SkAssert.h"
#include "include/private/base/SkMath.h"
#include "include/private/base/SkTArray.h"
#include "include/private/base/SkTo.h"
#include "src/base/SkSafeMath.h"
#include "src/core/SkChecksum.h"
#include "src/core/SkMeshPriv.h"
#include "src/core/SkRuntimeEffectPriv.h"
#include "src/sksl/SkSLAnalysis.h"
#include "src/sksl/SkSLBuiltinTypes.h"
#include "src/sksl/SkSLCompiler.h"
#include "src/sksl/SkSLContext.h"
#include "src/sksl/SkSLProgramKind.h"
#include "src/sksl/SkSLProgramSettings.h"
#include "src/sksl/analysis/SkSLProgramVisitor.h"
#include "src/sksl/ir/SkSLExpression.h"
#include "src/sksl/ir/SkSLFieldAccess.h"
#include "src/sksl/ir/SkSLFunctionDeclaration.h"
#include "src/sksl/ir/SkSLFunctionDefinition.h"
#include "src/sksl/ir/SkSLModifierFlags.h"
#include "src/sksl/ir/SkSLProgram.h"
#include "src/sksl/ir/SkSLProgramElement.h"
#include "src/sksl/ir/SkSLReturnStatement.h"
#include "src/sksl/ir/SkSLStatement.h"
#include "src/sksl/ir/SkSLStructDefinition.h"
#include "src/sksl/ir/SkSLType.h"
#include "src/sksl/ir/SkSLVarDeclarations.h"
#include "src/sksl/ir/SkSLVariable.h"
#include "src/sksl/ir/SkSLVariableReference.h"
#include <algorithm>
#include <locale>
#include <optional>
#include <string>
#include <tuple>
#include <utility>
usingnamespaceskia_private;
Attribute;
Varying;
IndexBuffer;
VertexBuffer;
#define RETURN_FAILURE(...) …
#define RETURN_ERROR(...) …
#define RETURN_SUCCESS …
Uniform;
Child;
static std::vector<Uniform>::iterator find_uniform(std::vector<Uniform>& uniforms,
std::string_view name) { … }
static std::tuple<bool, SkString>
gather_uniforms_and_check_for_main(const SkSL::Program& program,
std::vector<Uniform>* uniforms,
std::vector<Child>* children,
SkMeshSpecification::Uniform::Flags stage,
size_t* offset) { … }
ColorType;
ColorType get_fs_color_type(const SkSL::Program& fsProgram) { … }
static bool check_name(const SkString& name) { … }
static size_t attribute_type_size(Attribute::Type type) { … }
static const char* attribute_type_string(Attribute::Type type) { … }
static const char* varying_type_string(Varying::Type type) { … }
std::tuple<bool, SkString>
check_vertex_offsets_and_stride(SkSpan<const Attribute> attributes,
size_t stride) { … }
int check_for_passthrough_local_coords_and_dead_varyings(const SkSL::Program& fsProgram,
uint32_t* deadVaryingMask) { … }
SkMeshSpecification::Result SkMeshSpecification::Make(SkSpan<const Attribute> attributes,
size_t vertexStride,
SkSpan<const Varying> varyings,
const SkString& vs,
const SkString& fs) { … }
SkMeshSpecification::Result SkMeshSpecification::Make(SkSpan<const Attribute> attributes,
size_t vertexStride,
SkSpan<const Varying> varyings,
const SkString& vs,
const SkString& fs,
sk_sp<SkColorSpace> cs) { … }
SkMeshSpecification::Result SkMeshSpecification::Make(SkSpan<const Attribute> attributes,
size_t vertexStride,
SkSpan<const Varying> varyings,
const SkString& vs,
const SkString& fs,
sk_sp<SkColorSpace> cs,
SkAlphaType at) { … }
SkMeshSpecification::Result SkMeshSpecification::MakeFromSourceWithStructs(
SkSpan<const Attribute> attributes,
size_t stride,
SkSpan<const Varying> varyings,
const SkString& vs,
const SkString& fs,
sk_sp<SkColorSpace> cs,
SkAlphaType at) { … }
SkMeshSpecification::~SkMeshSpecification() = default;
SkMeshSpecification::SkMeshSpecification(
SkSpan<const Attribute> attributes,
size_t stride,
SkSpan<const Varying> varyings,
int passthroughLocalCoordsVaryingIndex,
uint32_t deadVaryingMask,
std::vector<Uniform> uniforms,
std::vector<Child> children,
std::unique_ptr<const SkSL::Program> vs,
std::unique_ptr<const SkSL::Program> fs,
ColorType ct,
sk_sp<SkColorSpace> cs,
SkAlphaType at)
: … { … }
size_t SkMeshSpecification::uniformSize() const { … }
const Uniform* SkMeshSpecification::findUniform(std::string_view name) const { … }
const Child* SkMeshSpecification::findChild(std::string_view name) const { … }
const Attribute* SkMeshSpecification::findAttribute(std::string_view name) const { … }
const Varying* SkMeshSpecification::findVarying(std::string_view name) const { … }
SkMesh::SkMesh() = default;
SkMesh::~SkMesh() = default;
SkMesh::SkMesh(const SkMesh&) = default;
SkMesh::SkMesh(SkMesh&&) = default;
SkMesh& SkMesh::operator=(const SkMesh&) = default;
SkMesh& SkMesh::operator=(SkMesh&&) = default;
SkMesh::Result SkMesh::Make(sk_sp<SkMeshSpecification> spec,
Mode mode,
sk_sp<VertexBuffer> vb,
size_t vertexCount,
size_t vertexOffset,
sk_sp<const SkData> uniforms,
SkSpan<ChildPtr> children,
const SkRect& bounds) { … }
SkMesh::Result SkMesh::MakeIndexed(sk_sp<SkMeshSpecification> spec,
Mode mode,
sk_sp<VertexBuffer> vb,
size_t vertexCount,
size_t vertexOffset,
sk_sp<IndexBuffer> ib,
size_t indexCount,
size_t indexOffset,
sk_sp<const SkData> uniforms,
SkSpan<ChildPtr> children,
const SkRect& bounds) { … }
bool SkMesh::isValid() const { … }
static size_t min_vcount_for_mode(SkMesh::Mode mode) { … }
std::tuple<bool, SkString> SkMesh::validate() const { … }
static inline bool check_update(const void* data, size_t offset, size_t size, size_t bufferSize) { … }
bool SkMesh::IndexBuffer::update(GrDirectContext* dc,
const void* data,
size_t offset,
size_t size) { … }
bool SkMesh::VertexBuffer::update(GrDirectContext* dc,
const void* data,
size_t offset,
size_t size) { … }
namespace SkMeshes {
sk_sp<IndexBuffer> MakeIndexBuffer(const void* data, size_t size) { … }
sk_sp<IndexBuffer> CopyIndexBuffer(const sk_sp<IndexBuffer>& src) { … }
sk_sp<VertexBuffer> MakeVertexBuffer(const void* data, size_t size) { … }
sk_sp<VertexBuffer> CopyVertexBuffer(const sk_sp<VertexBuffer>& src) { … }
}