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

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

Issue 1109863004: Use GLSLCaps for creating processor keys and GLSL-specific programs (Closed) Base URL: https://chromium.googlesource.com/skia@master
Patch Set: Created 5 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
« 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 171
172 virtual void emitCode(GrGLFPBuilder*, 172 virtual void emitCode(GrGLFPBuilder*,
173 const GrFragmentProcessor&, 173 const GrFragmentProcessor&,
174 const char* outputColor, 174 const char* outputColor,
175 const char* inputColor, 175 const char* inputColor,
176 const TransformedCoordsArray&, 176 const TransformedCoordsArray&,
177 const TextureSamplerArray&) override; 177 const TextureSamplerArray&) override;
178 178
179 void setData(const GrGLProgramDataManager&, const GrProcessor&) override; 179 void setData(const GrGLProgramDataManager&, const GrProcessor&) override;
180 180
181 static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKe yBuilder*); 181 static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessor KeyBuilder*);
182 182
183 private: 183 private:
184 GrTextureDomain::GLDomain fGLDomain; 184 GrTextureDomain::GLDomain fGLDomain;
185 typedef GrGLFragmentProcessor INHERITED; 185 typedef GrGLFragmentProcessor INHERITED;
186 }; 186 };
187 187
188 GrGLTextureDomainEffect::GrGLTextureDomainEffect(const GrProcessor&) { 188 GrGLTextureDomainEffect::GrGLTextureDomainEffect(const GrProcessor&) {
189 } 189 }
190 190
191 void GrGLTextureDomainEffect::emitCode(GrGLFPBuilder* builder, 191 void GrGLTextureDomainEffect::emitCode(GrGLFPBuilder* builder,
(...skipping 10 matching lines...) Expand all
202 fGLDomain.sampleTexture(fsBuilder, domain, outputColor, coords2D, samplers[0 ], inputColor); 202 fGLDomain.sampleTexture(fsBuilder, domain, outputColor, coords2D, samplers[0 ], inputColor);
203 } 203 }
204 204
205 void GrGLTextureDomainEffect::setData(const GrGLProgramDataManager& pdman, 205 void GrGLTextureDomainEffect::setData(const GrGLProgramDataManager& pdman,
206 const GrProcessor& processor) { 206 const GrProcessor& processor) {
207 const GrTextureDomainEffect& textureDomainEffect = processor.cast<GrTextureD omainEffect>(); 207 const GrTextureDomainEffect& textureDomainEffect = processor.cast<GrTextureD omainEffect>();
208 const GrTextureDomain& domain = textureDomainEffect.textureDomain(); 208 const GrTextureDomain& domain = textureDomainEffect.textureDomain();
209 fGLDomain.setData(pdman, domain, processor.texture(0)->origin()); 209 fGLDomain.setData(pdman, domain, processor.texture(0)->origin());
210 } 210 }
211 211
212 void GrGLTextureDomainEffect::GenKey(const GrProcessor& processor, const GrGLCap s&, 212 void GrGLTextureDomainEffect::GenKey(const GrProcessor& processor, const GrGLSLC aps&,
213 GrProcessorKeyBuilder* b) { 213 GrProcessorKeyBuilder* b) {
214 const GrTextureDomain& domain = processor.cast<GrTextureDomainEffect>().text ureDomain(); 214 const GrTextureDomain& domain = processor.cast<GrTextureDomainEffect>().text ureDomain();
215 b->add32(GrTextureDomain::GLDomain::DomainKey(domain)); 215 b->add32(GrTextureDomain::GLDomain::DomainKey(domain));
216 } 216 }
217 217
218 218
219 /////////////////////////////////////////////////////////////////////////////// 219 ///////////////////////////////////////////////////////////////////////////////
220 220
221 GrFragmentProcessor* GrTextureDomainEffect::Create(GrTexture* texture, 221 GrFragmentProcessor* GrTextureDomainEffect::Create(GrTexture* texture,
222 const SkMatrix& matrix, 222 const SkMatrix& matrix,
(...skipping 26 matching lines...) Expand all
249 , fTextureDomain(domain, mode) { 249 , fTextureDomain(domain, mode) {
250 SkASSERT(mode != GrTextureDomain::kRepeat_Mode || 250 SkASSERT(mode != GrTextureDomain::kRepeat_Mode ||
251 filterMode == GrTextureParams::kNone_FilterMode); 251 filterMode == GrTextureParams::kNone_FilterMode);
252 this->initClassID<GrTextureDomainEffect>(); 252 this->initClassID<GrTextureDomainEffect>();
253 } 253 }
254 254
255 GrTextureDomainEffect::~GrTextureDomainEffect() { 255 GrTextureDomainEffect::~GrTextureDomainEffect() {
256 256
257 } 257 }
258 258
259 void GrTextureDomainEffect::getGLProcessorKey(const GrGLCaps& caps, 259 void GrTextureDomainEffect::getGLProcessorKey(const GrGLSLCaps& caps,
260 GrProcessorKeyBuilder* b) const { 260 GrProcessorKeyBuilder* b) const {
261 GrGLTextureDomainEffect::GenKey(*this, caps, b); 261 GrGLTextureDomainEffect::GenKey(*this, caps, b);
262 } 262 }
263 263
264 GrGLFragmentProcessor* GrTextureDomainEffect::createGLInstance() const { 264 GrGLFragmentProcessor* GrTextureDomainEffect::createGLInstance() const {
265 return SkNEW_ARGS(GrGLTextureDomainEffect, (*this)); 265 return SkNEW_ARGS(GrGLTextureDomainEffect, (*this));
266 } 266 }
267 267
268 bool GrTextureDomainEffect::onIsEqual(const GrFragmentProcessor& sBase) const { 268 bool GrTextureDomainEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
269 const GrTextureDomainEffect& s = sBase.cast<GrTextureDomainEffect>(); 269 const GrTextureDomainEffect& s = sBase.cast<GrTextureDomainEffect>();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 const SkMatrix& matrix = GrProcessorUnitTest::TestMatrix(random); 302 const SkMatrix& matrix = GrProcessorUnitTest::TestMatrix(random);
303 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? random->nextBool() : f alse; 303 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? random->nextBool() : f alse;
304 GrCoordSet coords = random->nextBool() ? kLocal_GrCoordSet : kDevice_GrCoord Set; 304 GrCoordSet coords = random->nextBool() ? kLocal_GrCoordSet : kDevice_GrCoord Set;
305 return GrTextureDomainEffect::Create(textures[texIdx], 305 return GrTextureDomainEffect::Create(textures[texIdx],
306 matrix, 306 matrix,
307 domain, 307 domain,
308 mode, 308 mode,
309 bilerp ? GrTextureParams::kBilerp_Filte rMode : GrTextureParams::kNone_FilterMode, 309 bilerp ? GrTextureParams::kBilerp_Filte rMode : GrTextureParams::kNone_FilterMode,
310 coords); 310 coords);
311 } 311 }
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