aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/ccpr
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/ccpr')
-rw-r--r--src/gpu/ccpr/GrCCCoverageProcessor_GSImpl.cpp6
-rw-r--r--src/gpu/ccpr/GrCCCoverageProcessor_VSImpl.cpp42
-rw-r--r--src/gpu/ccpr/GrCCPathProcessor.cpp20
-rw-r--r--src/gpu/ccpr/GrCCPathProcessor.h4
4 files changed, 36 insertions, 36 deletions
diff --git a/src/gpu/ccpr/GrCCCoverageProcessor_GSImpl.cpp b/src/gpu/ccpr/GrCCCoverageProcessor_GSImpl.cpp
index 61bb4ec7cf..aa7a8db8a5 100644
--- a/src/gpu/ccpr/GrCCCoverageProcessor_GSImpl.cpp
+++ b/src/gpu/ccpr/GrCCCoverageProcessor_GSImpl.cpp
@@ -32,8 +32,8 @@ protected:
// 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).fType),
- proc.getAttrib(0).fName);
+ gpArgs->fPositionVar.set(GrVertexAttribTypeToSLType(proc.getAttrib(0).type()),
+ proc.getAttrib(0).name());
// Geometry shader.
GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler;
@@ -62,7 +62,7 @@ protected:
Shader::CalcWind(proc, g, "pts", wind.c_str());
if (PrimitiveType::kWeightedTriangles == proc.fPrimitiveType) {
SkASSERT(3 == numInputPoints);
- SkASSERT(kFloat4_GrVertexAttribType == proc.getAttrib(0).fType);
+ SkASSERT(kFloat4_GrVertexAttribType == proc.getAttrib(0).type());
g->codeAppendf("%s *= sk_in[0].sk_Position.w;", wind.c_str());
}
diff --git a/src/gpu/ccpr/GrCCCoverageProcessor_VSImpl.cpp b/src/gpu/ccpr/GrCCCoverageProcessor_VSImpl.cpp
index 08b8886aed..ef2bcd36cb 100644
--- a/src/gpu/ccpr/GrCCCoverageProcessor_VSImpl.cpp
+++ b/src/gpu/ccpr/GrCCCoverageProcessor_VSImpl.cpp
@@ -259,16 +259,16 @@ void GrCCCoverageProcessor::VSImpl::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs)
int inputWidth = (4 == numInputPoints || proc.hasInputWeight()) ? 4 : 3;
const char* swizzle = (4 == inputWidth) ? "xyzw" : "xyz";
- v->codeAppendf("float%ix2 pts = transpose(float2x%i(%s.%s, %s.%s));",
- inputWidth, inputWidth, proc.getAttrib(kAttribIdx_X).fName, swizzle,
- proc.getAttrib(kAttribIdx_Y).fName, swizzle);
+ v->codeAppendf("float%ix2 pts = transpose(float2x%i(%s.%s, %s.%s));", inputWidth, inputWidth,
+ proc.getAttrib(kAttribIdx_X).name(), swizzle,
+ proc.getAttrib(kAttribIdx_Y).name(), swizzle);
v->codeAppend ("half wind;");
Shader::CalcWind(proc, v, "pts", "wind");
if (PrimitiveType::kWeightedTriangles == proc.fPrimitiveType) {
SkASSERT(3 == numInputPoints);
- SkASSERT(kFloat4_GrVertexAttribType == proc.getAttrib(kAttribIdx_X).fType);
- v->codeAppendf("wind *= %s.w;", proc.getAttrib(kAttribIdx_X).fName);
+ SkASSERT(kFloat4_GrVertexAttribType == proc.getAttrib(kAttribIdx_X).type());
+ v->codeAppendf("wind *= %s.w;", proc.getAttrib(kAttribIdx_X).name());
}
float bloat = kAABloatRadius;
@@ -284,12 +284,12 @@ void GrCCCoverageProcessor::VSImpl::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs)
// Reverse all indices if the wind is counter-clockwise: [0, 1, 2] -> [2, 1, 0].
v->codeAppendf("int clockwise_indices = wind > 0 ? %s : 0x%x - %s;",
- proc.getAttrib(kAttribIdx_VertexData).fName,
+ proc.getAttrib(kAttribIdx_VertexData).name(),
((fNumSides - 1) << kVertexData_LeftNeighborIdShift) |
((fNumSides - 1) << kVertexData_RightNeighborIdShift) |
(((1 << kVertexData_RightNeighborIdShift) - 1) ^ 3) |
(fNumSides - 1),
- proc.getAttrib(kAttribIdx_VertexData).fName);
+ proc.getAttrib(kAttribIdx_VertexData).name());
// Here we generate conservative raster geometry for the input polygon. It is the convex
// hull of N pixel-size boxes, one centered on each the input points. Each corner has three
@@ -321,8 +321,8 @@ void GrCCCoverageProcessor::VSImpl::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs)
v->codeAppend ("float2 rightdir = right - corner;");
v->codeAppend ("rightdir = (float2(0) != rightdir) ? normalize(rightdir) : float2(1, 0);");
- v->codeAppendf("if (0 != (%s & %i)) {", // Are we a corner?
- proc.getAttrib(kAttribIdx_VertexData).fName, kVertexData_IsCornerBit);
+ v->codeAppendf("if (0 != (%s & %i)) {", // Are we a corner?
+ proc.getAttrib(kAttribIdx_VertexData).name(), kVertexData_IsCornerBit);
// In corner boxes, all 4 coverage values will not map linearly.
// Therefore it is important to align the box so its diagonal shared
@@ -341,8 +341,8 @@ void GrCCCoverageProcessor::VSImpl::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs)
// continue rotating 90 degrees clockwise until we reach the desired raster vertex for this
// invocation. Corners with less than 3 corresponding raster vertices will result in
// redundant vertices and degenerate triangles.
- v->codeAppendf("int bloatidx = (%s >> %i) & 3;",
- proc.getAttrib(kAttribIdx_VertexData).fName, kVertexData_BloatIdxShift);
+ v->codeAppendf("int bloatidx = (%s >> %i) & 3;", proc.getAttrib(kAttribIdx_VertexData).name(),
+ kVertexData_BloatIdxShift);
v->codeAppend ("switch (bloatidx) {");
v->codeAppend ( "case 3:");
// Only corners will have bloatidx=3, and corners always rotate.
@@ -375,13 +375,13 @@ void GrCCCoverageProcessor::VSImpl::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs)
Shader::CalcEdgeCoverageAtBloatVertex(v, "corner", "right", "bloatdir", "right_coverage");
v->codeAppend ("}");
- v->codeAppendf("if (0 != (%s & %i)) {", // Are we an edge?
- proc.getAttrib(kAttribIdx_VertexData).fName, kVertexData_IsEdgeBit);
+ v->codeAppendf("if (0 != (%s & %i)) {", // Are we an edge?
+ proc.getAttrib(kAttribIdx_VertexData).name(), kVertexData_IsEdgeBit);
v->codeAppend ( "coverage = left_coverage;");
v->codeAppend ("}");
- v->codeAppendf("if (0 != (%s & %i)) {", // Invert coverage?
- proc.getAttrib(kAttribIdx_VertexData).fName,
+ v->codeAppendf("if (0 != (%s & %i)) {", // Invert coverage?
+ proc.getAttrib(kAttribIdx_VertexData).name(),
kVertexData_InvertNegativeCoverageBit);
v->codeAppend ( "coverage = -1 - coverage;");
v->codeAppend ("}");
@@ -390,8 +390,8 @@ void GrCCCoverageProcessor::VSImpl::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs)
// Non-corner geometry should have zero effect from corner coverage.
v->codeAppend ("half2 corner_coverage = half2(0);");
- v->codeAppendf("if (0 != (%s & %i)) {", // Are we a corner?
- proc.getAttrib(kAttribIdx_VertexData).fName, kVertexData_IsCornerBit);
+ v->codeAppendf("if (0 != (%s & %i)) {", // Are we a corner?
+ proc.getAttrib(kAttribIdx_VertexData).name(), kVertexData_IsCornerBit);
// We use coverage=-1 to erase what the hull geometry wrote.
//
// In the context of curves, this effectively means "wind = -wind" and
@@ -502,8 +502,8 @@ void GrCCCoverageProcessor::initVS(GrResourceProvider* rp) {
SkASSERT(kAttribIdx_Y == this->numAttribs());
this->addInstanceAttrib("Y", kFloat4_GrVertexAttribType);
- SkASSERT(offsetof(QuadPointInstance, fX) == this->getAttrib(kAttribIdx_X).fOffsetInRecord);
- SkASSERT(offsetof(QuadPointInstance, fY) == this->getAttrib(kAttribIdx_Y).fOffsetInRecord);
+ SkASSERT(offsetof(QuadPointInstance, fX) == this->getAttrib(kAttribIdx_X).offsetInRecord());
+ SkASSERT(offsetof(QuadPointInstance, fY) == this->getAttrib(kAttribIdx_Y).offsetInRecord());
SkASSERT(sizeof(QuadPointInstance) == this->getInstanceStride());
} else {
SkASSERT(kAttribIdx_X == this->numAttribs());
@@ -512,8 +512,8 @@ void GrCCCoverageProcessor::initVS(GrResourceProvider* rp) {
SkASSERT(kAttribIdx_Y == this->numAttribs());
this->addInstanceAttrib("Y", kFloat3_GrVertexAttribType);
- SkASSERT(offsetof(TriPointInstance, fX) == this->getAttrib(kAttribIdx_X).fOffsetInRecord);
- SkASSERT(offsetof(TriPointInstance, fY) == this->getAttrib(kAttribIdx_Y).fOffsetInRecord);
+ SkASSERT(offsetof(TriPointInstance, fX) == this->getAttrib(kAttribIdx_X).offsetInRecord());
+ SkASSERT(offsetof(TriPointInstance, fY) == this->getAttrib(kAttribIdx_Y).offsetInRecord());
SkASSERT(sizeof(TriPointInstance) == this->getInstanceStride());
}
diff --git a/src/gpu/ccpr/GrCCPathProcessor.cpp b/src/gpu/ccpr/GrCCPathProcessor.cpp
index de52726cea..bbc2b811c5 100644
--- a/src/gpu/ccpr/GrCCPathProcessor.cpp
+++ b/src/gpu/ccpr/GrCCPathProcessor.cpp
@@ -87,13 +87,13 @@ GrCCPathProcessor::GrCCPathProcessor(GrResourceProvider* resourceProvider,
this->addInstanceAttrib("color", kUByte4_norm_GrVertexAttribType);
SkASSERT(offsetof(Instance, fDevBounds) ==
- this->getInstanceAttrib(InstanceAttribs::kDevBounds).fOffsetInRecord);
+ this->getInstanceAttrib(InstanceAttribs::kDevBounds).offsetInRecord());
SkASSERT(offsetof(Instance, fDevBounds45) ==
- this->getInstanceAttrib(InstanceAttribs::kDevBounds45).fOffsetInRecord);
+ this->getInstanceAttrib(InstanceAttribs::kDevBounds45).offsetInRecord());
SkASSERT(offsetof(Instance, fAtlasOffset) ==
- this->getInstanceAttrib(InstanceAttribs::kAtlasOffset).fOffsetInRecord);
+ this->getInstanceAttrib(InstanceAttribs::kAtlasOffset).offsetInRecord());
SkASSERT(offsetof(Instance, fColor) ==
- this->getInstanceAttrib(InstanceAttribs::kColor).fOffsetInRecord);
+ this->getInstanceAttrib(InstanceAttribs::kColor).offsetInRecord());
SkASSERT(sizeof(Instance) == this->getInstanceStride());
GR_STATIC_ASSERT(4 == kNumInstanceAttribs);
@@ -183,13 +183,13 @@ void GLSLPathProcessor::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
//
// NOTE: "float2x2(float4)" is valid and equivalent to "float2x2(float4.xy, float4.zw)",
// however Intel compilers crash when we use the former syntax in this shader.
- v->codeAppendf("float2x2 N = float2x2(%s.xy, %s.zw);",
- proc.getEdgeNormsAttrib().fName, proc.getEdgeNormsAttrib().fName);
+ v->codeAppendf("float2x2 N = float2x2(%s.xy, %s.zw);", proc.getEdgeNormsAttrib().name(),
+ proc.getEdgeNormsAttrib().name());
// N[0] is the normal for the edge we are intersecting from the regular bounding box, pointing
// out of the octagon.
v->codeAppendf("float4 devbounds = %s;",
- proc.getInstanceAttrib(InstanceAttribs::kDevBounds).fName);
+ proc.getInstanceAttrib(InstanceAttribs::kDevBounds).name());
v->codeAppend ("float2 refpt = (0 == sk_VertexID >> 2)"
"? float2(min(devbounds.x, devbounds.z), devbounds.y)"
": float2(max(devbounds.x, devbounds.z), devbounds.w);");
@@ -198,8 +198,8 @@ void GLSLPathProcessor::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
// N[1] is the normal for the edge we are intersecting from the 45-degree bounding box, pointing
// out of the octagon.
v->codeAppendf("float2 refpt45 = (0 == ((sk_VertexID + 1) & (1 << 2))) ? %s.xy : %s.zw;",
- proc.getInstanceAttrib(InstanceAttribs::kDevBounds45).fName,
- proc.getInstanceAttrib(InstanceAttribs::kDevBounds45).fName);
+ proc.getInstanceAttrib(InstanceAttribs::kDevBounds45).name(),
+ proc.getInstanceAttrib(InstanceAttribs::kDevBounds45).name());
v->codeAppendf("refpt45 *= float2x2(.5,.5,-.5,.5);"); // transform back to device space.
v->codeAppendf("refpt45 += N[1] * %f;", kAABloatRadius); // bloat for AA.
@@ -210,7 +210,7 @@ void GLSLPathProcessor::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
// Convert to atlas coordinates in order to do our texture lookup.
v->codeAppendf("float2 atlascoord = octocoord + float2(%s);",
- proc.getInstanceAttrib(InstanceAttribs::kAtlasOffset).fName);
+ proc.getInstanceAttrib(InstanceAttribs::kAtlasOffset).name());
if (kTopLeft_GrSurfaceOrigin == proc.atlasProxy()->origin()) {
v->codeAppendf("%s.xy = atlascoord * %s;", texcoord.vsOut(), atlasAdjust);
} else {
diff --git a/src/gpu/ccpr/GrCCPathProcessor.h b/src/gpu/ccpr/GrCCPathProcessor.h
index 198bc60d20..9d97bad91a 100644
--- a/src/gpu/ccpr/GrCCPathProcessor.h
+++ b/src/gpu/ccpr/GrCCPathProcessor.h
@@ -62,13 +62,13 @@ public:
const SkMatrix& localMatrix() const { return fLocalMatrix; }
const Attribute& getInstanceAttrib(InstanceAttribs attribID) const {
const Attribute& attrib = this->getAttrib((int)attribID);
- SkASSERT(Attribute::InputRate::kPerInstance == attrib.fInputRate);
+ SkASSERT(Attribute::InputRate::kPerInstance == attrib.inputRate());
return attrib;
}
const Attribute& getEdgeNormsAttrib() const {
SkASSERT(1 + kNumInstanceAttribs == this->numAttribs());
const Attribute& attrib = this->getAttrib(kNumInstanceAttribs);
- SkASSERT(Attribute::InputRate::kPerVertex == attrib.fInputRate);
+ SkASSERT(Attribute::InputRate::kPerVertex == attrib.inputRate());
return attrib;
}