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

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

Issue 1453623003: Move glsl onto EmitArgs struct for emitCode (Closed) Base URL: https://skia.googlesource.com/skia.git@moveShaders
Patch Set: nit Created 5 years, 1 month 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/GrDistanceFieldGeoProc.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"
(...skipping 10 matching lines...) Expand all
21 const GrConfigConversionEffect& configConversionEffect = 21 const GrConfigConversionEffect& configConversionEffect =
22 processor.cast<GrConfigConversionEffect>(); 22 processor.cast<GrConfigConversionEffect>();
23 fSwapRedAndBlue = configConversionEffect.swapsRedAndBlue(); 23 fSwapRedAndBlue = configConversionEffect.swapsRedAndBlue();
24 fPMConversion = configConversionEffect.pmConversion(); 24 fPMConversion = configConversionEffect.pmConversion();
25 } 25 }
26 26
27 virtual void emitCode(EmitArgs& args) override { 27 virtual void emitCode(EmitArgs& args) override {
28 // Using highp for GLES here in order to avoid some precision issues on specific GPUs. 28 // Using highp for GLES here in order to avoid some precision issues on specific GPUs.
29 GrGLSLShaderVar tmpVar("tmpColor", kVec4f_GrSLType, 0, kHigh_GrSLPrecisi on); 29 GrGLSLShaderVar tmpVar("tmpColor", kVec4f_GrSLType, 0, kHigh_GrSLPrecisi on);
30 SkString tmpDecl; 30 SkString tmpDecl;
31 tmpVar.appendDecl(args.fBuilder->glslCaps(), &tmpDecl); 31 tmpVar.appendDecl(args.fGLSLCaps, &tmpDecl);
32 32
33 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; 33 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder;
34 34
35 fragBuilder->codeAppendf("%s;", tmpDecl.c_str()); 35 fragBuilder->codeAppendf("%s;", tmpDecl.c_str());
36 36
37 fragBuilder->codeAppendf("%s = ", tmpVar.c_str()); 37 fragBuilder->codeAppendf("%s = ", tmpVar.c_str());
38 fragBuilder->appendTextureLookup(args.fSamplers[0], args.fCoords[0].c_st r(), 38 fragBuilder->appendTextureLookup(args.fSamplers[0], args.fCoords[0].c_st r(),
39 args.fCoords[0].getType()); 39 args.fCoords[0].getType());
40 fragBuilder->codeAppend(";"); 40 fragBuilder->codeAppend(";");
41 41
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 } else { 298 } else {
299 if (kRGBA_8888_GrPixelConfig != texture->config() && 299 if (kRGBA_8888_GrPixelConfig != texture->config() &&
300 kBGRA_8888_GrPixelConfig != texture->config() && 300 kBGRA_8888_GrPixelConfig != texture->config() &&
301 kNone_PMConversion != pmConversion) { 301 kNone_PMConversion != pmConversion) {
302 // The PM conversions assume colors are 0..255 302 // The PM conversions assume colors are 0..255
303 return nullptr; 303 return nullptr;
304 } 304 }
305 return new GrConfigConversionEffect(texture, swapRedAndBlue, pmConversio n, matrix); 305 return new GrConfigConversionEffect(texture, swapRedAndBlue, pmConversio n, matrix);
306 } 306 }
307 } 307 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrBicubicEffect.cpp ('k') | src/gpu/effects/GrDistanceFieldGeoProc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698