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 #include "GrProcessor.h" | 8 #include "GrProcessor.h" |
9 #include "GrBackendProcessorFactory.h" | |
10 #include "GrContext.h" | 9 #include "GrContext.h" |
11 #include "GrCoordTransform.h" | 10 #include "GrCoordTransform.h" |
12 #include "GrGeometryData.h" | 11 #include "GrGeometryData.h" |
13 #include "GrInvariantOutput.h" | 12 #include "GrInvariantOutput.h" |
14 #include "GrMemoryPool.h" | 13 #include "GrMemoryPool.h" |
15 #include "SkTLS.h" | 14 #include "SkTLS.h" |
16 | 15 |
17 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS | 16 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS |
18 | 17 |
| 18 class GrFragmentProcessor; |
| 19 class GrGeometryProcessor; |
| 20 |
19 /* | 21 /* |
20 * Originally these were both in the processor unit test header, but then it see
med to cause linker | 22 * Originally these were both in the processor unit test header, but then it see
med to cause linker |
21 * problems on android. | 23 * problems on android. |
22 */ | 24 */ |
23 template<> | 25 template<> |
24 SkTArray<GrProcessorTestFactory<GrFragmentProcessor>*, true>* | 26 SkTArray<GrProcessorTestFactory<GrFragmentProcessor>*, true>* |
25 GrProcessorTestFactory<GrFragmentProcessor>::GetFactories() { | 27 GrProcessorTestFactory<GrFragmentProcessor>::GetFactories() { |
26 static SkTArray<GrProcessorTestFactory<GrFragmentProcessor>*, true> gFactori
es; | 28 static SkTArray<GrProcessorTestFactory<GrFragmentProcessor>*, true> gFactori
es; |
27 return &gFactories; | 29 return &gFactories; |
28 } | 30 } |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 private: | 104 private: |
103 static void* CreateTLS() { | 105 static void* CreateTLS() { |
104 return SkNEW_ARGS(GrMemoryPool, (4096, 4096)); | 106 return SkNEW_ARGS(GrMemoryPool, (4096, 4096)); |
105 } | 107 } |
106 | 108 |
107 static void DeleteTLS(void* pool) { | 109 static void DeleteTLS(void* pool) { |
108 SkDELETE(reinterpret_cast<GrMemoryPool*>(pool)); | 110 SkDELETE(reinterpret_cast<GrMemoryPool*>(pool)); |
109 } | 111 } |
110 }; | 112 }; |
111 | 113 |
112 int32_t GrBackendProcessorFactory::fCurrProcessorClassID = | 114 int32_t GrProcessor::gCurrProcessorClassID = |
113 GrBackendProcessorFactory::kIllegalProcessorClassID; | 115 GrProcessor::kIllegalProcessorClassID; |
114 | 116 |
115 /////////////////////////////////////////////////////////////////////////////// | 117 /////////////////////////////////////////////////////////////////////////////// |
116 | 118 |
117 GrProcessor::~GrProcessor() {} | 119 GrProcessor::~GrProcessor() {} |
118 | 120 |
119 const char* GrProcessor::name() const { | |
120 return this->getFactory().name(); | |
121 } | |
122 | |
123 void GrProcessor::addTextureAccess(const GrTextureAccess* access) { | 121 void GrProcessor::addTextureAccess(const GrTextureAccess* access) { |
124 fTextureAccesses.push_back(access); | 122 fTextureAccesses.push_back(access); |
125 this->addGpuResource(access->getProgramTexture()); | 123 this->addGpuResource(access->getProgramTexture()); |
126 } | 124 } |
127 | 125 |
128 void* GrProcessor::operator new(size_t size) { | 126 void* GrProcessor::operator new(size_t size) { |
129 return GrProcessor_Globals::GetTLS()->allocate(size); | 127 return GrProcessor_Globals::GetTLS()->allocate(size); |
130 } | 128 } |
131 | 129 |
132 void GrProcessor::operator delete(void* target) { | 130 void GrProcessor::operator delete(void* target) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 /* | 172 /* |
175 * GrGeometryData shares the same pool so it lives in this file too | 173 * GrGeometryData shares the same pool so it lives in this file too |
176 */ | 174 */ |
177 void* GrGeometryData::operator new(size_t size) { | 175 void* GrGeometryData::operator new(size_t size) { |
178 return GrProcessor_Globals::GetTLS()->allocate(size); | 176 return GrProcessor_Globals::GetTLS()->allocate(size); |
179 } | 177 } |
180 | 178 |
181 void GrGeometryData::operator delete(void* target) { | 179 void GrGeometryData::operator delete(void* target) { |
182 GrProcessor_Globals::GetTLS()->release(target); | 180 GrProcessor_Globals::GetTLS()->release(target); |
183 } | 181 } |
184 | |
OLD | NEW |