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

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
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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 } 162 }
163 } 163 }
164 164
165 165
166 ////////////////////////////////////////////////////////////////////////////// 166 //////////////////////////////////////////////////////////////////////////////
167 167
168 class GrGLTextureDomainEffect : public GrGLFragmentProcessor { 168 class GrGLTextureDomainEffect : public GrGLFragmentProcessor {
169 public: 169 public:
170 GrGLTextureDomainEffect(const GrProcessor&); 170 GrGLTextureDomainEffect(const GrProcessor&);
171 171
172 virtual void emitCode(GrGLFPBuilder*, 172 virtual void emitCode(EmitArgs&) override;
173 const GrFragmentProcessor&,
174 const char* outputColor,
175 const char* inputColor,
176 const TransformedCoordsArray&,
177 const TextureSamplerArray&) override;
178 173
179 void setData(const GrGLProgramDataManager&, const GrProcessor&) override; 174 void setData(const GrGLProgramDataManager&, const GrProcessor&) override;
180 175
181 static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessor KeyBuilder*); 176 static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessor KeyBuilder*);
182 177
183 private: 178 private:
184 GrTextureDomain::GLDomain fGLDomain; 179 GrTextureDomain::GLDomain fGLDomain;
185 typedef GrGLFragmentProcessor INHERITED; 180 typedef GrGLFragmentProcessor INHERITED;
186 }; 181 };
187 182
188 GrGLTextureDomainEffect::GrGLTextureDomainEffect(const GrProcessor&) { 183 GrGLTextureDomainEffect::GrGLTextureDomainEffect(const GrProcessor&) {
189 } 184 }
190 185
191 void GrGLTextureDomainEffect::emitCode(GrGLFPBuilder* builder, 186 void GrGLTextureDomainEffect::emitCode(EmitArgs& args) {
192 const GrFragmentProcessor& fp, 187 const GrTextureDomainEffect& textureDomainEffect = args.fFp.cast<GrTextureDo mainEffect>();
193 const char* outputColor,
194 const char* inputColor,
195 const TransformedCoordsArray& coords,
196 const TextureSamplerArray& samplers) {
197 const GrTextureDomainEffect& textureDomainEffect = fp.cast<GrTextureDomainEf fect>();
198 const GrTextureDomain& domain = textureDomainEffect.textureDomain(); 188 const GrTextureDomain& domain = textureDomainEffect.textureDomain();
199 189
200 GrGLFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); 190 GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
201 SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0); 191 SkString coords2D = fsBuilder->ensureFSCoords2D(args.fCoords, 0);
202 fGLDomain.sampleTexture(fsBuilder, domain, outputColor, coords2D, samplers[0 ], inputColor); 192 fGLDomain.sampleTexture(fsBuilder, domain, args.fOutputColor, coords2D, args .fSamplers[0], args.fInputColor);
joshualitt 2015/07/22 19:34:05 line wrap @100
203 } 193 }
204 194
205 void GrGLTextureDomainEffect::setData(const GrGLProgramDataManager& pdman, 195 void GrGLTextureDomainEffect::setData(const GrGLProgramDataManager& pdman,
206 const GrProcessor& processor) { 196 const GrProcessor& processor) {
207 const GrTextureDomainEffect& textureDomainEffect = processor.cast<GrTextureD omainEffect>(); 197 const GrTextureDomainEffect& textureDomainEffect = processor.cast<GrTextureD omainEffect>();
208 const GrTextureDomain& domain = textureDomainEffect.textureDomain(); 198 const GrTextureDomain& domain = textureDomainEffect.textureDomain();
209 fGLDomain.setData(pdman, domain, processor.texture(0)->origin()); 199 fGLDomain.setData(pdman, domain, processor.texture(0)->origin());
210 } 200 }
211 201
212 void GrGLTextureDomainEffect::GenKey(const GrProcessor& processor, const GrGLSLC aps&, 202 void GrGLTextureDomainEffect::GenKey(const GrProcessor& processor, const GrGLSLC aps&,
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool() : false; 293 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool() : false;
304 GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrC oordSet; 294 GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrC oordSet;
305 return GrTextureDomainEffect::Create(d->fProcDataManager, 295 return GrTextureDomainEffect::Create(d->fProcDataManager,
306 d->fTextures[texIdx], 296 d->fTextures[texIdx],
307 matrix, 297 matrix,
308 domain, 298 domain,
309 mode, 299 mode,
310 bilerp ? GrTextureParams::kBilerp_Filte rMode : GrTextureParams::kNone_FilterMode, 300 bilerp ? GrTextureParams::kBilerp_Filte rMode : GrTextureParams::kNone_FilterMode,
311 coords); 301 coords);
312 } 302 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698