OLD | NEW |
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 "SkTypes.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 GrGLEffect; | 27 class GrGLEffect; |
28 class GrGLCaps; | 28 class GrGLCaps; |
29 class GrDrawEffect; | 29 class GrDrawEffect; |
30 | 30 |
31 class GrBackendEffectFactory : public GrNoncopyable { | 31 class GrBackendEffectFactory : public SkNoncopyable { |
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 = 15, | 36 kEffectKeyBits = 15, |
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(). |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 return static_cast<EffectKey>(id); | 77 return static_cast<EffectKey>(id); |
78 } | 78 } |
79 | 79 |
80 EffectKey fEffectClassID; | 80 EffectKey fEffectClassID; |
81 | 81 |
82 private: | 82 private: |
83 static int32_t fCurrEffectClassID; | 83 static int32_t fCurrEffectClassID; |
84 }; | 84 }; |
85 | 85 |
86 #endif | 86 #endif |
OLD | NEW |