aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/ccpr/GrCCCoverageProcessor_GSImpl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/ccpr/GrCCCoverageProcessor_GSImpl.cpp')
-rw-r--r--src/gpu/ccpr/GrCCCoverageProcessor_GSImpl.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/gpu/ccpr/GrCCCoverageProcessor_GSImpl.cpp b/src/gpu/ccpr/GrCCCoverageProcessor_GSImpl.cpp
index aa7a8db8a5..8134fbe89b 100644
--- a/src/gpu/ccpr/GrCCCoverageProcessor_GSImpl.cpp
+++ b/src/gpu/ccpr/GrCCCoverageProcessor_GSImpl.cpp
@@ -31,9 +31,8 @@ protected:
const GrCCCoverageProcessor& proc = args.fGP.cast<GrCCCoverageProcessor>();
// The vertex shader simply forwards transposed x or y values to the geometry shader.
- SkASSERT(1 == proc.numAttribs());
- gpArgs->fPositionVar.set(GrVertexAttribTypeToSLType(proc.getAttrib(0).type()),
- proc.getAttrib(0).name());
+ SkASSERT(1 == proc.numVertexAttributes());
+ gpArgs->fPositionVar = proc.fVertexAttribute.asShaderVar();
// Geometry shader.
GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler;
@@ -62,7 +61,7 @@ protected:
Shader::CalcWind(proc, g, "pts", wind.c_str());
if (PrimitiveType::kWeightedTriangles == proc.fPrimitiveType) {
SkASSERT(3 == numInputPoints);
- SkASSERT(kFloat4_GrVertexAttribType == proc.getAttrib(0).type());
+ SkASSERT(kFloat4_GrVertexAttribType == proc.fVertexAttribute.type());
g->codeAppendf("%s *= sk_in[0].sk_Position.w;", wind.c_str());
}
@@ -382,14 +381,19 @@ public:
void GrCCCoverageProcessor::initGS() {
SkASSERT(Impl::kGeometryShader == fImpl);
if (4 == this->numInputPoints() || this->hasInputWeight()) {
- this->addVertexAttrib("x_or_y_values", kFloat4_GrVertexAttribType);
- SkASSERT(sizeof(QuadPointInstance) == this->getVertexStride() * 2);
- SkASSERT(offsetof(QuadPointInstance, fY) == this->getVertexStride());
+ fVertexAttribute = {"x_or_y_values", kFloat4_GrVertexAttribType};
+ GR_STATIC_ASSERT(sizeof(QuadPointInstance) ==
+ 2 * GrVertexAttribTypeSize(kFloat4_GrVertexAttribType));
+ GR_STATIC_ASSERT(offsetof(QuadPointInstance, fY) ==
+ GrVertexAttribTypeSize(kFloat4_GrVertexAttribType));
} else {
- this->addVertexAttrib("x_or_y_values", kFloat3_GrVertexAttribType);
- SkASSERT(sizeof(TriPointInstance) == this->getVertexStride() * 2);
- SkASSERT(offsetof(TriPointInstance, fY) == this->getVertexStride());
+ fVertexAttribute = {"x_or_y_values", kFloat3_GrVertexAttribType};
+ GR_STATIC_ASSERT(sizeof(TriPointInstance) ==
+ 2 * GrVertexAttribTypeSize(kFloat3_GrVertexAttribType));
+ GR_STATIC_ASSERT(offsetof(TriPointInstance, fY) ==
+ GrVertexAttribTypeSize(kFloat3_GrVertexAttribType));
}
+ this->setVertexAttributeCnt(1);
this->setWillUseGeoShader();
}