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

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

Issue 26190003: Potentially optimize some GrGLEffects for known input color values (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
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 "GrSimpleTextureEffect.h" 8 #include "GrSimpleTextureEffect.h"
9 #include "gl/GrGLEffect.h" 9 #include "gl/GrGLEffect.h"
10 #include "gl/GrGLSL.h" 10 #include "gl/GrGLSL.h"
11 #include "gl/GrGLTexture.h" 11 #include "gl/GrGLTexture.h"
12 #include "GrTBackendEffectFactory.h" 12 #include "GrTBackendEffectFactory.h"
13 #include "GrTexture.h" 13 #include "GrTexture.h"
14 14
15 class GrGLSimpleTextureEffect : public GrGLEffect { 15 class GrGLSimpleTextureEffect : public GrGLEffect {
16 public: 16 public:
17 GrGLSimpleTextureEffect(const GrBackendEffectFactory& factory, const GrDrawE ffect&) 17 GrGLSimpleTextureEffect(const GrBackendEffectFactory& factory, const GrDrawE ffect&)
18 : INHERITED (factory) { 18 : INHERITED (factory) {
19 } 19 }
20 20
21 virtual void emitCode(GrGLShaderBuilder* builder, 21 virtual void emitCode(GrGLShaderBuilder* builder,
22 const GrDrawEffect& drawEffect, 22 const GrDrawEffect& drawEffect,
23 EffectKey key, 23 EffectKey key,
24 const char* outputColor, 24 const char* outputColor,
25 const char* inputColor, 25 const GrGLSLExpr4& inputColor,
26 const TransformedCoordsArray& coords, 26 const TransformedCoordsArray& coords,
27 const TextureSamplerArray& samplers) SK_OVERRIDE { 27 const TextureSamplerArray& samplers) SK_OVERRIDE {
28 builder->fsCodeAppendf("\t%s = ", outputColor); 28 builder->fsCodeAppendf("\t%s = ", outputColor);
29 builder->fsAppendTextureLookupAndModulate(inputColor, 29 builder->fsAppendTextureLookupAndModulate(inputColor,
30 samplers[0], 30 samplers[0],
31 coords[0].c_str(), 31 coords[0].c_str(),
32 coords[0].type()); 32 coords[0].type());
33 builder->fsCodeAppend(";\n"); 33 builder->fsCodeAppend(";\n");
34 } 34 }
35 35
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 static const GrCoordSet kCoordSets[] = { 72 static const GrCoordSet kCoordSets[] = {
73 kLocal_GrCoordSet, 73 kLocal_GrCoordSet,
74 kPosition_GrCoordSet 74 kPosition_GrCoordSet
75 }; 75 };
76 GrCoordSet coordSet = kCoordSets[random->nextULessThan(GR_ARRAY_COUNT(kCoord Sets))]; 76 GrCoordSet coordSet = kCoordSets[random->nextULessThan(GR_ARRAY_COUNT(kCoord Sets))];
77 77
78 const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random); 78 const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random);
79 return GrSimpleTextureEffect::Create(textures[texIdx], matrix, coordSet); 79 return GrSimpleTextureEffect::Create(textures[texIdx], matrix, coordSet);
80 } 80 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrCustomCoordsTextureEffect.cpp ('k') | src/gpu/effects/GrTextureDomainEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698