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

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

Issue 659803005: Last round of effect->processor (for now) (Closed) Base URL: https://skia.googlesource.com/skia.git@factory
Patch Set: fixed Created 6 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
« no previous file with comments | « no previous file | include/gpu/GrCoordTransform.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 GrBackendProcessorFactory_DEFINED 8 #ifndef GrBackendProcessorFactory_DEFINED
9 #define GrBackendProcessorFactory_DEFINED 9 #define GrBackendProcessorFactory_DEFINED
10 10
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 /** 104 /**
105 * Produces a human-reable name for the v. 105 * Produces a human-reable name for the v.
106 */ 106 */
107 virtual const char* name() const = 0; 107 virtual const char* name() const = 0;
108 108
109 /** 109 /**
110 * A unique value for every instance of this factory. It is automatically in corporated into the 110 * A unique value for every instance of this factory. It is automatically in corporated into the
111 * processor's key. This allows keys generated by getGLProcessorKey() to onl y be unique within a 111 * processor's key. This allows keys generated by getGLProcessorKey() to onl y be unique within a
112 * GrProcessor subclass and not necessarily across subclasses. 112 * GrProcessor subclass and not necessarily across subclasses.
113 */ 113 */
114 uint32_t effectClassID() const { return fEffectClassID; } 114 uint32_t classID() const { return fProcessorClassID; }
115 115
116 protected: 116 protected:
117 GrBackendProcessorFactory() : fEffectClassID(GenID()) {} 117 GrBackendProcessorFactory() : fProcessorClassID(GenClassID()) {}
118 virtual ~GrBackendProcessorFactory() {} 118 virtual ~GrBackendProcessorFactory() {}
119 119
120 private: 120 private:
121 enum { 121 enum {
122 kIllegalEffectClassID = 0, 122 kIllegalProcessorClassID = 0,
123 }; 123 };
124 124
125 static uint32_t GenID() { 125 static uint32_t GenClassID() {
126 // fCurrEffectClassID has been initialized to kIllegalEffectClassID. The 126 // fCurrProcessorClassID has been initialized to kIllegalProcessorClassI D. The
127 // atomic inc returns the old value not the incremented value. So we add 127 // atomic inc returns the old value not the incremented value. So we add
128 // 1 to the returned value. 128 // 1 to the returned value.
129 uint32_t id = static_cast<uint32_t>(sk_atomic_inc(&fCurrEffectClassID)) + 1; 129 uint32_t id = static_cast<uint32_t>(sk_atomic_inc(&fCurrProcessorClassID )) + 1;
130 if (!id) { 130 if (!id) {
131 SkFAIL("This should never wrap as it should only be called once for each GrProcessor " 131 SkFAIL("This should never wrap as it should only be called once for each GrProcessor "
132 "subclass."); 132 "subclass.");
133 } 133 }
134 return id; 134 return id;
135 } 135 }
136 136
137 const uint32_t fEffectClassID; 137 const uint32_t fProcessorClassID;
138 static int32_t fCurrEffectClassID; 138 static int32_t fCurrProcessorClassID;
139 }; 139 };
140 140
141 class GrFragmentProcessor; 141 class GrFragmentProcessor;
142 class GrGeometryProcessor; 142 class GrGeometryProcessor;
143 class GrGLFragmentProcessor; 143 class GrGLFragmentProcessor;
144 class GrGLGeometryProcessor; 144 class GrGLGeometryProcessor;
145 145
146 /** 146 /**
147 * Backend processor factory cannot actually create anything, it is up to subcla sses to implement 147 * Backend processor factory cannot actually create anything, it is up to subcla sses to implement
148 * a create binding which matches Gr to GL in a type safe way 148 * a create binding which matches Gr to GL in a type safe way
(...skipping 11 matching lines...) Expand all
160 class GrBackendGeometryProcessorFactory : public GrBackendProcessorFactory { 160 class GrBackendGeometryProcessorFactory : public GrBackendProcessorFactory {
161 public: 161 public:
162 /** 162 /**
163 * Creates a GrGLProcessor instance that is used both to generate code for t he GrProcessor in a 163 * Creates a GrGLProcessor instance that is used both to generate code for t he GrProcessor in a
164 * GLSL program and to manage updating uniforms for the program when it is u sed. 164 * GLSL program and to manage updating uniforms for the program when it is u sed.
165 */ 165 */
166 virtual GrGLGeometryProcessor* createGLInstance(const GrGeometryProcessor&) const = 0; 166 virtual GrGLGeometryProcessor* createGLInstance(const GrGeometryProcessor&) const = 0;
167 }; 167 };
168 168
169 #endif 169 #endif
OLDNEW
« no previous file with comments | « no previous file | include/gpu/GrCoordTransform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698