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

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

Issue 12531015: Adds local coords to GrEffect system. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 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/SkTLazy.h ('k') | include/gpu/GrContext.h » ('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 GrBackendEffectFactory_DEFINED 8 #ifndef GrBackendEffectFactory_DEFINED
9 #define GrBackendEffectFactory_DEFINED 9 #define GrBackendEffectFactory_DEFINED
10 10
11 #include "GrTypes.h" 11 #include "GrTypes.h"
12 #include "SkTemplates.h" 12 #include "SkTemplates.h"
13 #include "SkThread_platform.h" 13 #include "SkThread_platform.h"
14 #include "GrNoncopyable.h" 14 #include "GrNoncopyable.h"
15 15
16 /** Given a GrEffect of a particular type, creates the corresponding graphics-ba ckend-specific 16 /** Given a GrEffect of a particular type, creates the corresponding graphics-ba ckend-specific
17 effect object. Also tracks equivalence of shaders generated via a key. Each factory instance 17 effect object. Also tracks equivalence of shaders generated via a key. Each factory instance
18 is assigned a generation ID at construction. The ID of the return of GrEffec t::getFactory() 18 is assigned a generation ID at construction. The ID of the return of GrEffec t::getFactory()
19 is used as a type identifier. Thus a GrEffect subclass must return a singlet on from 19 is used as a type identifier. Thus a GrEffect subclass must return a singlet on from
20 getFactory(). GrEffect subclasses should use the derived class GrTBackendEff ectFactory that is 20 getFactory(). GrEffect subclasses should use the derived class GrTBackendEff ectFactory that is
21 templated on the GrEffect subclass as their factory object. It requires that the GrEffect 21 templated on the GrEffect subclass as their factory object. It requires that the GrEffect
22 subclass has a nested class (or typedef) GLEffect which is its GL implementa tion and a subclass 22 subclass has a nested class (or typedef) GLEffect which is its GL implementa tion and a subclass
23 of GrGLEffect. 23 of GrGLEffect.
24 */ 24 */
25 25
26 class GrEffectRef; 26 class GrEffectRef;
27 class GrEffectStage;
28 class GrGLEffect; 27 class GrGLEffect;
29 class GrGLCaps; 28 class GrGLCaps;
29 class GrDrawEffect;
30 30
31 class GrBackendEffectFactory : public GrNoncopyable { 31 class GrBackendEffectFactory : public GrNoncopyable {
32 public: 32 public:
33 typedef uint32_t EffectKey; 33 typedef uint32_t EffectKey;
34 enum { 34 enum {
35 kNoEffectKey = 0, 35 kNoEffectKey = 0,
36 kEffectKeyBits = 12, 36 kEffectKeyBits = 16,
37 /** 37 /**
38 * Some aspects of the generated code may be determined by the particula r textures that are 38 * Some aspects of the generated code may be determined by the particula r textures that are
39 * associated with the effect. These manipulations are performed by GrGL ShaderBuilder beyond 39 * associated with the effect. These manipulations are performed by GrGL ShaderBuilder beyond
40 * GrGLEffects' control. So there is a dedicated part of the key which i s combined 40 * GrGLEffects' control. So there is a dedicated part of the key which i s combined
41 * automatically with the bits produced by GrGLEffect::GenKey(). 41 * automatically with the bits produced by GrGLEffect::GenKey().
42 */ 42 */
43 kTextureKeyBits = 6, 43 kTextureKeyBits = 6,
44 kAttribKeyBits = 6 44 kAttribKeyBits = 6
45 }; 45 };
46 46
47 virtual EffectKey glEffectKey(const GrEffectStage&, const GrGLCaps&) const = 0; 47 virtual EffectKey glEffectKey(const GrDrawEffect&, const GrGLCaps&) const = 0;
48 virtual GrGLEffect* createGLInstance(const GrEffectRef&) const = 0; 48 virtual GrGLEffect* createGLInstance(const GrDrawEffect&) const = 0;
49 49
50 bool operator ==(const GrBackendEffectFactory& b) const { 50 bool operator ==(const GrBackendEffectFactory& b) const {
51 return fEffectClassID == b.fEffectClassID; 51 return fEffectClassID == b.fEffectClassID;
52 } 52 }
53 bool operator !=(const GrBackendEffectFactory& b) const { 53 bool operator !=(const GrBackendEffectFactory& b) const {
54 return !(*this == b); 54 return !(*this == b);
55 } 55 }
56 56
57 virtual const char* name() const = 0; 57 virtual const char* name() const = 0;
58 58
(...skipping 19 matching lines...) Expand all
78 return static_cast<EffectKey>(id); 78 return static_cast<EffectKey>(id);
79 } 79 }
80 80
81 EffectKey fEffectClassID; 81 EffectKey fEffectClassID;
82 82
83 private: 83 private:
84 static int32_t fCurrEffectClassID; 84 static int32_t fCurrEffectClassID;
85 }; 85 };
86 86
87 #endif 87 #endif
OLDNEW
« no previous file with comments | « include/core/SkTLazy.h ('k') | include/gpu/GrContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698