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

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

Issue 1417123002: Move GrGLShaderVar to GrGLSL (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix gyp Created 5 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/effects/GrBicubicEffect.cpp ('k') | src/gpu/effects/GrConvolutionEffect.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 2012 Google Inc. 2 * Copyright 2012 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 "GrConfigConversionEffect.h" 8 #include "GrConfigConversionEffect.h"
9 #include "GrContext.h" 9 #include "GrContext.h"
10 #include "GrDrawContext.h" 10 #include "GrDrawContext.h"
11 #include "GrInvariantOutput.h" 11 #include "GrInvariantOutput.h"
12 #include "GrSimpleTextureEffect.h" 12 #include "GrSimpleTextureEffect.h"
13 #include "SkMatrix.h" 13 #include "SkMatrix.h"
14 #include "gl/GrGLFragmentProcessor.h" 14 #include "gl/GrGLFragmentProcessor.h"
15 #include "gl/builders/GrGLProgramBuilder.h" 15 #include "gl/builders/GrGLProgramBuilder.h"
16 16
17 class GrGLConfigConversionEffect : public GrGLFragmentProcessor { 17 class GrGLConfigConversionEffect : public GrGLFragmentProcessor {
18 public: 18 public:
19 GrGLConfigConversionEffect(const GrProcessor& processor) { 19 GrGLConfigConversionEffect(const GrProcessor& processor) {
20 const GrConfigConversionEffect& configConversionEffect = 20 const GrConfigConversionEffect& configConversionEffect =
21 processor.cast<GrConfigConversionEffect>(); 21 processor.cast<GrConfigConversionEffect>();
22 fSwapRedAndBlue = configConversionEffect.swapsRedAndBlue(); 22 fSwapRedAndBlue = configConversionEffect.swapsRedAndBlue();
23 fPMConversion = configConversionEffect.pmConversion(); 23 fPMConversion = configConversionEffect.pmConversion();
24 } 24 }
25 25
26 virtual void emitCode(EmitArgs& args) override { 26 virtual void emitCode(EmitArgs& args) override {
27 // Using highp for GLES here in order to avoid some precision issues on specific GPUs. 27 // Using highp for GLES here in order to avoid some precision issues on specific GPUs.
28 GrGLShaderVar tmpVar("tmpColor", kVec4f_GrSLType, 0, kHigh_GrSLPrecision ); 28 GrGLSLShaderVar tmpVar("tmpColor", kVec4f_GrSLType, 0, kHigh_GrSLPrecisi on);
29 SkString tmpDecl; 29 SkString tmpDecl;
30 tmpVar.appendDecl(args.fBuilder->glslCaps(), &tmpDecl); 30 tmpVar.appendDecl(args.fBuilder->glslCaps(), &tmpDecl);
31 31
32 GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder (); 32 GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder ();
33 33
34 fsBuilder->codeAppendf("%s;", tmpDecl.c_str()); 34 fsBuilder->codeAppendf("%s;", tmpDecl.c_str());
35 35
36 fsBuilder->codeAppendf("%s = ", tmpVar.c_str()); 36 fsBuilder->codeAppendf("%s = ", tmpVar.c_str());
37 fsBuilder->appendTextureLookup(args.fSamplers[0], args.fCoords[0].c_str( ), 37 fsBuilder->appendTextureLookup(args.fSamplers[0], args.fCoords[0].c_str( ),
38 args.fCoords[0].getType()); 38 args.fCoords[0].getType());
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 } else { 297 } else {
298 if (kRGBA_8888_GrPixelConfig != texture->config() && 298 if (kRGBA_8888_GrPixelConfig != texture->config() &&
299 kBGRA_8888_GrPixelConfig != texture->config() && 299 kBGRA_8888_GrPixelConfig != texture->config() &&
300 kNone_PMConversion != pmConversion) { 300 kNone_PMConversion != pmConversion) {
301 // The PM conversions assume colors are 0..255 301 // The PM conversions assume colors are 0..255
302 return nullptr; 302 return nullptr;
303 } 303 }
304 return new GrConfigConversionEffect(texture, swapRedAndBlue, pmConversio n, matrix); 304 return new GrConfigConversionEffect(texture, swapRedAndBlue, pmConversio n, matrix);
305 } 305 }
306 } 306 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrBicubicEffect.cpp ('k') | src/gpu/effects/GrConvolutionEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698