OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 namespace gles2 { | 27 namespace gles2 { |
28 | 28 |
29 class ProgramCache; | 29 class ProgramCache; |
30 class BufferManager; | 30 class BufferManager; |
31 class GLES2Decoder; | 31 class GLES2Decoder; |
32 class FramebufferManager; | 32 class FramebufferManager; |
33 class MailboxManager; | 33 class MailboxManager; |
34 class RenderbufferManager; | 34 class RenderbufferManager; |
35 class PathManager; | 35 class PathManager; |
36 class ProgramManager; | 36 class ProgramManager; |
| 37 class SamplerManager; |
37 class ShaderManager; | 38 class ShaderManager; |
38 class TextureManager; | 39 class TextureManager; |
39 class SubscriptionRefSet; | 40 class SubscriptionRefSet; |
40 class ValuebufferManager; | 41 class ValuebufferManager; |
41 class MemoryTracker; | 42 class MemoryTracker; |
42 struct DisallowedFeatures; | 43 struct DisallowedFeatures; |
43 | 44 |
44 // A Context Group helps manage multiple GLES2Decoders that share | 45 // A Context Group helps manage multiple GLES2Decoders that share |
45 // resources. | 46 // resources. |
46 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { | 47 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 } | 171 } |
171 | 172 |
172 ShaderManager* shader_manager() const { | 173 ShaderManager* shader_manager() const { |
173 return shader_manager_.get(); | 174 return shader_manager_.get(); |
174 } | 175 } |
175 | 176 |
176 TransferBufferManager* transfer_buffer_manager() const { | 177 TransferBufferManager* transfer_buffer_manager() const { |
177 return transfer_buffer_manager_.get(); | 178 return transfer_buffer_manager_.get(); |
178 } | 179 } |
179 | 180 |
| 181 SamplerManager* sampler_manager() const { |
| 182 return sampler_manager_.get(); |
| 183 } |
| 184 |
180 uint32 GetMemRepresented() const; | 185 uint32 GetMemRepresented() const; |
181 | 186 |
182 // Loses all the context associated with this group. | 187 // Loses all the context associated with this group. |
183 void LoseContexts(error::ContextLostReason reason); | 188 void LoseContexts(error::ContextLostReason reason); |
184 | 189 |
185 bool GetBufferServiceId(GLuint client_id, GLuint* service_id) const; | 190 bool GetBufferServiceId(GLuint client_id, GLuint* service_id) const; |
186 | 191 |
187 void AddSamplerId(GLuint client_id, GLuint service_id) { | |
188 samplers_id_map_[client_id] = service_id; | |
189 } | |
190 | |
191 bool GetSamplerServiceId(GLuint client_id, GLuint* service_id) const { | |
192 base::hash_map<GLuint, GLuint>::const_iterator iter = | |
193 samplers_id_map_.find(client_id); | |
194 if (iter == samplers_id_map_.end()) | |
195 return false; | |
196 if (service_id) | |
197 *service_id = iter->second; | |
198 return true; | |
199 } | |
200 | |
201 void RemoveSamplerId(GLuint client_id) { | |
202 samplers_id_map_.erase(client_id); | |
203 } | |
204 | |
205 void AddTransformFeedbackId(GLuint client_id, GLuint service_id) { | 192 void AddTransformFeedbackId(GLuint client_id, GLuint service_id) { |
206 transformfeedbacks_id_map_[client_id] = service_id; | 193 transformfeedbacks_id_map_[client_id] = service_id; |
207 } | 194 } |
208 | 195 |
209 bool GetTransformFeedbackServiceId( | 196 bool GetTransformFeedbackServiceId( |
210 GLuint client_id, GLuint* service_id) const { | 197 GLuint client_id, GLuint* service_id) const { |
211 if (client_id == 0) { | 198 if (client_id == 0) { |
212 // Default one. | 199 // Default one. |
213 if (service_id) | 200 if (service_id) |
214 *service_id = 0; | 201 *service_id = 0; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 scoped_ptr<RenderbufferManager> renderbuffer_manager_; | 273 scoped_ptr<RenderbufferManager> renderbuffer_manager_; |
287 | 274 |
288 scoped_ptr<TextureManager> texture_manager_; | 275 scoped_ptr<TextureManager> texture_manager_; |
289 | 276 |
290 scoped_ptr<PathManager> path_manager_; | 277 scoped_ptr<PathManager> path_manager_; |
291 | 278 |
292 scoped_ptr<ProgramManager> program_manager_; | 279 scoped_ptr<ProgramManager> program_manager_; |
293 | 280 |
294 scoped_ptr<ShaderManager> shader_manager_; | 281 scoped_ptr<ShaderManager> shader_manager_; |
295 | 282 |
| 283 scoped_ptr<SamplerManager> sampler_manager_; |
| 284 |
296 scoped_ptr<ValuebufferManager> valuebuffer_manager_; | 285 scoped_ptr<ValuebufferManager> valuebuffer_manager_; |
297 | 286 |
298 scoped_refptr<FeatureInfo> feature_info_; | 287 scoped_refptr<FeatureInfo> feature_info_; |
299 | 288 |
300 std::vector<base::WeakPtr<gles2::GLES2Decoder> > decoders_; | 289 std::vector<base::WeakPtr<gles2::GLES2Decoder> > decoders_; |
301 | 290 |
302 // Mappings from client side IDs to service side IDs. | 291 // Mappings from client side IDs to service side IDs. |
303 base::hash_map<GLuint, GLuint> samplers_id_map_; | |
304 base::hash_map<GLuint, GLuint> transformfeedbacks_id_map_; | 292 base::hash_map<GLuint, GLuint> transformfeedbacks_id_map_; |
305 base::hash_map<GLuint, GLsync> syncs_id_map_; | 293 base::hash_map<GLuint, GLsync> syncs_id_map_; |
306 | 294 |
307 DISALLOW_COPY_AND_ASSIGN(ContextGroup); | 295 DISALLOW_COPY_AND_ASSIGN(ContextGroup); |
308 }; | 296 }; |
309 | 297 |
310 } // namespace gles2 | 298 } // namespace gles2 |
311 } // namespace gpu | 299 } // namespace gpu |
312 | 300 |
313 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ | 301 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ |
OLD | NEW |