OLD | NEW |
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 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 const BatchTracker& local = args.fBT.cast<BatchTracker>(); | 536 const BatchTracker& local = args.fBT.cast<BatchTracker>(); |
537 | 537 |
538 // Setup pass through color | 538 // Setup pass through color |
539 this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputC
olor, NULL, | 539 this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputC
olor, NULL, |
540 &fColorUniform); | 540 &fColorUniform); |
541 | 541 |
542 // setup coord outputs | 542 // setup coord outputs |
543 vsBuilder->codeAppendf("%s = %s;", vsBuilder->positionCoords(), qe.i
nPosition()->fName); | 543 vsBuilder->codeAppendf("%s = %s;", vsBuilder->positionCoords(), qe.i
nPosition()->fName); |
544 vsBuilder->codeAppendf("%s = %s;", vsBuilder->localCoords(), qe.inPo
sition()->fName); | 544 vsBuilder->codeAppendf("%s = %s;", vsBuilder->localCoords(), qe.inPo
sition()->fName); |
545 | 545 |
| 546 // setup uniform viewMatrix |
| 547 this->setupUniformViewMatrix(pb); |
| 548 |
546 // setup position varying | 549 // setup position varying |
547 vsBuilder->codeAppendf("%s = %s * vec3(%s, 1);", vsBuilder->glPositi
on(), | 550 vsBuilder->codeAppendf("%s = %s * vec3(%s, 1);", vsBuilder->glPositi
on(), |
548 vsBuilder->uViewM(), qe.inPosition()->fName); | 551 this->uViewM(), qe.inPosition()->fName); |
549 | 552 |
550 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilde
r(); | 553 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilde
r(); |
551 | 554 |
552 SkAssertResult(fsBuilder->enableFeature( | 555 SkAssertResult(fsBuilder->enableFeature( |
553 GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature)
); | 556 GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature)
); |
554 fsBuilder->codeAppendf("float edgeAlpha;"); | 557 fsBuilder->codeAppendf("float edgeAlpha;"); |
555 | 558 |
556 // keep the derivative instructions outside the conditional | 559 // keep the derivative instructions outside the conditional |
557 fsBuilder->codeAppendf("vec2 duvdx = dFdx(%s.xy);", v.fsIn()); | 560 fsBuilder->codeAppendf("vec2 duvdx = dFdx(%s.xy);", v.fsIn()); |
558 fsBuilder->codeAppendf("vec2 duvdy = dFdy(%s.xy);", v.fsIn()); | 561 fsBuilder->codeAppendf("vec2 duvdy = dFdy(%s.xy);", v.fsIn()); |
(...skipping 18 matching lines...) Expand all Loading... |
577 const GrGLCaps&, | 580 const GrGLCaps&, |
578 GrProcessorKeyBuilder* b) { | 581 GrProcessorKeyBuilder* b) { |
579 const BatchTracker& local = bt.cast<BatchTracker>(); | 582 const BatchTracker& local = bt.cast<BatchTracker>(); |
580 b->add32((local.fInputColorType << 16) | | 583 b->add32((local.fInputColorType << 16) | |
581 (local.fUsesLocalCoords && gp.localMatrix().hasPerspective(
) ? 0x1 : 0x0)); | 584 (local.fUsesLocalCoords && gp.localMatrix().hasPerspective(
) ? 0x1 : 0x0)); |
582 } | 585 } |
583 | 586 |
584 virtual void setData(const GrGLProgramDataManager& pdman, | 587 virtual void setData(const GrGLProgramDataManager& pdman, |
585 const GrPrimitiveProcessor& gp, | 588 const GrPrimitiveProcessor& gp, |
586 const GrBatchTracker& bt) SK_OVERRIDE { | 589 const GrBatchTracker& bt) SK_OVERRIDE { |
| 590 this->setUniformViewMatrix(pdman, gp.viewMatrix()); |
| 591 |
587 const BatchTracker& local = bt.cast<BatchTracker>(); | 592 const BatchTracker& local = bt.cast<BatchTracker>(); |
588 if (kUniform_GrGPInput == local.fInputColorType && local.fColor != f
Color) { | 593 if (kUniform_GrGPInput == local.fInputColorType && local.fColor != f
Color) { |
589 GrGLfloat c[4]; | 594 GrGLfloat c[4]; |
590 GrColorToRGBAFloat(local.fColor, c); | 595 GrColorToRGBAFloat(local.fColor, c); |
591 pdman.set4fv(fColorUniform, 1, c); | 596 pdman.set4fv(fColorUniform, 1, c); |
592 fColor = local.fColor; | 597 fColor = local.fColor; |
593 } | 598 } |
594 } | 599 } |
595 | 600 |
596 private: | 601 private: |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 vOffset, // start vertex | 774 vOffset, // start vertex |
770 0, // start index | 775 0, // start index |
771 draw.fVertexCnt, | 776 draw.fVertexCnt, |
772 draw.fIndexCnt, | 777 draw.fIndexCnt, |
773 &devBounds); | 778 &devBounds); |
774 vOffset += draw.fVertexCnt; | 779 vOffset += draw.fVertexCnt; |
775 } | 780 } |
776 | 781 |
777 return true; | 782 return true; |
778 } | 783 } |
OLD | NEW |