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

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

Issue 827973002: ViewMatrix uniform upload moved to GeometryProcessor (Closed) Base URL: https://skia.googlesource.com/skia.git@vm-on-gp
Patch Set: feedback inc Created 5 years, 11 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
« no previous file with comments | « no previous file | src/gpu/GrDefaultGeoProcFactory.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 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 #include "GrAAConvexPathRenderer.h" 9 #include "GrAAConvexPathRenderer.h"
10 10
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 const BatchTracker& local = args.fBT.cast<BatchTracker>(); 534 const BatchTracker& local = args.fBT.cast<BatchTracker>();
535 535
536 // Setup pass through color 536 // Setup pass through color
537 this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputC olor, NULL, 537 this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputC olor, NULL,
538 &fColorUniform); 538 &fColorUniform);
539 539
540 // setup coord outputs 540 // setup coord outputs
541 vsBuilder->codeAppendf("%s = %s;", vsBuilder->positionCoords(), qe.i nPosition()->fName); 541 vsBuilder->codeAppendf("%s = %s;", vsBuilder->positionCoords(), qe.i nPosition()->fName);
542 vsBuilder->codeAppendf("%s = %s;", vsBuilder->localCoords(), qe.inPo sition()->fName); 542 vsBuilder->codeAppendf("%s = %s;", vsBuilder->localCoords(), qe.inPo sition()->fName);
543 543
544 // setup uniform viewMatrix
545 this->addUniformViewMatrix(pb);
546
544 // setup position varying 547 // setup position varying
545 vsBuilder->codeAppendf("%s = %s * vec3(%s, 1);", vsBuilder->glPositi on(), 548 vsBuilder->codeAppendf("%s = %s * vec3(%s, 1);", vsBuilder->glPositi on(),
546 vsBuilder->uViewM(), qe.inPosition()->fName); 549 this->uViewM(), qe.inPosition()->fName);
547 550
548 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilde r(); 551 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilde r();
549 552
550 SkAssertResult(fsBuilder->enableFeature( 553 SkAssertResult(fsBuilder->enableFeature(
551 GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature) ); 554 GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature) );
552 fsBuilder->codeAppendf("float edgeAlpha;"); 555 fsBuilder->codeAppendf("float edgeAlpha;");
553 556
554 // keep the derivative instructions outside the conditional 557 // keep the derivative instructions outside the conditional
555 fsBuilder->codeAppendf("vec2 duvdx = dFdx(%s.xy);", v.fsIn()); 558 fsBuilder->codeAppendf("vec2 duvdx = dFdx(%s.xy);", v.fsIn());
556 fsBuilder->codeAppendf("vec2 duvdy = dFdy(%s.xy);", v.fsIn()); 559 fsBuilder->codeAppendf("vec2 duvdy = dFdy(%s.xy);", v.fsIn());
(...skipping 18 matching lines...) Expand all
575 const GrGLCaps&, 578 const GrGLCaps&,
576 GrProcessorKeyBuilder* b) { 579 GrProcessorKeyBuilder* b) {
577 const BatchTracker& local = bt.cast<BatchTracker>(); 580 const BatchTracker& local = bt.cast<BatchTracker>();
578 b->add32((local.fInputColorType << 16) | 581 b->add32((local.fInputColorType << 16) |
579 (local.fUsesLocalCoords && gp.localMatrix().hasPerspective( ) ? 0x1 : 0x0)); 582 (local.fUsesLocalCoords && gp.localMatrix().hasPerspective( ) ? 0x1 : 0x0));
580 } 583 }
581 584
582 virtual void setData(const GrGLProgramDataManager& pdman, 585 virtual void setData(const GrGLProgramDataManager& pdman,
583 const GrPrimitiveProcessor& gp, 586 const GrPrimitiveProcessor& gp,
584 const GrBatchTracker& bt) SK_OVERRIDE { 587 const GrBatchTracker& bt) SK_OVERRIDE {
588 this->setUniformViewMatrix(pdman, gp.viewMatrix());
589
585 const BatchTracker& local = bt.cast<BatchTracker>(); 590 const BatchTracker& local = bt.cast<BatchTracker>();
586 if (kUniform_GrGPInput == local.fInputColorType && local.fColor != f Color) { 591 if (kUniform_GrGPInput == local.fInputColorType && local.fColor != f Color) {
587 GrGLfloat c[4]; 592 GrGLfloat c[4];
588 GrColorToRGBAFloat(local.fColor, c); 593 GrColorToRGBAFloat(local.fColor, c);
589 pdman.set4fv(fColorUniform, 1, c); 594 pdman.set4fv(fColorUniform, 1, c);
590 fColor = local.fColor; 595 fColor = local.fColor;
591 } 596 }
592 } 597 }
593 598
594 private: 599 private:
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 vOffset, // start vertex 769 vOffset, // start vertex
765 0, // start index 770 0, // start index
766 draw.fVertexCnt, 771 draw.fVertexCnt,
767 draw.fIndexCnt, 772 draw.fIndexCnt,
768 &devBounds); 773 &devBounds);
769 vOffset += draw.fVertexCnt; 774 vOffset += draw.fVertexCnt;
770 } 775 }
771 776
772 return true; 777 return true;
773 } 778 }
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrDefaultGeoProcFactory.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698