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

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

Issue 774133003: Revert of create and thread batch tracker object (Closed) Base URL: https://skia.googlesource.com/skia.git@2_vertex_attr
Patch Set: Created 6 years 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 | « include/gpu/GrBackendProcessorFactory.h ('k') | src/gpu/GrAAConvexPathRenderer.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 GrTBackendProcessorFactory_DEFINED 8 #ifndef GrTBackendProcessorFactory_DEFINED
9 #define GrTBackendProcessorFactory_DEFINED 9 #define GrTBackendProcessorFactory_DEFINED
10 10
(...skipping 23 matching lines...) Expand all
34 */ 34 */
35 template <class ProcessorClass, class BackEnd, class ProcessorBase, class GLProc essorBase> 35 template <class ProcessorClass, class BackEnd, class ProcessorBase, class GLProc essorBase>
36 class GrTBackendProcessorFactory : public BackEnd { 36 class GrTBackendProcessorFactory : public BackEnd {
37 public: 37 public:
38 typedef typename ProcessorClass::GLProcessor GLProcessor; 38 typedef typename ProcessorClass::GLProcessor GLProcessor;
39 39
40 /** Returns a human-readable name for the processor. Implemented using GLPro cessor::Name as 40 /** Returns a human-readable name for the processor. Implemented using GLPro cessor::Name as
41 * described in this class's comment. */ 41 * described in this class's comment. */
42 virtual const char* name() const SK_OVERRIDE { return ProcessorClass::Name() ; } 42 virtual const char* name() const SK_OVERRIDE { return ProcessorClass::Name() ; }
43 43
44
45 /** Implemented using GLProcessor::GenKey as described in this class's comme nt. */
46 virtual void getGLProcessorKey(const GrProcessor& processor,
47 const GrGLCaps& caps,
48 GrProcessorKeyBuilder* b) const SK_OVERRIDE {
49 GLProcessor::GenKey(processor, caps, b);
50 }
51
44 /** Returns a new instance of the appropriate *GL* implementation class 52 /** Returns a new instance of the appropriate *GL* implementation class
45 for the given GrProcessor; caller is responsible for deleting 53 for the given GrProcessor; caller is responsible for deleting
46 the object. */ 54 the object. */
47 virtual GLProcessorBase* createGLInstance(const ProcessorBase& processor) co nst SK_OVERRIDE { 55 virtual GLProcessorBase* createGLInstance(const ProcessorBase& processor) co nst SK_OVERRIDE {
48 return SkNEW_ARGS(GLProcessor, (*this, processor)); 56 return SkNEW_ARGS(GLProcessor, (*this, processor));
49 } 57 }
50 58
51 /** This class is a singleton. This function returns the single instance. */ 59 /** This class is a singleton. This function returns the single instance. */
52 static const BackEnd& getInstance() { 60 static const BackEnd& getInstance() {
53 static SkAlignedSTStorage<1, GrTBackendProcessorFactory> gInstanceMem; 61 static SkAlignedSTStorage<1, GrTBackendProcessorFactory> gInstanceMem;
54 static const GrTBackendProcessorFactory* gInstance; 62 static const GrTBackendProcessorFactory* gInstance;
55 if (!gInstance) { 63 if (!gInstance) {
56 gInstance = SkNEW_PLACEMENT(gInstanceMem.get(), 64 gInstance = SkNEW_PLACEMENT(gInstanceMem.get(),
57 GrTBackendProcessorFactory); 65 GrTBackendProcessorFactory);
58 } 66 }
59 return *gInstance; 67 return *gInstance;
60 } 68 }
61 69
62 protected: 70 protected:
63 GrTBackendProcessorFactory() {} 71 GrTBackendProcessorFactory() {}
64 }; 72 };
65 73
66 /* 74 /*
67 * Every processor so far derives from one of the following subclasses of 75 * Every processor so far derives from one of the following subclasses of
68 * GrTBackendProcessorFactory. All of this machinery is necessary to ensure that creatGLInstace is 76 * GrTBackendProcessorFactory. All of this machinery is necessary to ensure that creatGLInstace is
69 * typesafe and does not require any casting. 77 * typesafe and does not require any casting.
70 */ 78 */
71 template <class ProcessorClass> 79 template <class ProcessorClass>
72 class GrTBackendGeometryProcessorFactory : public GrBackendGeometryProcessorFact ory { 80 class GrTBackendGeometryProcessorFactory
73 public: 81 : public GrTBackendProcessorFactory<ProcessorClass,
74 typedef typename ProcessorClass::GLProcessor GLProcessor; 82 GrBackendGeometryProcessorFactory,
75 83 GrGeometryProcessor,
76 /** Returns a human-readable name for the processor. Implemented using GLPro cessor::Name as 84 GrGLGeometryProcessor> {
77 * described in this class's comment. */
78 virtual const char* name() const SK_OVERRIDE { return ProcessorClass::Name() ; }
79
80 /** Implemented using GLProcessor::GenKey as described in this class's comme nt. */
81 virtual void getGLProcessorKey(const GrGeometryProcessor& processor,
82 const GrBatchTracker& bt,
83 const GrGLCaps& caps,
84 GrProcessorKeyBuilder* b) const SK_OVERRIDE {
85 GLProcessor::GenKey(processor, bt, caps, b);
86 }
87
88
89 /** Returns a new instance of the appropriate *GL* implementation class
90 for the given GrProcessor; caller is responsible for deleting
91 the object. */
92 virtual GrGLGeometryProcessor* createGLInstance(const GrGeometryProcessor& g p,
93 const GrBatchTracker& bt) co nst SK_OVERRIDE {
94 return SkNEW_ARGS(GLProcessor, (*this, gp, bt));
95 }
96
97 /** This class is a singleton. This function returns the single instance. */
98 static const GrBackendGeometryProcessorFactory& getInstance() {
99 static SkAlignedSTStorage<1, GrTBackendGeometryProcessorFactory> gInstan ceMem;
100 static const GrTBackendGeometryProcessorFactory* gInstance;
101 if (!gInstance) {
102 gInstance = SkNEW_PLACEMENT(gInstanceMem.get(),
103 GrTBackendGeometryProcessorFactory);
104 }
105 return *gInstance;
106 }
107 protected: 85 protected:
108 GrTBackendGeometryProcessorFactory() {} 86 GrTBackendGeometryProcessorFactory() {}
109 }; 87 };
110 88
111 template <class ProcessorClass> 89 template <class ProcessorClass>
112 class GrTBackendFragmentProcessorFactory : public GrBackendFragmentProcessorFact ory { 90 class GrTBackendFragmentProcessorFactory
113 public: 91 : public GrTBackendProcessorFactory<ProcessorClass,
114 typedef typename ProcessorClass::GLProcessor GLProcessor; 92 GrBackendFragmentProcessorFactory,
115 93 GrFragmentProcessor,
116 /** Returns a human-readable name for the processor. Implemented using GLPro cessor::Name as 94 GrGLFragmentProcessor> {
117 * described in this class's comment. */
118 virtual const char* name() const SK_OVERRIDE { return ProcessorClass::Name() ; }
119
120 /** Implemented using GLProcessor::GenKey as described in this class's comme nt. */
121 virtual void getGLProcessorKey(const GrFragmentProcessor& processor,
122 const GrGLCaps& caps,
123 GrProcessorKeyBuilder* b) const SK_OVERRIDE {
124 GLProcessor::GenKey(processor, caps, b);
125 }
126
127 /** Returns a new instance of the appropriate *GL* implementation class
128 for the given GrProcessor; caller is responsible for deleting
129 the object. */
130 virtual GrGLFragmentProcessor* createGLInstance(const GrFragmentProcessor& g p) const SK_OVERRIDE {
131 return SkNEW_ARGS(GLProcessor, (*this, gp));
132 }
133
134 /** This class is a singleton. This function returns the single instance. */
135 static const GrBackendFragmentProcessorFactory& getInstance() {
136 static SkAlignedSTStorage<1, GrTBackendFragmentProcessorFactory> gInstan ceMem;
137 static const GrTBackendFragmentProcessorFactory* gInstance;
138 if (!gInstance) {
139 gInstance = SkNEW_PLACEMENT(gInstanceMem.get(),
140 GrTBackendFragmentProcessorFactory);
141 }
142 return *gInstance;
143 }
144 protected: 95 protected:
145 GrTBackendFragmentProcessorFactory() {} 96 GrTBackendFragmentProcessorFactory() {}
146 }; 97 };
147 98
99
148 #endif 100 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrBackendProcessorFactory.h ('k') | src/gpu/GrAAConvexPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698