Add new vertex attribute array specification.
This changes the old method of setting vertex layout to a new one where we
specify vertex attribute data separately from attribute bindings (i.e. program
functionality). Attribute data is now set up via an array of generic attribute
types and offsets, and this is mapped to the old program functionality by
setting specific attribute indices. This allows us to create more general
inputs to shaders.
git-svn-id: http://skia.googlecode.com/svn/trunk@7899 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp
index 98eaab8..46e75a0 100644
--- a/src/gpu/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/GrAAConvexPathRenderer.cpp
@@ -453,9 +453,6 @@
}
const SkMatrix* vm = &adcd.getOriginalMatrix();
- GrVertexLayout layout = 0;
- layout |= GrDrawState::kEdge_VertexLayoutBit;
-
// We use the fact that SkPath::transform path does subdivision based on
// perspective. Otherwise, we apply the view matrix when copying to the
// segment representation.
@@ -481,11 +478,22 @@
return false;
}
- drawState->setVertexLayout(layout);
+ // position + edge
+ static const GrVertexAttrib kAttribs[] = {
+ GrVertexAttrib(kVec2f_GrVertexAttribType, 0),
+ GrVertexAttrib(kVec4f_GrVertexAttribType, sizeof(GrPoint))
+ };
+ static const GrAttribBindings bindings = GrDrawState::kEdge_AttribBindingsBit;
+
+ drawState->setVertexAttribs(kAttribs, SK_ARRAY_COUNT(kAttribs));
+ drawState->setAttribIndex(GrDrawState::kPosition_AttribIndex, 0);
+ drawState->setAttribIndex(GrDrawState::kEdge_AttribIndex, 1);
+ drawState->setAttribBindings(bindings);
GrDrawTarget::AutoReleaseGeometry arg(target, vCount, iCount);
if (!arg.succeeded()) {
return false;
}
+ GrAssert(sizeof(QuadVertex) == drawState->getVertexSize());
verts = reinterpret_cast<QuadVertex*>(arg.vertices());
idxs = reinterpret_cast<uint16_t*>(arg.indices());