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

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

Issue 1287023009: Added tree structure to GrGLFragmentProcessor, i.e. GL instances (Closed) Base URL: https://skia.googlesource.com/skia@cs3_isequal_nonrecursive
Patch Set: moved onSetData from public to protected, onCreateGLInstance from public to private in subclasses Created 5 years, 4 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/GrTextureDomain.h ('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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(EmitArgs&) override; 177 virtual void emitCode(EmitArgs&) override;
178 178
179 void setData(const GrGLProgramDataManager&, const GrProcessor&) override; 179 static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessor KeyBuilder*);
180 180
181 static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessor KeyBuilder*); 181 protected:
182 void onSetData(const GrGLProgramDataManager&, const GrProcessor&) override;
182 183
183 private: 184 private:
184 GrTextureDomain::GLDomain fGLDomain; 185 GrTextureDomain::GLDomain fGLDomain;
185 typedef GrGLFragmentProcessor INHERITED; 186 typedef GrGLFragmentProcessor INHERITED;
186 }; 187 };
187 188
188 GrGLTextureDomainEffect::GrGLTextureDomainEffect(const GrProcessor&) { 189 GrGLTextureDomainEffect::GrGLTextureDomainEffect(const GrProcessor&) {
189 } 190 }
190 191
191 void GrGLTextureDomainEffect::emitCode(EmitArgs& args) { 192 void GrGLTextureDomainEffect::emitCode(EmitArgs& args) {
192 const GrTextureDomainEffect& textureDomainEffect = args.fFp.cast<GrTextureDo mainEffect>(); 193 const GrTextureDomainEffect& textureDomainEffect = args.fFp.cast<GrTextureDo mainEffect>();
193 const GrTextureDomain& domain = textureDomainEffect.textureDomain(); 194 const GrTextureDomain& domain = textureDomainEffect.textureDomain();
194 195
195 GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder(); 196 GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
196 SkString coords2D = fsBuilder->ensureFSCoords2D(args.fCoords, 0); 197 SkString coords2D = fsBuilder->ensureFSCoords2D(args.fCoords, 0);
197 fGLDomain.sampleTexture(fsBuilder, domain, args.fOutputColor, coords2D, args .fSamplers[0], 198 fGLDomain.sampleTexture(fsBuilder, domain, args.fOutputColor, coords2D, args .fSamplers[0],
198 args.fInputColor); 199 args.fInputColor);
199 } 200 }
200 201
201 void GrGLTextureDomainEffect::setData(const GrGLProgramDataManager& pdman, 202 void GrGLTextureDomainEffect::onSetData(const GrGLProgramDataManager& pdman,
202 const GrProcessor& processor) { 203 const GrProcessor& processor) {
203 const GrTextureDomainEffect& textureDomainEffect = processor.cast<GrTextureD omainEffect>(); 204 const GrTextureDomainEffect& textureDomainEffect = processor.cast<GrTextureD omainEffect>();
204 const GrTextureDomain& domain = textureDomainEffect.textureDomain(); 205 const GrTextureDomain& domain = textureDomainEffect.textureDomain();
205 fGLDomain.setData(pdman, domain, processor.texture(0)->origin()); 206 fGLDomain.setData(pdman, domain, processor.texture(0)->origin());
206 } 207 }
207 208
208 void GrGLTextureDomainEffect::GenKey(const GrProcessor& processor, const GrGLSLC aps&, 209 void GrGLTextureDomainEffect::GenKey(const GrProcessor& processor, const GrGLSLC aps&,
209 GrProcessorKeyBuilder* b) { 210 GrProcessorKeyBuilder* b) {
210 const GrTextureDomain& domain = processor.cast<GrTextureDomainEffect>().text ureDomain(); 211 const GrTextureDomain& domain = processor.cast<GrTextureDomainEffect>().text ureDomain();
211 b->add32(GrTextureDomain::GLDomain::DomainKey(domain)); 212 b->add32(GrTextureDomain::GLDomain::DomainKey(domain));
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 254
254 GrTextureDomainEffect::~GrTextureDomainEffect() { 255 GrTextureDomainEffect::~GrTextureDomainEffect() {
255 256
256 } 257 }
257 258
258 void GrTextureDomainEffect::onGetGLProcessorKey(const GrGLSLCaps& caps, 259 void GrTextureDomainEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
259 GrProcessorKeyBuilder* b) const { 260 GrProcessorKeyBuilder* b) const {
260 GrGLTextureDomainEffect::GenKey(*this, caps, b); 261 GrGLTextureDomainEffect::GenKey(*this, caps, b);
261 } 262 }
262 263
263 GrGLFragmentProcessor* GrTextureDomainEffect::createGLInstance() const { 264 GrGLFragmentProcessor* GrTextureDomainEffect::onCreateGLInstance() const {
264 return SkNEW_ARGS(GrGLTextureDomainEffect, (*this)); 265 return SkNEW_ARGS(GrGLTextureDomainEffect, (*this));
265 } 266 }
266 267
267 bool GrTextureDomainEffect::onIsEqual(const GrFragmentProcessor& sBase) const { 268 bool GrTextureDomainEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
268 const GrTextureDomainEffect& s = sBase.cast<GrTextureDomainEffect>(); 269 const GrTextureDomainEffect& s = sBase.cast<GrTextureDomainEffect>();
269 return this->fTextureDomain == s.fTextureDomain; 270 return this->fTextureDomain == s.fTextureDomain;
270 } 271 }
271 272
272 void GrTextureDomainEffect::onComputeInvariantOutput(GrInvariantOutput* inout) c onst { 273 void GrTextureDomainEffect::onComputeInvariantOutput(GrInvariantOutput* inout) c onst {
273 if (GrTextureDomain::kDecal_Mode == fTextureDomain.mode()) { // TODO: helper 274 if (GrTextureDomain::kDecal_Mode == fTextureDomain.mode()) { // TODO: helper
(...skipping 25 matching lines...) Expand all
299 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool() : false; 300 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool() : false;
300 GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrC oordSet; 301 GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrC oordSet;
301 return GrTextureDomainEffect::Create(d->fProcDataManager, 302 return GrTextureDomainEffect::Create(d->fProcDataManager,
302 d->fTextures[texIdx], 303 d->fTextures[texIdx],
303 matrix, 304 matrix,
304 domain, 305 domain,
305 mode, 306 mode,
306 bilerp ? GrTextureParams::kBilerp_Filte rMode : GrTextureParams::kNone_FilterMode, 307 bilerp ? GrTextureParams::kBilerp_Filte rMode : GrTextureParams::kNone_FilterMode,
307 coords); 308 coords);
308 } 309 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrTextureDomain.h ('k') | src/gpu/effects/GrYUVtoRGBEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698