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

Side by Side Diff: src/gpu/effects/GrTextureDomain.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 "GrTextureDomain.h" 8 #include "GrTextureDomain.h"
9 #include "GrInvariantOutput.h" 9 #include "GrInvariantOutput.h"
10 #include "GrSimpleTextureEffect.h" 10 #include "GrSimpleTextureEffect.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 GrTextureDomain::GLDomain fGLDomain; 185 GrTextureDomain::GLDomain fGLDomain;
186 typedef GrGLSLFragmentProcessor INHERITED; 186 typedef GrGLSLFragmentProcessor INHERITED;
187 }; 187 };
188 188
189 void GrGLTextureDomainEffect::emitCode(EmitArgs& args) { 189 void GrGLTextureDomainEffect::emitCode(EmitArgs& args) {
190 const GrTextureDomainEffect& textureDomainEffect = args.fFp.cast<GrTextureDo mainEffect>(); 190 const GrTextureDomainEffect& textureDomainEffect = args.fFp.cast<GrTextureDo mainEffect>();
191 const GrTextureDomain& domain = textureDomainEffect.textureDomain(); 191 const GrTextureDomain& domain = textureDomainEffect.textureDomain();
192 192
193 GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder; 193 GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
194 SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0); 194 SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
195 const GrGLSLSampler& sampler = args.fUniformHandler->getSampler(args.fTexSam plers[0]);
195 fGLDomain.sampleTexture(fragBuilder, 196 fGLDomain.sampleTexture(fragBuilder,
196 args.fUniformHandler, 197 args.fUniformHandler,
197 args.fGLSLCaps, 198 args.fGLSLCaps,
198 domain, 199 domain,
199 args.fOutputColor, 200 args.fOutputColor,
200 coords2D, 201 coords2D,
201 args.fTexSamplers[0], 202 sampler,
202 args.fInputColor); 203 args.fInputColor);
203 } 204 }
204 205
205 void GrGLTextureDomainEffect::onSetData(const GrGLSLProgramDataManager& pdman, 206 void GrGLTextureDomainEffect::onSetData(const GrGLSLProgramDataManager& pdman,
206 const GrProcessor& processor) { 207 const GrProcessor& processor) {
207 const GrTextureDomainEffect& textureDomainEffect = processor.cast<GrTextureD omainEffect>(); 208 const GrTextureDomainEffect& textureDomainEffect = processor.cast<GrTextureD omainEffect>();
208 const GrTextureDomain& domain = textureDomainEffect.textureDomain(); 209 const GrTextureDomain& domain = textureDomainEffect.textureDomain();
209 fGLDomain.setData(pdman, domain, processor.texture(0)->origin()); 210 fGLDomain.setData(pdman, domain, processor.texture(0)->origin());
210 } 211 }
211 212
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool() : false; 293 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool() : false;
293 GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrC oordSet; 294 GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrC oordSet;
294 return GrTextureDomainEffect::Create( 295 return GrTextureDomainEffect::Create(
295 d->fTextures[texIdx], 296 d->fTextures[texIdx],
296 matrix, 297 matrix,
297 domain, 298 domain,
298 mode, 299 mode,
299 bilerp ? GrTextureParams::kBilerp_FilterMode : GrTextureParams::kNone_Fi lterMode, 300 bilerp ? GrTextureParams::kBilerp_FilterMode : GrTextureParams::kNone_Fi lterMode,
300 coords); 301 coords);
301 } 302 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698