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

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

Issue 1885863004: Refactor how we store and use samplers in Ganesh (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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
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 "GrInvariantOutput.h" 9 #include "GrInvariantOutput.h"
10 #include "GrTexture.h" 10 #include "GrTexture.h"
11 #include "glsl/GrGLSLFragmentProcessor.h" 11 #include "glsl/GrGLSLFragmentProcessor.h"
12 #include "glsl/GrGLSLFragmentShaderBuilder.h" 12 #include "glsl/GrGLSLFragmentShaderBuilder.h"
13 #include "glsl/GrGLSLUniformHandler.h"
13 14
14 class GrGLSimpleTextureEffect : public GrGLSLFragmentProcessor { 15 class GrGLSimpleTextureEffect : public GrGLSLFragmentProcessor {
15 public: 16 public:
16 void emitCode(EmitArgs& args) override { 17 void emitCode(EmitArgs& args) override {
17 GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder; 18 GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
18 fragBuilder->codeAppendf("%s = ", args.fOutputColor); 19 fragBuilder->codeAppendf("%s = ", args.fOutputColor);
20 const GrGLSLSampler& sampler = args.fUniformHandler->getSampler(args.fTe xSamplers[0]);
19 fragBuilder->appendTextureLookupAndModulate(args.fInputColor, 21 fragBuilder->appendTextureLookupAndModulate(args.fInputColor,
20 args.fTexSamplers[0], 22 sampler,
21 args.fCoords[0].c_str(), 23 args.fCoords[0].c_str(),
22 args.fCoords[0].getType()); 24 args.fCoords[0].getType());
23 fragBuilder->codeAppend(";"); 25 fragBuilder->codeAppend(";");
24 } 26 }
25 27
26 private: 28 private:
27 typedef GrGLSLFragmentProcessor INHERITED; 29 typedef GrGLSLFragmentProcessor INHERITED;
28 }; 30 };
29 31
30 /////////////////////////////////////////////////////////////////////////////// 32 ///////////////////////////////////////////////////////////////////////////////
31 33
32 void GrSimpleTextureEffect::onComputeInvariantOutput(GrInvariantOutput* inout) c onst { 34 void GrSimpleTextureEffect::onComputeInvariantOutput(GrInvariantOutput* inout) c onst {
(...skipping 30 matching lines...) Expand all
63 65
64 static const GrCoordSet kCoordSets[] = { 66 static const GrCoordSet kCoordSets[] = {
65 kLocal_GrCoordSet, 67 kLocal_GrCoordSet,
66 kDevice_GrCoordSet 68 kDevice_GrCoordSet
67 }; 69 };
68 GrCoordSet coordSet = kCoordSets[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kC oordSets))]; 70 GrCoordSet coordSet = kCoordSets[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kC oordSets))];
69 71
70 const SkMatrix& matrix = GrTest::TestMatrix(d->fRandom); 72 const SkMatrix& matrix = GrTest::TestMatrix(d->fRandom);
71 return GrSimpleTextureEffect::Create(d->fTextures[texIdx], matrix, coordSet) ; 73 return GrSimpleTextureEffect::Create(d->fTextures[texIdx], matrix, coordSet) ;
72 } 74 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698