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

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

Issue 1110033004: Make XPFragmentBuilder only Builder with access to DstCopy. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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/GrBicubicEffect.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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 position 86 // Setup position
87 this->setupPosition(pb, gpArgs, gp.inPosition()->fName, gp.viewMatrix()); 87 this->setupPosition(pb, gpArgs, gp.inPosition()->fName, gp.viewMatrix());
88 88
89 // emit transforms with position 89 // emit transforms with position
90 this->emitTransforms(pb, gpArgs->fPositionVar, gp.inPosition()->fName, gp.lo calMatrix(), 90 this->emitTransforms(pb, gpArgs->fPositionVar, gp.inPosition()->fName, gp.lo calMatrix(),
91 args.fTransformsIn, args.fTransformsOut); 91 args.fTransformsIn, args.fTransformsOut);
92 92
93 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); 93 GrGLFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
94 fsBuilder->codeAppend("float edgeAlpha;"); 94 fsBuilder->codeAppend("float edgeAlpha;");
95 95
96 switch (fEdgeType) { 96 switch (fEdgeType) {
97 case kHairlineAA_GrProcessorEdgeType: { 97 case kHairlineAA_GrProcessorEdgeType: {
98 SkAssertResult(fsBuilder->enableFeature( 98 SkAssertResult(fsBuilder->enableFeature(
99 GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature) ); 99 GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature) );
100 fsBuilder->codeAppendf("vec3 dklmdx = dFdx(%s.xyz);", v.fsIn()); 100 fsBuilder->codeAppendf("vec3 dklmdx = dFdx(%s.xyz);", v.fsIn());
101 fsBuilder->codeAppendf("vec3 dklmdy = dFdy(%s.xyz);", v.fsIn()); 101 fsBuilder->codeAppendf("vec3 dklmdy = dFdy(%s.xyz);", v.fsIn());
102 fsBuilder->codeAppendf("float dfdx =" 102 fsBuilder->codeAppendf("float dfdx ="
103 "2.0 * %s.x * dklmdx.x - %s.y * dklmdx.z - %s .z * dklmdx.y;", 103 "2.0 * %s.x * dklmdx.x - %s.y * dklmdx.z - %s .z * dklmdx.y;",
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 this->setupColorPassThrough(args.fPB, local.fInputColorType, args.fOutputCol or, NULL, 318 this->setupColorPassThrough(args.fPB, local.fInputColorType, args.fOutputCol or, NULL,
319 &fColorUniform); 319 &fColorUniform);
320 320
321 // Setup position 321 // Setup position
322 this->setupPosition(pb, gpArgs, gp.inPosition()->fName, gp.viewMatrix()); 322 this->setupPosition(pb, gpArgs, gp.inPosition()->fName, gp.viewMatrix());
323 323
324 // emit transforms with position 324 // emit transforms with position
325 this->emitTransforms(pb, gpArgs->fPositionVar, gp.inPosition()->fName, gp.lo calMatrix(), 325 this->emitTransforms(pb, gpArgs->fPositionVar, gp.inPosition()->fName, gp.lo calMatrix(),
326 args.fTransformsIn, args.fTransformsOut); 326 args.fTransformsIn, args.fTransformsOut);
327 327
328 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); 328 GrGLFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
329 fsBuilder->codeAppendf("float edgeAlpha;"); 329 fsBuilder->codeAppendf("float edgeAlpha;");
330 330
331 switch (fEdgeType) { 331 switch (fEdgeType) {
332 case kHairlineAA_GrProcessorEdgeType: { 332 case kHairlineAA_GrProcessorEdgeType: {
333 SkAssertResult(fsBuilder->enableFeature( 333 SkAssertResult(fsBuilder->enableFeature(
334 GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature) ); 334 GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature) );
335 fsBuilder->codeAppendf("vec2 duvdx = dFdx(%s.xy);", v.fsIn()); 335 fsBuilder->codeAppendf("vec2 duvdx = dFdx(%s.xy);", v.fsIn());
336 fsBuilder->codeAppendf("vec2 duvdy = dFdy(%s.xy);", v.fsIn()); 336 fsBuilder->codeAppendf("vec2 duvdy = dFdy(%s.xy);", v.fsIn());
337 fsBuilder->codeAppendf("vec2 gF = vec2(2.0 * %s.x * duvdx.x - duvdx. y," 337 fsBuilder->codeAppendf("vec2 gF = vec2(2.0 * %s.x * duvdx.x - duvdx. y,"
338 " 2.0 * %s.x * duvdy.x - duvdy. y);", 338 " 2.0 * %s.x * duvdy.x - duvdy. y);",
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 this->setupColorPassThrough(args.fPB, local.fInputColorType, args.fOutputCol or, NULL, 532 this->setupColorPassThrough(args.fPB, local.fInputColorType, args.fOutputCol or, NULL,
533 &fColorUniform); 533 &fColorUniform);
534 534
535 // Setup position 535 // Setup position
536 this->setupPosition(args.fPB, gpArgs, gp.inPosition()->fName, gp.viewMatrix( )); 536 this->setupPosition(args.fPB, gpArgs, gp.inPosition()->fName, gp.viewMatrix( ));
537 537
538 // emit transforms with position 538 // emit transforms with position
539 this->emitTransforms(args.fPB, gpArgs->fPositionVar, gp.inPosition()->fName, gp.localMatrix(), 539 this->emitTransforms(args.fPB, gpArgs->fPositionVar, gp.inPosition()->fName, gp.localMatrix(),
540 args.fTransformsIn, args.fTransformsOut); 540 args.fTransformsIn, args.fTransformsOut);
541 541
542 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); 542 GrGLFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
543 543
544 GrGLShaderVar edgeAlpha("edgeAlpha", kFloat_GrSLType, 0, kHigh_GrSLPrecision ); 544 GrGLShaderVar edgeAlpha("edgeAlpha", kFloat_GrSLType, 0, kHigh_GrSLPrecision );
545 GrGLShaderVar dklmdx("dklmdx", kVec3f_GrSLType, 0, kHigh_GrSLPrecision); 545 GrGLShaderVar dklmdx("dklmdx", kVec3f_GrSLType, 0, kHigh_GrSLPrecision);
546 GrGLShaderVar dklmdy("dklmdy", kVec3f_GrSLType, 0, kHigh_GrSLPrecision); 546 GrGLShaderVar dklmdy("dklmdy", kVec3f_GrSLType, 0, kHigh_GrSLPrecision);
547 GrGLShaderVar dfdx("dfdx", kFloat_GrSLType, 0, kHigh_GrSLPrecision); 547 GrGLShaderVar dfdx("dfdx", kFloat_GrSLType, 0, kHigh_GrSLPrecision);
548 GrGLShaderVar dfdy("dfdy", kFloat_GrSLType, 0, kHigh_GrSLPrecision); 548 GrGLShaderVar dfdy("dfdy", kFloat_GrSLType, 0, kHigh_GrSLPrecision);
549 GrGLShaderVar gF("gF", kVec2f_GrSLType, 0, kHigh_GrSLPrecision); 549 GrGLShaderVar gF("gF", kVec2f_GrSLType, 0, kHigh_GrSLPrecision);
550 GrGLShaderVar gFM("gFM", kFloat_GrSLType, 0, kHigh_GrSLPrecision); 550 GrGLShaderVar gFM("gFM", kFloat_GrSLType, 0, kHigh_GrSLPrecision);
551 GrGLShaderVar func("func", kFloat_GrSLType, 0, kHigh_GrSLPrecision); 551 GrGLShaderVar func("func", kFloat_GrSLType, 0, kHigh_GrSLPrecision);
552 552
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 GrGeometryProcessor* gp; 696 GrGeometryProcessor* gp;
697 do { 697 do {
698 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( 698 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(
699 random->nextULessThan(kGrPro cessorEdgeTypeCnt)); 699 random->nextULessThan(kGrPro cessorEdgeTypeCnt));
700 gp = GrCubicEffect::Create(GrRandomColor(random), 700 gp = GrCubicEffect::Create(GrRandomColor(random),
701 GrTest::TestMatrix(random), edgeType, caps); 701 GrTest::TestMatrix(random), edgeType, caps);
702 } while (NULL == gp); 702 } while (NULL == gp);
703 return gp; 703 return gp;
704 } 704 }
705 705
OLDNEW
« no previous file with comments | « src/gpu/GrOvalRenderer.cpp ('k') | src/gpu/effects/GrBicubicEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698