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

Side by Side Diff: src/gpu/effects/GrBezierEffect.cpp

Issue 920933002: fix for uniform view matrix being uploaded but not used (Closed) Base URL: https://skia.googlesource.com/skia.git@gp_cleanup_1
Patch Set: Created 5 years, 10 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 | « src/gpu/GrOvalRenderer.cpp ('k') | src/gpu/effects/GrBitmapTextGeoProc.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 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrBezierEffect.h" 8 #include "GrBezierEffect.h"
9 9
10 #include "gl/GrGLProcessor.h" 10 #include "gl/GrGLProcessor.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 vsBuilder->emitAttributes(gp); 76 vsBuilder->emitAttributes(gp);
77 77
78 GrGLVertToFrag v(kVec4f_GrSLType); 78 GrGLVertToFrag v(kVec4f_GrSLType);
79 args.fPB->addVarying("ConicCoeffs", &v); 79 args.fPB->addVarying("ConicCoeffs", &v);
80 vsBuilder->codeAppendf("%s = %s;", v.vsOut(), gp.inConicCoeffs()->fName); 80 vsBuilder->codeAppendf("%s = %s;", v.vsOut(), gp.inConicCoeffs()->fName);
81 81
82 // Setup pass through color 82 // Setup pass through color
83 this->setupColorPassThrough(args.fPB, local.fInputColorType, args.fOutputCol or, NULL, 83 this->setupColorPassThrough(args.fPB, local.fInputColorType, args.fOutputCol or, NULL,
84 &fColorUniform); 84 &fColorUniform);
85 85
86 // setup uniform viewMatrix
87 this->addUniformViewMatrix(pb);
88
89 // Setup position 86 // Setup position
90 SetupPosition(vsBuilder, gpArgs, gp.inPosition()->fName, gp.viewMatrix(), th is->uViewM()); 87 this->setupPosition(pb, gpArgs, gp.inPosition()->fName, gp.viewMatrix());
91 88
92 // emit transforms with position 89 // emit transforms with position
93 this->emitTransforms(pb, gpArgs->fPositionVar, gp.inPosition()->fName, gp.lo calMatrix(), 90 this->emitTransforms(pb, gpArgs->fPositionVar, gp.inPosition()->fName, gp.lo calMatrix(),
94 args.fTransformsIn, args.fTransformsOut); 91 args.fTransformsIn, args.fTransformsOut);
95 92
96 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); 93 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
97 fsBuilder->codeAppend("float edgeAlpha;"); 94 fsBuilder->codeAppend("float edgeAlpha;");
98 95
99 switch (fEdgeType) { 96 switch (fEdgeType) {
100 case kHairlineAA_GrProcessorEdgeType: { 97 case kHairlineAA_GrProcessorEdgeType: {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 fsBuilder->codeAppend("edgeAlpha = float(edgeAlpha < 0.0);"); 143 fsBuilder->codeAppend("edgeAlpha = float(edgeAlpha < 0.0);");
147 break; 144 break;
148 } 145 }
149 default: 146 default:
150 SkFAIL("Shouldn't get here"); 147 SkFAIL("Shouldn't get here");
151 } 148 }
152 149
153 if (0xff != local.fCoverageScale) { 150 if (0xff != local.fCoverageScale) {
154 const char* coverageScale; 151 const char* coverageScale;
155 fCoverageScaleUniform = pb->addUniform(GrGLProgramBuilder::kFragment_Vis ibility, 152 fCoverageScaleUniform = pb->addUniform(GrGLProgramBuilder::kFragment_Vis ibility,
156 kFloat_GrSLType, 153 kFloat_GrSLType,
157 kDefault_GrSLPrecision, 154 kDefault_GrSLPrecision,
158 "Coverage", 155 "Coverage",
159 &coverageScale); 156 &coverageScale);
160 fsBuilder->codeAppendf("%s = vec4(%s * edgeAlpha);", args.fOutputCoverag e, coverageScale); 157 fsBuilder->codeAppendf("%s = vec4(%s * edgeAlpha);", args.fOutputCoverag e, coverageScale);
161 } else { 158 } else {
162 fsBuilder->codeAppendf("%s = vec4(edgeAlpha);", args.fOutputCoverage); 159 fsBuilder->codeAppendf("%s = vec4(edgeAlpha);", args.fOutputCoverage);
163 } 160 }
164 } 161 }
165 162
166 void GrGLConicEffect::GenKey(const GrGeometryProcessor& gp, 163 void GrGLConicEffect::GenKey(const GrGeometryProcessor& gp,
167 const GrBatchTracker& bt, 164 const GrBatchTracker& bt,
168 const GrGLCaps&, 165 const GrGLCaps&,
169 GrProcessorKeyBuilder* b) { 166 GrProcessorKeyBuilder* b) {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 vsBuilder->emitAttributes(gp); 311 vsBuilder->emitAttributes(gp);
315 312
316 GrGLVertToFrag v(kVec4f_GrSLType); 313 GrGLVertToFrag v(kVec4f_GrSLType);
317 args.fPB->addVarying("HairQuadEdge", &v); 314 args.fPB->addVarying("HairQuadEdge", &v);
318 vsBuilder->codeAppendf("%s = %s;", v.vsOut(), gp.inHairQuadEdge()->fName); 315 vsBuilder->codeAppendf("%s = %s;", v.vsOut(), gp.inHairQuadEdge()->fName);
319 316
320 // Setup pass through color 317 // Setup pass through color
321 this->setupColorPassThrough(args.fPB, local.fInputColorType, args.fOutputCol or, NULL, 318 this->setupColorPassThrough(args.fPB, local.fInputColorType, args.fOutputCol or, NULL,
322 &fColorUniform); 319 &fColorUniform);
323 320
324 // setup uniform viewMatrix
325 this->addUniformViewMatrix(pb);
326
327 // Setup position 321 // Setup position
328 SetupPosition(vsBuilder, gpArgs, gp.inPosition()->fName, gp.viewMatrix(), th is->uViewM()); 322 this->setupPosition(pb, gpArgs, gp.inPosition()->fName, gp.viewMatrix());
329 323
330 // emit transforms with position 324 // emit transforms with position
331 this->emitTransforms(pb, gpArgs->fPositionVar, gp.inPosition()->fName, gp.lo calMatrix(), 325 this->emitTransforms(pb, gpArgs->fPositionVar, gp.inPosition()->fName, gp.lo calMatrix(),
332 args.fTransformsIn, args.fTransformsOut); 326 args.fTransformsIn, args.fTransformsOut);
333 327
334 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); 328 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
335 fsBuilder->codeAppendf("float edgeAlpha;"); 329 fsBuilder->codeAppendf("float edgeAlpha;");
336 330
337 switch (fEdgeType) { 331 switch (fEdgeType) {
338 case kHairlineAA_GrProcessorEdgeType: { 332 case kHairlineAA_GrProcessorEdgeType: {
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 vsBuilder->emitAttributes(gp); 525 vsBuilder->emitAttributes(gp);
532 526
533 GrGLVertToFrag v(kVec4f_GrSLType); 527 GrGLVertToFrag v(kVec4f_GrSLType);
534 args.fPB->addVarying("CubicCoeffs", &v, kHigh_GrSLPrecision); 528 args.fPB->addVarying("CubicCoeffs", &v, kHigh_GrSLPrecision);
535 vsBuilder->codeAppendf("%s = %s;", v.vsOut(), gp.inCubicCoeffs()->fName); 529 vsBuilder->codeAppendf("%s = %s;", v.vsOut(), gp.inCubicCoeffs()->fName);
536 530
537 // Setup pass through color 531 // Setup pass through color
538 this->setupColorPassThrough(args.fPB, local.fInputColorType, args.fOutputCol or, NULL, 532 this->setupColorPassThrough(args.fPB, local.fInputColorType, args.fOutputCol or, NULL,
539 &fColorUniform); 533 &fColorUniform);
540 534
541 // setup uniform viewMatrix
542 this->addUniformViewMatrix(args.fPB);
543
544 // Setup position 535 // Setup position
545 SetupPosition(vsBuilder, gpArgs, gp.inPosition()->fName, gp.viewMatrix(), th is->uViewM()); 536 this->setupPosition(args.fPB, gpArgs, gp.inPosition()->fName, gp.viewMatrix( ));
546 537
547 // emit transforms with position 538 // emit transforms with position
548 this->emitTransforms(args.fPB, gpArgs->fPositionVar, gp.inPosition()->fName, gp.localMatrix(), 539 this->emitTransforms(args.fPB, gpArgs->fPositionVar, gp.inPosition()->fName, gp.localMatrix(),
549 args.fTransformsIn, args.fTransformsOut); 540 args.fTransformsIn, args.fTransformsOut);
550 541
551 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); 542 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
552 543
553 GrGLShaderVar edgeAlpha("edgeAlpha", kFloat_GrSLType, 0, kHigh_GrSLPrecision ); 544 GrGLShaderVar edgeAlpha("edgeAlpha", kFloat_GrSLType, 0, kHigh_GrSLPrecision );
554 GrGLShaderVar dklmdx("dklmdx", kVec3f_GrSLType, 0, kHigh_GrSLPrecision); 545 GrGLShaderVar dklmdx("dklmdx", kVec3f_GrSLType, 0, kHigh_GrSLPrecision);
555 GrGLShaderVar dklmdy("dklmdy", kVec3f_GrSLType, 0, kHigh_GrSLPrecision); 546 GrGLShaderVar dklmdy("dklmdy", kVec3f_GrSLType, 0, kHigh_GrSLPrecision);
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 GrGeometryProcessor* gp; 696 GrGeometryProcessor* gp;
706 do { 697 do {
707 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( 698 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(
708 random->nextULessThan(kGrPro cessorEdgeTypeCnt)); 699 random->nextULessThan(kGrPro cessorEdgeTypeCnt));
709 gp = GrCubicEffect::Create(GrRandomColor(random), 700 gp = GrCubicEffect::Create(GrRandomColor(random),
710 GrProcessorUnitTest::TestMatrix(random), edge Type, caps); 701 GrProcessorUnitTest::TestMatrix(random), edge Type, caps);
711 } while (NULL == gp); 702 } while (NULL == gp);
712 return gp; 703 return gp;
713 } 704 }
714 705
OLDNEW
« no previous file with comments | « src/gpu/GrOvalRenderer.cpp ('k') | src/gpu/effects/GrBitmapTextGeoProc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698