aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2018-05-18 12:32:32 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-18 18:11:24 +0000
commit30e1a5edda30b32d9c7c8c69ac4fb19c89d88c37 (patch)
tree48b7843a6b8e43a7fdeedfa621f494c7e96c4532 /src
parentec42e15c4d087431535443952c41696b69573b13 (diff)
Use inheritance to define TextureGeometryProcesor vertex structs
Change-Id: Ibddc994e6b5599ab20a6f3d81dfe9c6644fb1f69 Reviewed-on: https://skia-review.googlesource.com/129183 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/gpu/ops/GrTextureOp.cpp28
1 files changed, 10 insertions, 18 deletions
diff --git a/src/gpu/ops/GrTextureOp.cpp b/src/gpu/ops/GrTextureOp.cpp
index f2efb95a92..91a6927266 100644
--- a/src/gpu/ops/GrTextureOp.cpp
+++ b/src/gpu/ops/GrTextureOp.cpp
@@ -43,24 +43,14 @@ public:
SkPoint fTextureCoords;
GrColor fColor;
};
- struct AAVertex {
- SkPoint fPosition;
- SkPoint fTextureCoords;
+ struct AAVertex : public Vertex {
SkPoint3 fEdges[4];
- GrColor fColor;
};
- struct MultiTextureVertex {
- SkPoint fPosition;
+ struct MultiTextureVertex : Vertex {
int fTextureIdx;
- SkPoint fTextureCoords;
- GrColor fColor;
};
- struct AAMultiTextureVertex {
- SkPoint fPosition;
- int fTextureIdx;
- SkPoint fTextureCoords;
+ struct AAMultiTextureVertex : MultiTextureVertex {
SkPoint3 fEdges[4];
- GrColor fColor;
};
// Maximum number of textures supported by this op. Must also be checked against the caps
@@ -243,7 +233,6 @@ private:
const GrSamplerState::Filter filters[], const GrShaderCaps& caps)
: INHERITED(kTextureGeometryProcessor_ClassID), fColorSpaceXform(std::move(csxf)) {
SkASSERT(proxyCnt > 0 && samplerCnt >= proxyCnt);
- fPositions = this->addVertexAttrib("position", kFloat2_GrVertexAttribType);
fSamplers[0].reset(std::move(proxies[0]), filters[0]);
this->addTextureSampler(&fSamplers[0]);
for (int i = 1; i < proxyCnt; ++i) {
@@ -252,6 +241,11 @@ private:
new (&fSamplers[i]) TextureSampler(std::move(proxies[i]), filters[i]);
this->addTextureSampler(&fSamplers[i]);
}
+
+ fPositions = this->addVertexAttrib("position", kFloat2_GrVertexAttribType);
+ fTextureCoords = this->addVertexAttrib("textureCoords", kFloat2_GrVertexAttribType);
+ fColors = this->addVertexAttrib("color", kUByte4_norm_GrVertexAttribType);
+
if (samplerCnt > 1) {
// Here we initialize any extra samplers by repeating the last one samplerCnt - proxyCnt
// times.
@@ -264,20 +258,18 @@ private:
fTextureIdx = this->addVertexAttrib("textureIdx", kInt_GrVertexAttribType);
}
- fTextureCoords = this->addVertexAttrib("textureCoords", kFloat2_GrVertexAttribType);
if (coverageAA) {
fAAEdges[0] = this->addVertexAttrib("aaEdge0", kFloat3_GrVertexAttribType);
fAAEdges[1] = this->addVertexAttrib("aaEdge1", kFloat3_GrVertexAttribType);
fAAEdges[2] = this->addVertexAttrib("aaEdge2", kFloat3_GrVertexAttribType);
fAAEdges[3] = this->addVertexAttrib("aaEdge3", kFloat3_GrVertexAttribType);
}
- fColors = this->addVertexAttrib("color", kUByte4_norm_GrVertexAttribType);
}
Attribute fPositions;
- Attribute fTextureIdx;
- Attribute fTextureCoords;
Attribute fColors;
+ Attribute fTextureCoords;
+ Attribute fTextureIdx;
Attribute fAAEdges[4];
sk_sp<GrColorSpaceXform> fColorSpaceXform;
TextureSampler fSamplers[1];