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

Unified Diff: src/gpu/GrContext.cpp

Issue 13296005: Revise attribute binding interface (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Fix fExperimentalGS in GrGLProgramDesc Created 7 years, 9 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/GrAARectRenderer.cpp ('k') | src/gpu/GrDrawState.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrContext.cpp
===================================================================
--- src/gpu/GrContext.cpp (revision 8462)
+++ src/gpu/GrContext.cpp (working copy)
@@ -358,17 +358,13 @@
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}
};
+ drawState->setVertexAttribs(kVertexAttribs, SK_ARRAY_COUNT(kVertexAttribs));
- 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 @@
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 @@
// 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);
« no previous file with comments | « src/gpu/GrAARectRenderer.cpp ('k') | src/gpu/GrDrawState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698