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

Side by Side Diff: src/gpu/GrDrawTarget.cpp

Issue 13296005: Revise attribute binding interface (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 10
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 instanceCount -= info.fInstanceCount; 525 instanceCount -= info.fInstanceCount;
526 } 526 }
527 } 527 }
528 528
529 //////////////////////////////////////////////////////////////////////////////// 529 ////////////////////////////////////////////////////////////////////////////////
530 530
531 void GrDrawTarget::drawRect(const GrRect& rect, 531 void GrDrawTarget::drawRect(const GrRect& rect,
532 const SkMatrix* matrix, 532 const SkMatrix* matrix,
533 const GrRect* localRect, 533 const GrRect* localRect,
534 const SkMatrix* localMatrix) { 534 const SkMatrix* localMatrix) {
535 GrAttribBindings bindings = 0;
536 // position + (optional) texture coord 535 // position + (optional) texture coord
537 static const GrVertexAttrib kAttribs[] = { 536 static const GrVertexAttrib kAttribs[] = {
538 {kVec2f_GrVertexAttribType, 0}, 537 {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBin ding},
539 {kVec2f_GrVertexAttribType, sizeof(GrPoint)} 538 {kVec2f_GrVertexAttribType, sizeof(GrPoint), kLocalCoord_GrVertexAttribB inding}
540 }; 539 };
541 int attribCount = 1; 540 int attribCount = 1;
542 541
543 if (NULL != localRect) { 542 if (NULL != localRect) {
544 bindings |= GrDrawState::kLocalCoords_AttribBindingsBit;
545 attribCount = 2; 543 attribCount = 2;
546 this->drawState()->setAttribIndex(GrDrawState::kLocalCoords_AttribIndex, 1);
547 } 544 }
548 545
549 GrDrawState::AutoViewMatrixRestore avmr; 546 GrDrawState::AutoViewMatrixRestore avmr;
550 if (NULL != matrix) { 547 if (NULL != matrix) {
551 avmr.set(this->drawState(), *matrix); 548 avmr.set(this->drawState(), *matrix);
552 } 549 }
553 550
554 this->drawState()->setVertexAttribs(kAttribs, attribCount); 551 this->drawState()->setVertexAttribs(kAttribs, attribCount);
555 this->drawState()->setAttribIndex(GrDrawState::kPosition_AttribIndex, 0);
556 this->drawState()->setAttribBindings(bindings);
557 AutoReleaseGeometry geo(this, 4, 0); 552 AutoReleaseGeometry geo(this, 4, 0);
558 if (!geo.succeeded()) { 553 if (!geo.succeeded()) {
559 GrPrintf("Failed to get space for vertices!\n"); 554 GrPrintf("Failed to get space for vertices!\n");
560 return; 555 return;
561 } 556 }
562 557
563 size_t vsize = this->drawState()->getVertexSize(); 558 size_t vsize = this->drawState()->getVertexSize();
564 geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom , vsize); 559 geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom , vsize);
565 if (NULL != localRect) { 560 if (NULL != localRect) {
566 GrAssert(attribCount == 2); 561 GrAssert(attribCount == 2);
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 GrPrintf("HW AA Lines Support : %s\n", gNY[fHWAALineSupport]); 722 GrPrintf("HW AA Lines Support : %s\n", gNY[fHWAALineSupport]);
728 GrPrintf("Shader Derivative Support : %s\n", gNY[fShaderDerivativeSupport] ); 723 GrPrintf("Shader Derivative Support : %s\n", gNY[fShaderDerivativeSupport] );
729 GrPrintf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSupport]); 724 GrPrintf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSupport]);
730 GrPrintf("Dual Source Blending Support: %s\n", gNY[fDualSourceBlendingSuppor t]); 725 GrPrintf("Dual Source Blending Support: %s\n", gNY[fDualSourceBlendingSuppor t]);
731 GrPrintf("Buffer Lock Support : %s\n", gNY[fBufferLockSupport]); 726 GrPrintf("Buffer Lock Support : %s\n", gNY[fBufferLockSupport]);
732 GrPrintf("Path Stenciling Support : %s\n", gNY[fPathStencilingSupport]); 727 GrPrintf("Path Stenciling Support : %s\n", gNY[fPathStencilingSupport]);
733 GrPrintf("Max Texture Size : %d\n", fMaxTextureSize); 728 GrPrintf("Max Texture Size : %d\n", fMaxTextureSize);
734 GrPrintf("Max Render Target Size : %d\n", fMaxRenderTargetSize); 729 GrPrintf("Max Render Target Size : %d\n", fMaxRenderTargetSize);
735 GrPrintf("Max Sample Count : %d\n", fMaxSampleCount); 730 GrPrintf("Max Sample Count : %d\n", fMaxSampleCount);
736 } 731 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698