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/GrAAHairLinePathRenderer.cpp b/src/gpu/GrAAHairLinePathRenderer.cpp
index 00982ee..a2ad9e3 100644
--- a/src/gpu/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/GrAAHairLinePathRenderer.cpp
@@ -495,15 +495,20 @@
int* lineCnt,
int* quadCnt,
GrDrawTarget::AutoReleaseGeometry* arg) {
- const GrDrawState& drawState = target->getDrawState();
- int rtHeight = drawState.getRenderTarget()->height();
+ GrDrawState* drawState = target->drawState();
+ int rtHeight = drawState->getRenderTarget()->height();
GrIRect devClipBounds;
- target->getClip()->getConservativeBounds(drawState.getRenderTarget(),
+ target->getClip()->getConservativeBounds(drawState->getRenderTarget(),
&devClipBounds);
- GrVertexLayout layout = GrDrawState::kEdge_VertexLayoutBit;
- SkMatrix viewM = drawState.getViewMatrix();
+ // position + edge
+ static const GrVertexAttrib kAttribs[] = {
+ GrVertexAttrib(kVec2f_GrVertexAttribType, 0),
+ GrVertexAttrib(kVec4f_GrVertexAttribType, sizeof(GrPoint))
+ };
+ static const GrAttribBindings kBindings = GrDrawState::kEdge_AttribBindingsBit;
+ SkMatrix viewM = drawState->getViewMatrix();
PREALLOC_PTARRAY(128) lines;
PREALLOC_PTARRAY(128) quads;
@@ -514,7 +519,10 @@
*lineCnt = lines.count() / 2;
int vertCnt = kVertsPerLineSeg * *lineCnt + kVertsPerQuad * *quadCnt;
- target->drawState()->setVertexLayout(layout);
+ target->drawState()->setVertexAttribs(kAttribs, SK_ARRAY_COUNT(kAttribs));
+ target->drawState()->setAttribIndex(GrDrawState::kPosition_AttribIndex, 0);
+ target->drawState()->setAttribIndex(GrDrawState::kEdge_AttribIndex, 1);
+ target->drawState()->setAttribBindings(kBindings);
GrAssert(sizeof(Vertex) == target->getDrawState().getVertexSize());
if (!arg->set(target, vertCnt, 0)) {