aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrContext.cpp
diff options
context:
space:
mode:
authorGravatar jvanverth@google.com <jvanverth@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-04-01 20:06:51 +0000
committerGravatar jvanverth@google.com <jvanverth@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-04-01 20:06:51 +0000
commit054ae99d93711c26e40682a0e3a03a47ea605c53 (patch)
tree9769952514a25fe77774f14fecd311d52c3ac068 /src/gpu/GrContext.cpp
parentc7bf2963f00a29bd28e5e2a446da79f93c1d9383 (diff)
Take two for r8466:
Replace the old attribute binding and index interface with one where we include the binding as part of the attribute array. Also removed the fixed attribute indices for constant color and coverage attributes, and replaced with dynamic ones based on current attribute set. Removed binding of color and coverage attributes unless they're actually set. Original author: bsalomon@google.com Author: jvanverth@google.com Reviewed By: bsalomon@google.com,robertphillips@google.com Review URL: https://chromiumcodereview.appspot.com/13296005 git-svn-id: http://skia.googlecode.com/svn/trunk@8468 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/GrContext.cpp')
-rw-r--r--src/gpu/GrContext.cpp26
1 files changed, 8 insertions, 18 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 32b4d6ae9c..85b2c83384 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -358,17 +358,13 @@ GrTexture* GrContext::createResizedTexture(const GrTextureDesc& desc,
GrTextureParams params(SkShader::kClamp_TileMode, needsFiltering);
drawState->createTextureEffect(0, clampedTexture, SkMatrix::I(), params);
- // position + texture coordinate
+ // position + local coordinate
static const GrVertexAttrib kVertexAttribs[] = {
- {kVec2f_GrVertexAttribType, 0},
- {kVec2f_GrVertexAttribType, sizeof(GrPoint)}
+ {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBinding},
+ {kVec2f_GrVertexAttribType, sizeof(GrPoint), kLocalCoord_GrVertexAttribBinding}
};
-
- static const GrAttribBindings kAttribBindings = GrDrawState::kLocalCoords_AttribBindingsBit;
- drawState->setAttribBindings(kAttribBindings);
drawState->setVertexAttribs(kVertexAttribs, SK_ARRAY_COUNT(kVertexAttribs));
- drawState->setAttribIndex(GrDrawState::kPosition_AttribIndex, 0);
- drawState->setAttribIndex(GrDrawState::kLocalCoords_AttribIndex, 1);
+
GrDrawTarget::AutoReleaseGeometry arg(fGpu, 4, 0);
if (arg.succeeded()) {
@@ -925,19 +921,16 @@ void GrContext::drawVertices(const GrPaint& paint,
GrVertexAttribArray<3> attribs;
size_t currentOffset = 0;
int colorOffset = -1, texOffset = -1;
- GrAttribBindings bindings = GrDrawState::kDefault_AttribBindings;
// set position attribute
- drawState->setAttribIndex(GrDrawState::kPosition_AttribIndex, attribs.count());
- GrVertexAttrib currAttrib = {kVec2f_GrVertexAttribType, currentOffset};
+ GrVertexAttrib currAttrib =
+ {kVec2f_GrVertexAttribType, currentOffset, kPosition_GrVertexAttribBinding};
attribs.push_back(currAttrib);
currentOffset += sizeof(GrPoint);
// set up optional texture coordinate attributes
if (NULL != texCoords) {
- bindings |= GrDrawState::kLocalCoords_AttribBindingsBit;
- drawState->setAttribIndex(GrDrawState::kLocalCoords_AttribIndex, attribs.count());
- currAttrib.set(kVec2f_GrVertexAttribType, currentOffset);
+ currAttrib.set(kVec2f_GrVertexAttribType, currentOffset, kLocalCoord_GrVertexAttribBinding);
attribs.push_back(currAttrib);
texOffset = currentOffset;
currentOffset += sizeof(GrPoint);
@@ -945,16 +938,13 @@ void GrContext::drawVertices(const GrPaint& paint,
// set up optional color attributes
if (NULL != colors) {
- bindings |= GrDrawState::kColor_AttribBindingsBit;
- drawState->setAttribIndex(GrDrawState::kColor_AttribIndex, attribs.count());
- currAttrib.set(kVec4ub_GrVertexAttribType, currentOffset);
+ currAttrib.set(kVec4ub_GrVertexAttribType, currentOffset, kColor_GrVertexAttribBinding);
attribs.push_back(currAttrib);
colorOffset = currentOffset;
currentOffset += sizeof(GrColor);
}
drawState->setVertexAttribs(attribs.begin(), attribs.count());
- drawState->setAttribBindings(bindings);
size_t vertexSize = drawState->getVertexSize();
GrAssert(vertexSize == currentOffset);