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

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

Issue 1251173002: Added GrGLFragmentProcessor::EmitArgs struct for use with emitCode() (Closed) Base URL: https://skia.googlesource.com/skia@composeshader_gpu
Patch Set: Created 5 years, 5 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/GrSimpleTextureEffect.cpp ('k') | src/gpu/effects/GrYUVtoRGBEffect.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 "GrTextureDomain.h" 8 #include "GrTextureDomain.h"
9 #include "GrInvariantOutput.h" 9 #include "GrInvariantOutput.h"
10 #include "GrSimpleTextureEffect.h" 10 #include "GrSimpleTextureEffect.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 } 167 }
168 } 168 }
169 169
170 170
171 ////////////////////////////////////////////////////////////////////////////// 171 //////////////////////////////////////////////////////////////////////////////
172 172
173 class GrGLTextureDomainEffect : public GrGLFragmentProcessor { 173 class GrGLTextureDomainEffect : public GrGLFragmentProcessor {
174 public: 174 public:
175 GrGLTextureDomainEffect(const GrProcessor&); 175 GrGLTextureDomainEffect(const GrProcessor&);
176 176
177 virtual void emitCode(GrGLFPBuilder*, 177 virtual void emitCode(EmitArgs&) override;
178 const GrFragmentProcessor&,
179 const char* outputColor,
180 const char* inputColor,
181 const TransformedCoordsArray&,
182 const TextureSamplerArray&) override;
183 178
184 void setData(const GrGLProgramDataManager&, const GrProcessor&) override; 179 void setData(const GrGLProgramDataManager&, const GrProcessor&) override;
185 180
186 static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessor KeyBuilder*); 181 static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessor KeyBuilder*);
187 182
188 private: 183 private:
189 GrTextureDomain::GLDomain fGLDomain; 184 GrTextureDomain::GLDomain fGLDomain;
190 typedef GrGLFragmentProcessor INHERITED; 185 typedef GrGLFragmentProcessor INHERITED;
191 }; 186 };
192 187
193 GrGLTextureDomainEffect::GrGLTextureDomainEffect(const GrProcessor&) { 188 GrGLTextureDomainEffect::GrGLTextureDomainEffect(const GrProcessor&) {
194 } 189 }
195 190
196 void GrGLTextureDomainEffect::emitCode(GrGLFPBuilder* builder, 191 void GrGLTextureDomainEffect::emitCode(EmitArgs& args) {
197 const GrFragmentProcessor& fp, 192 const GrTextureDomainEffect& textureDomainEffect = args.fFp.cast<GrTextureDo mainEffect>();
198 const char* outputColor,
199 const char* inputColor,
200 const TransformedCoordsArray& coords,
201 const TextureSamplerArray& samplers) {
202 const GrTextureDomainEffect& textureDomainEffect = fp.cast<GrTextureDomainEf fect>();
203 const GrTextureDomain& domain = textureDomainEffect.textureDomain(); 193 const GrTextureDomain& domain = textureDomainEffect.textureDomain();
204 194
205 GrGLFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); 195 GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
206 SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0); 196 SkString coords2D = fsBuilder->ensureFSCoords2D(args.fCoords, 0);
207 fGLDomain.sampleTexture(fsBuilder, domain, outputColor, coords2D, samplers[0 ], inputColor); 197 fGLDomain.sampleTexture(fsBuilder, domain, args.fOutputColor, coords2D, args .fSamplers[0],
198 args.fInputColor);
208 } 199 }
209 200
210 void GrGLTextureDomainEffect::setData(const GrGLProgramDataManager& pdman, 201 void GrGLTextureDomainEffect::setData(const GrGLProgramDataManager& pdman,
211 const GrProcessor& processor) { 202 const GrProcessor& processor) {
212 const GrTextureDomainEffect& textureDomainEffect = processor.cast<GrTextureD omainEffect>(); 203 const GrTextureDomainEffect& textureDomainEffect = processor.cast<GrTextureD omainEffect>();
213 const GrTextureDomain& domain = textureDomainEffect.textureDomain(); 204 const GrTextureDomain& domain = textureDomainEffect.textureDomain();
214 fGLDomain.setData(pdman, domain, processor.texture(0)->origin()); 205 fGLDomain.setData(pdman, domain, processor.texture(0)->origin());
215 } 206 }
216 207
217 void GrGLTextureDomainEffect::GenKey(const GrProcessor& processor, const GrGLSLC aps&, 208 void GrGLTextureDomainEffect::GenKey(const GrProcessor& processor, const GrGLSLC aps&,
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool() : false; 299 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool() : false;
309 GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrC oordSet; 300 GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrC oordSet;
310 return GrTextureDomainEffect::Create(d->fProcDataManager, 301 return GrTextureDomainEffect::Create(d->fProcDataManager,
311 d->fTextures[texIdx], 302 d->fTextures[texIdx],
312 matrix, 303 matrix,
313 domain, 304 domain,
314 mode, 305 mode,
315 bilerp ? GrTextureParams::kBilerp_Filte rMode : GrTextureParams::kNone_FilterMode, 306 bilerp ? GrTextureParams::kBilerp_Filte rMode : GrTextureParams::kNone_FilterMode,
316 coords); 307 coords);
317 } 308 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrSimpleTextureEffect.cpp ('k') | src/gpu/effects/GrYUVtoRGBEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698