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

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

Issue 648463003: FPs now use the correct builder types(just a rename) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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/GrConvexPolyEffect.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 "GrTBackendProcessorFactory.h" 10 #include "GrTBackendProcessorFactory.h"
11 #include "GrSimpleTextureEffect.h" 11 #include "GrSimpleTextureEffect.h"
12 #include "gl/GrGLProcessor.h" 12 #include "gl/GrGLProcessor.h"
13 #include "gl/builders/GrGLProgramBuilder.h" 13 #include "gl/builders/GrGLProgramBuilder.h"
14 #include "SkMatrix.h" 14 #include "SkMatrix.h"
15 15
16 class GrGLConfigConversionEffect : public GrGLFragmentProcessor { 16 class GrGLConfigConversionEffect : public GrGLFragmentProcessor {
17 public: 17 public:
18 GrGLConfigConversionEffect(const GrBackendProcessorFactory& factory, 18 GrGLConfigConversionEffect(const GrBackendProcessorFactory& factory,
19 const GrProcessor& processor) 19 const GrProcessor& processor)
20 : INHERITED (factory) { 20 : INHERITED (factory) {
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(GrGLProgramBuilder* builder, 27 virtual void emitCode(GrGLFPBuilder* builder,
28 const GrFragmentProcessor&, 28 const GrFragmentProcessor&,
29 const GrProcessorKey& key, 29 const GrProcessorKey& key,
30 const char* outputColor, 30 const char* outputColor,
31 const char* inputColor, 31 const char* inputColor,
32 const TransformedCoordsArray& coords, 32 const TransformedCoordsArray& coords,
33 const TextureSamplerArray& samplers) SK_OVERRIDE { 33 const TextureSamplerArray& samplers) SK_OVERRIDE {
34 // Using highp for GLES here in order to avoid some precision issues on specific GPUs. 34 // Using highp for GLES here in order to avoid some precision issues on specific GPUs.
35 GrGLShaderVar tmpVar("tmpColor", kVec4f_GrSLType, 0, GrGLShaderVar::kHig h_Precision); 35 GrGLShaderVar tmpVar("tmpColor", kVec4f_GrSLType, 0, GrGLShaderVar::kHig h_Precision);
36 SkString tmpDecl; 36 SkString tmpDecl;
37 tmpVar.appendDecl(builder->ctxInfo(), &tmpDecl); 37 tmpVar.appendDecl(builder->ctxInfo(), &tmpDecl);
38 38
39 GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder (); 39 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
40 40
41 fsBuilder->codeAppendf("%s;", tmpDecl.c_str()); 41 fsBuilder->codeAppendf("%s;", tmpDecl.c_str());
42 42
43 fsBuilder->codeAppendf("%s = ", tmpVar.c_str()); 43 fsBuilder->codeAppendf("%s = ", tmpVar.c_str());
44 fsBuilder->appendTextureLookup(samplers[0], coords[0].c_str(), coords[0] .getType()); 44 fsBuilder->appendTextureLookup(samplers[0], coords[0].c_str(), coords[0] .getType());
45 fsBuilder->codeAppend(";"); 45 fsBuilder->codeAppend(";");
46 46
47 if (GrConfigConversionEffect::kNone_PMConversion == fPMConversion) { 47 if (GrConfigConversionEffect::kNone_PMConversion == fPMConversion) {
48 SkASSERT(fSwapRedAndBlue); 48 SkASSERT(fSwapRedAndBlue);
49 fsBuilder->codeAppendf("%s = %s.bgra;", outputColor, tmpVar.c_str()) ; 49 fsBuilder->codeAppendf("%s = %s.bgra;", outputColor, tmpVar.c_str()) ;
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 kNone_PMConversion != pmConversion) { 276 kNone_PMConversion != pmConversion) {
277 // The PM conversions assume colors are 0..255 277 // The PM conversions assume colors are 0..255
278 return NULL; 278 return NULL;
279 } 279 }
280 return SkNEW_ARGS(GrConfigConversionEffect, (texture, 280 return SkNEW_ARGS(GrConfigConversionEffect, (texture,
281 swapRedAndBlue, 281 swapRedAndBlue,
282 pmConversion, 282 pmConversion,
283 matrix)); 283 matrix));
284 } 284 }
285 } 285 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrBicubicEffect.cpp ('k') | src/gpu/effects/GrConvexPolyEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698