Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Unified Diff: src/gpu/GrRODrawState.cpp

Issue 543623004: Removing vertex attrib indices (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: warning fixed Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrOvalRenderer.cpp ('k') | src/gpu/effects/GrBezierEffect.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrRODrawState.cpp
diff --git a/src/gpu/GrRODrawState.cpp b/src/gpu/GrRODrawState.cpp
index b79e8fce4340df6253c676610b6682a05dea7037..f7e486f925983522c936d5dc6f96bdf3245dd69f 100644
--- a/src/gpu/GrRODrawState.cpp
+++ b/src/gpu/GrRODrawState.cpp
@@ -93,26 +93,28 @@ 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();
- GrSLType effectSLType = effect->vertexAttribType(i);
- GrVertexAttribType attribType = fVAPtr[attribIndex].fType;
+ int effectIndex = 0;
+ for (int index = 0; index < fVACount; index++) {
+ if (kEffect_GrVertexAttribBinding != fVAPtr[index].fBinding) {
+ // we only care about effect bindings
+ continue;
+ }
+ SkASSERT(effectIndex < s.count());
+ 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(s.count() == effectIndex);
}
return true;
« no previous file with comments | « src/gpu/GrOvalRenderer.cpp ('k') | src/gpu/effects/GrBezierEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698