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

Side by Side Diff: src/gpu/GrOvalRenderer.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/GrGeometryProcessor.cpp ('k') | src/gpu/effects/GrBezierEffect.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 "GrOvalRenderer.h" 8 #include "GrOvalRenderer.h"
9 9
10 #include "GrBatch.h" 10 #include "GrBatch.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 vsBuilder->emitAttributes(ce); 98 vsBuilder->emitAttributes(ce);
99 99
100 GrGLVertToFrag v(kVec4f_GrSLType); 100 GrGLVertToFrag v(kVec4f_GrSLType);
101 args.fPB->addVarying("CircleEdge", &v); 101 args.fPB->addVarying("CircleEdge", &v);
102 vsBuilder->codeAppendf("%s = %s;", v.vsOut(), ce.inCircleEdge()->fNa me); 102 vsBuilder->codeAppendf("%s = %s;", v.vsOut(), ce.inCircleEdge()->fNa me);
103 103
104 // Setup pass through color 104 // Setup pass through color
105 this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputC olor, NULL, 105 this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputC olor, NULL,
106 &fColorUniform); 106 &fColorUniform);
107 107
108 // setup uniform viewMatrix
109 this->addUniformViewMatrix(pb);
110
111 // Setup position 108 // Setup position
112 SetupPosition(vsBuilder, gpArgs, ce.inPosition()->fName, 109 this->setupPosition(pb, gpArgs, ce.inPosition()->fName, ce.viewMatri x());
113 ce.viewMatrix(), this->uViewM());
114 110
115 // emit transforms 111 // emit transforms
116 this->emitTransforms(args.fPB, gpArgs->fPositionVar, ce.inPosition() ->fName, 112 this->emitTransforms(args.fPB, gpArgs->fPositionVar, ce.inPosition() ->fName,
117 ce.localMatrix(), args.fTransformsIn, args.fTra nsformsOut);; 113 ce.localMatrix(), args.fTransformsIn, args.fTra nsformsOut);;
118 114
119 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilde r(); 115 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilde r();
120 fsBuilder->codeAppendf("float d = length(%s.xy);", v.fsIn()); 116 fsBuilder->codeAppendf("float d = length(%s.xy);", v.fsIn());
121 fsBuilder->codeAppendf("float edgeAlpha = clamp(%s.z * (1.0 - d), 0. 0, 1.0);", v.fsIn()); 117 fsBuilder->codeAppendf("float edgeAlpha = clamp(%s.z * (1.0 - d), 0. 0, 1.0);", v.fsIn());
122 if (ce.isStroked()) { 118 if (ce.isStroked()) {
123 fsBuilder->codeAppendf("float innerAlpha = clamp(%s.z * (d - %s. w), 0.0, 1.0);", 119 fsBuilder->codeAppendf("float innerAlpha = clamp(%s.z * (d - %s. w), 0.0, 1.0);",
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 277
282 GrGLVertToFrag ellipseRadii(kVec4f_GrSLType); 278 GrGLVertToFrag ellipseRadii(kVec4f_GrSLType);
283 args.fPB->addVarying("EllipseRadii", &ellipseRadii); 279 args.fPB->addVarying("EllipseRadii", &ellipseRadii);
284 vsBuilder->codeAppendf("%s = %s;", ellipseRadii.vsOut(), 280 vsBuilder->codeAppendf("%s = %s;", ellipseRadii.vsOut(),
285 ee.inEllipseRadii()->fName); 281 ee.inEllipseRadii()->fName);
286 282
287 // Setup pass through color 283 // Setup pass through color
288 this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputC olor, NULL, 284 this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputC olor, NULL,
289 &fColorUniform); 285 &fColorUniform);
290 286
291 // setup uniform viewMatrix
292 this->addUniformViewMatrix(pb);
293
294 // Setup position 287 // Setup position
295 SetupPosition(vsBuilder, gpArgs, ee.inPosition()->fName, 288 this->setupPosition(pb, gpArgs, ee.inPosition()->fName, ee.viewMatri x());
296 ee.viewMatrix(), this->uViewM());
297 289
298 // emit transforms 290 // emit transforms
299 this->emitTransforms(args.fPB, gpArgs->fPositionVar, ee.inPosition() ->fName, 291 this->emitTransforms(args.fPB, gpArgs->fPositionVar, ee.inPosition() ->fName,
300 ee.localMatrix(), args.fTransformsIn, args.fTra nsformsOut); 292 ee.localMatrix(), args.fTransformsIn, args.fTra nsformsOut);
301 293
302 // for outer curve 294 // for outer curve
303 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilde r(); 295 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilde r();
304 fsBuilder->codeAppendf("vec2 scaledOffset = %s*%s.xy;", ellipseOffse ts.fsIn(), 296 fsBuilder->codeAppendf("vec2 scaledOffset = %s*%s.xy;", ellipseOffse ts.fsIn(),
305 ellipseRadii.fsIn()); 297 ellipseRadii.fsIn());
306 fsBuilder->codeAppend("float test = dot(scaledOffset, scaledOffset) - 1.0;"); 298 fsBuilder->codeAppend("float test = dot(scaledOffset, scaledOffset) - 1.0;");
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 478
487 GrGLVertToFrag offsets1(kVec2f_GrSLType); 479 GrGLVertToFrag offsets1(kVec2f_GrSLType);
488 args.fPB->addVarying("EllipseOffsets1", &offsets1); 480 args.fPB->addVarying("EllipseOffsets1", &offsets1);
489 vsBuilder->codeAppendf("%s = %s;", offsets1.vsOut(), 481 vsBuilder->codeAppendf("%s = %s;", offsets1.vsOut(),
490 ee.inEllipseOffsets1()->fName); 482 ee.inEllipseOffsets1()->fName);
491 483
492 // Setup pass through color 484 // Setup pass through color
493 this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputC olor, NULL, 485 this->setupColorPassThrough(pb, local.fInputColorType, args.fOutputC olor, NULL,
494 &fColorUniform); 486 &fColorUniform);
495 487
496 // setup uniform viewMatrix
497 this->addUniformViewMatrix(pb);
498
499 // Setup position 488 // Setup position
500 SetupPosition(vsBuilder, gpArgs, ee.inPosition()->fName, 489 this->setupPosition(pb, gpArgs, ee.inPosition()->fName, ee.viewMatri x());
501 ee.viewMatrix(), this->uViewM());
502 490
503 // emit transforms 491 // emit transforms
504 this->emitTransforms(args.fPB, gpArgs->fPositionVar, ee.inPosition() ->fName, 492 this->emitTransforms(args.fPB, gpArgs->fPositionVar, ee.inPosition() ->fName,
505 ee.localMatrix(), args.fTransformsIn, args.fTra nsformsOut); 493 ee.localMatrix(), args.fTransformsIn, args.fTra nsformsOut);
506 494
507 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilde r(); 495 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilde r();
508 SkAssertResult(fsBuilder->enableFeature( 496 SkAssertResult(fsBuilder->enableFeature(
509 GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature) ); 497 GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature) );
510 // for outer curve 498 // for outer curve
511 fsBuilder->codeAppendf("vec2 scaledOffset = %s.xy;", offsets0.fsIn() ); 499 fsBuilder->codeAppendf("vec2 scaledOffset = %s.xy;", offsets0.fsIn() );
(...skipping 1723 matching lines...) Expand 10 before | Expand all | Expand 10 after
2235 geometry.fInnerXRadius = innerXRadius; 2223 geometry.fInnerXRadius = innerXRadius;
2236 geometry.fInnerYRadius = innerYRadius; 2224 geometry.fInnerYRadius = innerYRadius;
2237 geometry.fStroke = isStrokeOnly; 2225 geometry.fStroke = isStrokeOnly;
2238 geometry.fDevBounds = bounds; 2226 geometry.fDevBounds = bounds;
2239 2227
2240 SkAutoTUnref<GrBatch> batch(RRectEllipseRendererBatch::Create(geometry, indexBuffer)); 2228 SkAutoTUnref<GrBatch> batch(RRectEllipseRendererBatch::Create(geometry, indexBuffer));
2241 target->drawBatch(pipelineBuilder, batch, &bounds); 2229 target->drawBatch(pipelineBuilder, batch, &bounds);
2242 } 2230 }
2243 return true; 2231 return true;
2244 } 2232 }
OLDNEW
« no previous file with comments | « src/gpu/GrGeometryProcessor.cpp ('k') | src/gpu/effects/GrBezierEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698