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

Side by Side Diff: src/effects/SkDisplacementMapEffect.cpp

Issue 788733003: Make addUniform take a precision (Closed) Base URL: https://skia.googlesource.com/skia.git@move_prec
Patch Set: rebase Created 6 years 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/effects/SkColorMatrixFilter.cpp ('k') | src/effects/SkLightingImageFilter.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 "SkDisplacementMapEffect.h" 8 #include "SkDisplacementMapEffect.h"
9 #include "SkReadBuffer.h" 9 #include "SkReadBuffer.h"
10 #include "SkWriteBuffer.h" 10 #include "SkWriteBuffer.h"
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 526
527 void GrGLDisplacementMapEffect::emitCode(GrGLFPBuilder* builder, 527 void GrGLDisplacementMapEffect::emitCode(GrGLFPBuilder* builder,
528 const GrFragmentProcessor&, 528 const GrFragmentProcessor&,
529 const char* outputColor, 529 const char* outputColor,
530 const char* inputColor, 530 const char* inputColor,
531 const TransformedCoordsArray& coords, 531 const TransformedCoordsArray& coords,
532 const TextureSamplerArray& samplers) { 532 const TextureSamplerArray& samplers) {
533 sk_ignore_unused_variable(inputColor); 533 sk_ignore_unused_variable(inputColor);
534 534
535 fScaleUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility, 535 fScaleUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
536 kVec2f_GrSLType, "Scale"); 536 kVec2f_GrSLType, kDefault_GrSLPrecision, "Sc ale");
537 const char* scaleUni = builder->getUniformCStr(fScaleUni); 537 const char* scaleUni = builder->getUniformCStr(fScaleUni);
538 const char* dColor = "dColor"; 538 const char* dColor = "dColor";
539 const char* cCoords = "cCoords"; 539 const char* cCoords = "cCoords";
540 const char* outOfBounds = "outOfBounds"; 540 const char* outOfBounds = "outOfBounds";
541 const char* nearZero = "1e-6"; // Since 6.10352e−5 is the smallest half floa t, use 541 const char* nearZero = "1e-6"; // Since 6.10352e−5 is the smallest half floa t, use
542 // a number smaller than that to approximate 0, but 542 // a number smaller than that to approximate 0, but
543 // leave room for 32-bit float GPU rounding e rrors. 543 // leave room for 32-bit float GPU rounding e rrors.
544 544
545 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); 545 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
546 fsBuilder->codeAppendf("\t\tvec4 %s = ", dColor); 546 fsBuilder->codeAppendf("\t\tvec4 %s = ", dColor);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, 615 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc,
616 const GrGLCaps&, GrProcessorKeyBuilder* b ) { 616 const GrGLCaps&, GrProcessorKeyBuilder* b ) {
617 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap Effect>(); 617 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap Effect>();
618 618
619 uint32_t xKey = displacementMap.xChannelSelector(); 619 uint32_t xKey = displacementMap.xChannelSelector();
620 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit s; 620 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit s;
621 621
622 b->add32(xKey | yKey); 622 b->add32(xKey | yKey);
623 } 623 }
624 #endif 624 #endif
OLDNEW
« no previous file with comments | « src/effects/SkColorMatrixFilter.cpp ('k') | src/effects/SkLightingImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698