Index: src/gpu/GrRODrawState.cpp |
diff --git a/src/gpu/GrRODrawState.cpp b/src/gpu/GrRODrawState.cpp |
index 8d6c283f7af04ee101f3274448578cd202e8d7b5..82f8c4a3331dab4b5541f2bd113dbed54c94be1f 100644 |
--- a/src/gpu/GrRODrawState.cpp |
+++ b/src/gpu/GrRODrawState.cpp |
@@ -86,26 +86,29 @@ bool GrRODrawState::validateVertexAttribs() const { |
// make sure that any attribute indices have the correct binding type, that the attrib |
// type and effect's shader lang type are compatible, and that attributes shared by |
// multiple effects use the same shader lang type. |
- const int* attributeIndices = stage.getVertexAttribIndices(); |
- int numAttributes = stage.getVertexAttribIndexCount(); |
- for (int i = 0; i < numAttributes; ++i) { |
- int attribIndex = attributeIndices[i]; |
- if (attribIndex >= fVACount || |
- kEffect_GrVertexAttribBinding != fVAPtr[attribIndex].fBinding) { |
- return false; |
+ const GrEffect::VertexAttribArray& s = effect->getVertexAttribs(); |
+ |
+ const int effectAttribCount = s.count(); |
+ int effectIndex = 0; |
+ for (int index = 0; index < fVACount; index++) { |
+ if (kEffect_GrVertexAttribBinding != fVAPtr[index].fBinding) { |
+ // we only care about effect bindings |
+ continue; |
} |
- |
- GrSLType effectSLType = effect->vertexAttribType(i); |
- GrVertexAttribType attribType = fVAPtr[attribIndex].fType; |
+ SkASSERT(effectIndex < effectAttribCount); |
+ GrSLType effectSLType = s[effectIndex].getType(); |
+ GrVertexAttribType attribType = fVAPtr[index].fType; |
int slVecCount = GrSLTypeVectorCount(effectSLType); |
int attribVecCount = GrVertexAttribTypeVectorCount(attribType); |
if (slVecCount != attribVecCount || |
- (static_cast<GrSLType>(-1) != slTypes[attribIndex] && |
- slTypes[attribIndex] != effectSLType)) { |
+ (static_cast<GrSLType>(-1) != slTypes[index] && slTypes[index] != effectSLType)) { |
return false; |
} |
- slTypes[attribIndex] = effectSLType; |
+ slTypes[index] = effectSLType; |
+ effectIndex++; |
} |
+ // Make sure all attributes are consumed and we were able to find everything |
+ SkASSERT(effectAttribCount == effectIndex); |
} |
return true; |