Replace edge types with GrEdgeEffect.
This strips out last of the edge types and the fixed function edge attribute and replaces them with using GrEdgeEffect. Also fixes a minor bug when checking attribute counts -- it was using kAttribIndexCount instead of kVertexAttribCnt.
Original Author: jvanverth@google.com
Review URL: https://codereview.chromium.org/13069003
git-svn-id: http://skia.googlecode.com/svn/trunk@8392 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrDrawState.cpp b/src/gpu/GrDrawState.cpp
index 7982935..e108999 100644
--- a/src/gpu/GrDrawState.cpp
+++ b/src/gpu/GrDrawState.cpp
@@ -59,7 +59,7 @@
#if GR_DEBUG
uint32_t overlapCheck = 0;
#endif
- GrAssert(count <= GrDrawState::kAttribIndexCount);
+ GrAssert(count <= GrDrawState::kVertexAttribCnt);
size_t size = 0;
for (int index = 0; index < count; ++index) {
size_t attribSize = GrDrawState::kVertexAttribSizes[attribs[index].fType];
@@ -83,14 +83,13 @@
0, // position is not reflected in the bindings
kColor_AttribBindingsBit,
kCoverage_AttribBindingsBit,
- kEdge_AttribBindingsBit,
kLocalCoords_AttribBindingsBit,
};
////////////////////////////////////////////////////////////////////////////////
void GrDrawState::setVertexAttribs(const GrVertexAttrib* attribs, int count) {
- GrAssert(count <= GrDrawState::kAttribIndexCount);
+ GrAssert(count <= GrDrawState::kVertexAttribCnt);
fVertexAttribs.reset();
for (int index = 0; index < count; ++index) {
fVertexAttribs.push_back(attribs[index]);
@@ -140,18 +139,16 @@
attributeTypes[attributeIndex] = kBuiltInAttributeType;
}
}
- for (int j = kEdge_AttribIndex; j < kAttribIndexCount; ++j) {
- if (fCommon.fAttribBindings & kAttribIndexMasks[j]) {
- int attributeIndex = fAttribIndices[j];
- if (attributeIndex >= kVertexAttribCnt) {
- return false;
- }
- // they should not be shared at all
- if (attributeTypes[attributeIndex] != -1) {
- return false;
- }
- attributeTypes[attributeIndex] = kBuiltInAttributeType;
+ if (fCommon.fAttribBindings & kAttribIndexMasks[kLocalCoords_AttribIndex]) {
+ int attributeIndex = fAttribIndices[kLocalCoords_AttribIndex];
+ if (attributeIndex >= kVertexAttribCnt) {
+ return false;
}
+ // they should not be shared at all
+ if (attributeTypes[attributeIndex] != -1) {
+ return false;
+ }
+ attributeTypes[attributeIndex] = kBuiltInAttributeType;
}
// now those set by effects
@@ -371,12 +368,10 @@
}
}
- // check for coverage due to constant coverage, per-vertex coverage,
- // edge aa or coverage stage
+ // check for coverage due to constant coverage, per-vertex coverage, or coverage stage
bool hasCoverage = forceCoverage ||
0xffffffff != this->getCoverage() ||
- (bindings & GrDrawState::kCoverage_AttribBindingsBit) ||
- (bindings & GrDrawState::kEdge_AttribBindingsBit);
+ (bindings & GrDrawState::kCoverage_AttribBindingsBit);
for (int s = this->getFirstCoverageStage();
!hasCoverage && s < GrDrawState::kNumStages;
++s) {