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

Side by Side Diff: src/gpu/batches/GrPLSPathRenderer.cpp

Issue 2437063002: re-re-land of skslc now automatically turns on derivatives support (Closed)
Patch Set: Created 4 years, 2 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/batches/GrAAConvexPathRenderer.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 2015 Google Inc. 2 * Copyright 2015 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 "GrPLSPathRenderer.h" 8 #include "GrPLSPathRenderer.h"
9 9
10 #include "SkChunkAlloc.h" 10 #include "SkChunkAlloc.h"
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 windings.vsOut(), te.inWindings()->fName); 332 windings.vsOut(), te.inWindings()->fName);
333 333
334 // emit transforms 334 // emit transforms
335 this->emitTransforms(vsBuilder, varyingHandler, uniformHandler, gpAr gs->fPositionVar, 335 this->emitTransforms(vsBuilder, varyingHandler, uniformHandler, gpAr gs->fPositionVar,
336 te.inPosition()->fName, te.localMatrix(), 336 te.inPosition()->fName, te.localMatrix(),
337 args.fFPCoordTransformHandler); 337 args.fFPCoordTransformHandler);
338 338
339 GrGLSLPPFragmentBuilder* fsBuilder = args.fFragBuilder; 339 GrGLSLPPFragmentBuilder* fsBuilder = args.fFragBuilder;
340 SkAssertResult(fsBuilder->enableFeature( 340 SkAssertResult(fsBuilder->enableFeature(
341 GrGLSLFragmentShaderBuilder::kPixelLocalStorage_GLSLF eature)); 341 GrGLSLFragmentShaderBuilder::kPixelLocalStorage_GLSLF eature));
342 SkAssertResult(fsBuilder->enableFeature(
343 GrGLSLFragmentShaderBuilder::kStandardDerivatives_GLSLFeatur e));
344 fsBuilder->declAppendf(GR_GL_PLS_PATH_DATA_DECL); 342 fsBuilder->declAppendf(GR_GL_PLS_PATH_DATA_DECL);
345 // Compute four subsamples, each shifted a quarter pixel along x and y from 343 // Compute four subsamples, each shifted a quarter pixel along x and y from
346 // gl_FragCoord. The oriented box positioning of the subsamples is o f course not 344 // gl_FragCoord. The oriented box positioning of the subsamples is o f course not
347 // optimal, but it greatly simplifies the math and this simplificati on is necessary for 345 // optimal, but it greatly simplifies the math and this simplificati on is necessary for
348 // performance reasons. 346 // performance reasons.
349 fsBuilder->codeAppendf("highp vec2 firstSample = %s.xy - vec2(0.25); ", 347 fsBuilder->codeAppendf("highp vec2 firstSample = %s.xy - vec2(0.25); ",
350 fsBuilder->fragmentPosition()); 348 fsBuilder->fragmentPosition());
351 fsBuilder->codeAppendf("highp vec2 delta1 = %s;", delta1.fsIn()); 349 fsBuilder->codeAppendf("highp vec2 delta1 = %s;", delta1.fsIn());
352 fsBuilder->codeAppendf("highp vec2 delta2 = %s;", delta2.fsIn()); 350 fsBuilder->codeAppendf("highp vec2 delta2 = %s;", delta2.fsIn());
353 fsBuilder->codeAppendf("highp vec2 delta3 = %s;", delta3.fsIn()); 351 fsBuilder->codeAppendf("highp vec2 delta3 = %s;", delta3.fsIn());
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 this->setupPosition(vsBuilder, gpArgs, qe.inPosition()->fName); 513 this->setupPosition(vsBuilder, gpArgs, qe.inPosition()->fName);
516 514
517 // emit transforms 515 // emit transforms
518 this->emitTransforms(vsBuilder, varyingHandler, uniformHandler, gpAr gs->fPositionVar, 516 this->emitTransforms(vsBuilder, varyingHandler, uniformHandler, gpAr gs->fPositionVar,
519 qe.inPosition()->fName, qe.localMatrix(), 517 qe.inPosition()->fName, qe.localMatrix(),
520 args.fFPCoordTransformHandler); 518 args.fFPCoordTransformHandler);
521 519
522 GrGLSLPPFragmentBuilder* fsBuilder = args.fFragBuilder; 520 GrGLSLPPFragmentBuilder* fsBuilder = args.fFragBuilder;
523 SkAssertResult(fsBuilder->enableFeature( 521 SkAssertResult(fsBuilder->enableFeature(
524 GrGLSLFragmentShaderBuilder::kPixelLocalStorage_GLSLF eature)); 522 GrGLSLFragmentShaderBuilder::kPixelLocalStorage_GLSLF eature));
525 SkAssertResult(fsBuilder->enableFeature(
526 GrGLSLFragmentShaderBuilder::kStandardDerivatives_GLSLFeatur e));
527 static const int QUAD_ARGS = 2; 523 static const int QUAD_ARGS = 2;
528 GrGLSLShaderVar inQuadArgs[QUAD_ARGS] = { 524 GrGLSLShaderVar inQuadArgs[QUAD_ARGS] = {
529 GrGLSLShaderVar("dot", kFloat_GrSLType, 0, kHigh_GrSLPrecision), 525 GrGLSLShaderVar("dot", kFloat_GrSLType, 0, kHigh_GrSLPrecision),
530 GrGLSLShaderVar("uv", kVec2f_GrSLType, 0, kHigh_GrSLPrecision) 526 GrGLSLShaderVar("uv", kVec2f_GrSLType, 0, kHigh_GrSLPrecision)
531 }; 527 };
532 SkString inQuadName; 528 SkString inQuadName;
533 529
534 const char* inQuadCode = "if (uv.x * uv.x <= uv.y) {" 530 const char* inQuadCode = "if (uv.x * uv.x <= uv.y) {"
535 "return dot >= 0.0;" 531 "return dot >= 0.0;"
536 "} else {" 532 "} else {"
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 946
951 DRAW_BATCH_TEST_DEFINE(PLSPathBatch) { 947 DRAW_BATCH_TEST_DEFINE(PLSPathBatch) {
952 GrColor color = GrRandomColor(random); 948 GrColor color = GrRandomColor(random);
953 SkMatrix vm = GrTest::TestMatrixInvertible(random); 949 SkMatrix vm = GrTest::TestMatrixInvertible(random);
954 SkPath path = GrTest::TestPathConvex(random); 950 SkPath path = GrTest::TestPathConvex(random);
955 951
956 return new PLSPathBatch(color, path, vm); 952 return new PLSPathBatch(color, path, vm);
957 } 953 }
958 954
959 #endif 955 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrAAConvexPathRenderer.cpp ('k') | src/gpu/effects/GrBezierEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698