aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/ops/GrDrawVerticesOp.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/ops/GrDrawVerticesOp.h')
-rw-r--r--src/gpu/ops/GrDrawVerticesOp.h47
1 files changed, 39 insertions, 8 deletions
diff --git a/src/gpu/ops/GrDrawVerticesOp.h b/src/gpu/ops/GrDrawVerticesOp.h
index 6d35c0d0e9..2e10fefe94 100644
--- a/src/gpu/ops/GrDrawVerticesOp.h
+++ b/src/gpu/ops/GrDrawVerticesOp.h
@@ -38,13 +38,15 @@ public:
static std::unique_ptr<GrDrawOp> Make(GrContext* context,
GrPaint&&,
sk_sp<SkVertices>,
+ const SkMatrix bones[],
+ int boneCount,
const SkMatrix& viewMatrix,
GrAAType,
sk_sp<GrColorSpaceXform>,
GrPrimitiveType* overridePrimType = nullptr);
- GrDrawVerticesOp(const Helper::MakeArgs& helperArgs, GrColor, sk_sp<SkVertices>,
- GrPrimitiveType, GrAAType, sk_sp<GrColorSpaceXform>,
+ GrDrawVerticesOp(const Helper::MakeArgs&, GrColor, sk_sp<SkVertices>, const SkMatrix bones[],
+ int boneCount, GrPrimitiveType, GrAAType, sk_sp<GrColorSpaceXform>,
const SkMatrix& viewMatrix);
const char* name() const override { return "DrawVerticesOp"; }
@@ -68,7 +70,26 @@ private:
void onPrepareDraws(Target*) override;
- sk_sp<GrGeometryProcessor> makeGP(bool* hasColorAttribute, bool* hasLocalCoordAttribute) const;
+ void drawVolatile(Target*);
+ void drawNonVolatile(Target*);
+
+ void fillBuffers(bool hasColorAttribute,
+ bool hasLocalCoordsAttribute,
+ bool hasBoneAttribute,
+ size_t vertexStride,
+ void* verts,
+ uint16_t* indices) const;
+
+ void drawVertices(Target*,
+ GrGeometryProcessor*,
+ const GrBuffer* vertexBuffer,
+ int firstVertex,
+ const GrBuffer* indexBuffer,
+ int firstIndex);
+
+ sk_sp<GrGeometryProcessor> makeGP(bool* hasColorAttribute,
+ bool* hasLocalCoordAttribute,
+ bool* hasBoneAttribute) const;
GrPrimitiveType primitiveType() const { return fPrimitiveType; }
bool combinablePrimitive() const {
@@ -82,9 +103,11 @@ private:
struct Mesh {
GrColor fColor; // Used if this->hasPerVertexColors() is false.
sk_sp<SkVertices> fVertices;
+ std::vector<SkMatrix> fBones;
SkMatrix fViewMatrix;
bool fIgnoreTexCoords;
bool fIgnoreColors;
+ bool fIgnoreBones;
bool hasExplicitLocalCoords() const {
return fVertices->hasTexCoords() && !fIgnoreTexCoords;
@@ -93,6 +116,10 @@ private:
bool hasPerVertexColors() const {
return fVertices->hasColors() && !fIgnoreColors;
}
+
+ bool hasBones() const {
+ return fVertices->hasBones() && fBones.size() && !fIgnoreBones;
+ }
};
bool isIndexed() const {
@@ -105,18 +132,22 @@ private:
}
bool anyMeshHasExplicitLocalCoords() const {
- return SkToBool(kAnyMeshHasExplicitLocalCoords & fFlags);
+ return SkToBool(kAnyMeshHasExplicitLocalCoords_Flag & fFlags);
}
bool hasMultipleViewMatrices() const {
return SkToBool(kHasMultipleViewMatrices_Flag & fFlags);
}
- enum Flags {
- kRequiresPerVertexColors_Flag = 0x1,
- kAnyMeshHasExplicitLocalCoords = 0x2,
- kHasMultipleViewMatrices_Flag = 0x4
+ bool hasBones() const {
+ return SkToBool(kHasBones_Flag & fFlags);
+ }
+ enum Flags {
+ kRequiresPerVertexColors_Flag = 0x1,
+ kAnyMeshHasExplicitLocalCoords_Flag = 0x2,
+ kHasMultipleViewMatrices_Flag = 0x4,
+ kHasBones_Flag = 0x8,
};
Helper fHelper;