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

Side by Side Diff: include/gpu/GrTBackendEffectFactory.h

Issue 25605008: Repurpose GrGLCoordTransform as GrGLEffectArray (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « include/core/SkTArray.h ('k') | src/effects/gradients/SkGradientShader.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 #ifndef GrTBackendEffectFactory_DEFINED 8 #ifndef GrTBackendEffectFactory_DEFINED
9 #define GrTBackendEffectFactory_DEFINED 9 #define GrTBackendEffectFactory_DEFINED
10 10
11 #include "GrBackendEffectFactory.h" 11 #include "GrBackendEffectFactory.h"
12 #include "GrDrawEffect.h" 12 #include "GrDrawEffect.h"
13 #include "gl/GrGLProgramEffects.h"
13 14
14 /** 15 /**
15 * Implements GrBackendEffectFactory for a GrEffect subclass as a singleton. 16 * Implements GrBackendEffectFactory for a GrEffect subclass as a singleton.
16 */ 17 */
17 template <typename EffectClass> 18 template <typename EffectClass>
18 class GrTBackendEffectFactory : public GrBackendEffectFactory { 19 class GrTBackendEffectFactory : public GrBackendEffectFactory {
19 20
20 public: 21 public:
21 typedef typename EffectClass::GLEffect GLEffect; 22 typedef typename EffectClass::GLEffect GLEffect;
22 23
23 /** Returns a human-readable name that is accessible via GrEffect or 24 /** Returns a human-readable name that is accessible via GrEffect or
24 GrGLEffect and is consistent between the two of them. 25 GrGLEffect and is consistent between the two of them.
25 */ 26 */
26 virtual const char* name() const SK_OVERRIDE { return EffectClass::Name(); } 27 virtual const char* name() const SK_OVERRIDE { return EffectClass::Name(); }
27 28
28 /** Returns a value that identifies the GLSL shader code generated by 29 /** Returns a value that identifies the GLSL shader code generated by
29 a GrEffect. This enables caching of generated shaders. Part of the 30 a GrEffect. This enables caching of generated shaders. Part of the
30 id identifies the GrEffect subclass. The remainder is based 31 id identifies the GrEffect subclass. The remainder is based
31 on the aspects of the GrEffect object's configuration that affect 32 on the aspects of the GrEffect object's configuration that affect
32 GLSL code generation. */ 33 GLSL code generation. */
33 virtual EffectKey glEffectKey(const GrDrawEffect& drawEffect, 34 virtual EffectKey glEffectKey(const GrDrawEffect& drawEffect,
34 const GrGLCaps& caps) const SK_OVERRIDE { 35 const GrGLCaps& caps) const SK_OVERRIDE {
35 SkASSERT(kIllegalEffectClassID != fEffectClassID); 36 SkASSERT(kIllegalEffectClassID != fEffectClassID);
36 EffectKey effectKey = GLEffect::GenKey(drawEffect, caps); 37 EffectKey effectKey = GLEffect::GenKey(drawEffect, caps);
37 EffectKey textureKey = GLEffect::GenTextureKey(drawEffect, caps); 38 EffectKey textureKey = GrGLProgramEffects::GenTextureKey(drawEffect, cap s);
38 EffectKey transformKey = GLEffect::GenTransformKey(drawEffect); 39 EffectKey transformKey = GrGLProgramEffects::GenTransformKey(drawEffect) ;
39 EffectKey attribKey = GLEffect::GenAttribKey(drawEffect); 40 EffectKey attribKey = GrGLProgramEffects::GenAttribKey(drawEffect);
40 #ifdef SK_DEBUG 41 #ifdef SK_DEBUG
41 static const EffectKey kIllegalEffectKeyMask = (uint16_t) (~((1U << kEff ectKeyBits) - 1)); 42 static const EffectKey kIllegalEffectKeyMask = (uint16_t) (~((1U << kEff ectKeyBits) - 1));
42 SkASSERT(!(kIllegalEffectKeyMask & effectKey)); 43 SkASSERT(!(kIllegalEffectKeyMask & effectKey));
43 44
44 static const EffectKey kIllegalTextureKeyMask = (uint16_t) (~((1U << kTe xtureKeyBits) - 1)); 45 static const EffectKey kIllegalTextureKeyMask = (uint16_t) (~((1U << kTe xtureKeyBits) - 1));
45 SkASSERT(!(kIllegalTextureKeyMask & textureKey)); 46 SkASSERT(!(kIllegalTextureKeyMask & textureKey));
46 47
47 static const EffectKey kIllegalTransformKeyMask = (uint16_t) (~((1U << k TransformKeyBits) - 1)); 48 static const EffectKey kIllegalTransformKeyMask = (uint16_t) (~((1U << k TransformKeyBits) - 1));
48 SkASSERT(!(kIllegalTransformKeyMask & transformKey)); 49 SkASSERT(!(kIllegalTransformKeyMask & transformKey));
49 50
(...skipping 29 matching lines...) Expand all
79 return *gInstance; 80 return *gInstance;
80 } 81 }
81 82
82 protected: 83 protected:
83 GrTBackendEffectFactory() { 84 GrTBackendEffectFactory() {
84 fEffectClassID = GenID(); 85 fEffectClassID = GenID();
85 } 86 }
86 }; 87 };
87 88
88 #endif 89 #endif
OLDNEW
« no previous file with comments | « include/core/SkTArray.h ('k') | src/effects/gradients/SkGradientShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698