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 <stdint.h> |
| 9 |
8 #include <vector> | 10 #include <vector> |
9 #include "base/basictypes.h" | |
10 #include "base/containers/hash_tables.h" | 11 #include "base/containers/hash_tables.h" |
| 12 #include "base/macros.h" |
11 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
14 #include "gpu/command_buffer/common/constants.h" | 16 #include "gpu/command_buffer/common/constants.h" |
15 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 17 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
16 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 18 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
17 #include "gpu/command_buffer/service/feature_info.h" | 19 #include "gpu/command_buffer/service/feature_info.h" |
18 #include "gpu/command_buffer/service/framebuffer_completeness_cache.h" | 20 #include "gpu/command_buffer/service/framebuffer_completeness_cache.h" |
19 #include "gpu/command_buffer/service/shader_translator_cache.h" | 21 #include "gpu/command_buffer/service/shader_translator_cache.h" |
20 #include "gpu/gpu_export.h" | 22 #include "gpu/gpu_export.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } | 83 } |
82 | 84 |
83 FramebufferCompletenessCache* framebuffer_completeness_cache() const { | 85 FramebufferCompletenessCache* framebuffer_completeness_cache() const { |
84 return framebuffer_completeness_cache_.get(); | 86 return framebuffer_completeness_cache_.get(); |
85 } | 87 } |
86 | 88 |
87 bool bind_generates_resource() { | 89 bool bind_generates_resource() { |
88 return bind_generates_resource_; | 90 return bind_generates_resource_; |
89 } | 91 } |
90 | 92 |
91 uint32 max_vertex_attribs() const { | 93 uint32_t max_vertex_attribs() const { return max_vertex_attribs_; } |
92 return max_vertex_attribs_; | |
93 } | |
94 | 94 |
95 uint32 max_texture_units() const { | 95 uint32_t max_texture_units() const { return max_texture_units_; } |
96 return max_texture_units_; | |
97 } | |
98 | 96 |
99 uint32 max_texture_image_units() const { | 97 uint32_t max_texture_image_units() const { return max_texture_image_units_; } |
100 return max_texture_image_units_; | |
101 } | |
102 | 98 |
103 uint32 max_vertex_texture_image_units() const { | 99 uint32_t max_vertex_texture_image_units() const { |
104 return max_vertex_texture_image_units_; | 100 return max_vertex_texture_image_units_; |
105 } | 101 } |
106 | 102 |
107 uint32 max_fragment_uniform_vectors() const { | 103 uint32_t max_fragment_uniform_vectors() const { |
108 return max_fragment_uniform_vectors_; | 104 return max_fragment_uniform_vectors_; |
109 } | 105 } |
110 | 106 |
111 uint32 max_varying_vectors() const { | 107 uint32_t max_varying_vectors() const { return max_varying_vectors_; } |
112 return max_varying_vectors_; | |
113 } | |
114 | 108 |
115 uint32 max_vertex_uniform_vectors() const { | 109 uint32_t max_vertex_uniform_vectors() const { |
116 return max_vertex_uniform_vectors_; | 110 return max_vertex_uniform_vectors_; |
117 } | 111 } |
118 | 112 |
119 uint32 max_color_attachments() const { | 113 uint32_t max_color_attachments() const { return max_color_attachments_; } |
120 return max_color_attachments_; | |
121 } | |
122 | 114 |
123 uint32 max_draw_buffers() const { | 115 uint32_t max_draw_buffers() const { return max_draw_buffers_; } |
124 return max_draw_buffers_; | |
125 } | |
126 | 116 |
127 uint32 max_dual_source_draw_buffers() const { | 117 uint32_t max_dual_source_draw_buffers() const { |
128 return max_dual_source_draw_buffers_; | 118 return max_dual_source_draw_buffers_; |
129 } | 119 } |
130 | 120 |
131 FeatureInfo* feature_info() { | 121 FeatureInfo* feature_info() { |
132 return feature_info_.get(); | 122 return feature_info_.get(); |
133 } | 123 } |
134 | 124 |
135 BufferManager* buffer_manager() const { | 125 BufferManager* buffer_manager() const { |
136 return buffer_manager_.get(); | 126 return buffer_manager_.get(); |
137 } | 127 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 } | 165 } |
176 | 166 |
177 TransferBufferManager* transfer_buffer_manager() const { | 167 TransferBufferManager* transfer_buffer_manager() const { |
178 return transfer_buffer_manager_.get(); | 168 return transfer_buffer_manager_.get(); |
179 } | 169 } |
180 | 170 |
181 SamplerManager* sampler_manager() const { | 171 SamplerManager* sampler_manager() const { |
182 return sampler_manager_.get(); | 172 return sampler_manager_.get(); |
183 } | 173 } |
184 | 174 |
185 uint32 GetMemRepresented() const; | 175 uint32_t GetMemRepresented() const; |
186 | 176 |
187 // Loses all the context associated with this group. | 177 // Loses all the context associated with this group. |
188 void LoseContexts(error::ContextLostReason reason); | 178 void LoseContexts(error::ContextLostReason reason); |
189 | 179 |
190 bool GetBufferServiceId(GLuint client_id, GLuint* service_id) const; | 180 bool GetBufferServiceId(GLuint client_id, GLuint* service_id) const; |
191 | 181 |
192 void AddTransformFeedbackId(GLuint client_id, GLuint service_id) { | 182 void AddTransformFeedbackId(GLuint client_id, GLuint service_id) { |
193 transformfeedbacks_id_map_[client_id] = service_id; | 183 transformfeedbacks_id_map_[client_id] = service_id; |
194 } | 184 } |
195 | 185 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 | 220 |
231 void RemoveSyncId(GLuint client_id) { | 221 void RemoveSyncId(GLuint client_id) { |
232 syncs_id_map_.erase(client_id); | 222 syncs_id_map_.erase(client_id); |
233 } | 223 } |
234 | 224 |
235 private: | 225 private: |
236 friend class base::RefCounted<ContextGroup>; | 226 friend class base::RefCounted<ContextGroup>; |
237 ~ContextGroup(); | 227 ~ContextGroup(); |
238 | 228 |
239 bool CheckGLFeature(GLint min_required, GLint* v); | 229 bool CheckGLFeature(GLint min_required, GLint* v); |
240 bool CheckGLFeatureU(GLint min_required, uint32* v); | 230 bool CheckGLFeatureU(GLint min_required, uint32_t* v); |
241 bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v); | 231 bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v); |
242 bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32* v); | 232 bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32_t* v); |
243 bool HaveContexts(); | 233 bool HaveContexts(); |
244 | 234 |
245 scoped_refptr<MailboxManager> mailbox_manager_; | 235 scoped_refptr<MailboxManager> mailbox_manager_; |
246 scoped_refptr<MemoryTracker> memory_tracker_; | 236 scoped_refptr<MemoryTracker> memory_tracker_; |
247 scoped_refptr<ShaderTranslatorCache> shader_translator_cache_; | 237 scoped_refptr<ShaderTranslatorCache> shader_translator_cache_; |
248 scoped_refptr<FramebufferCompletenessCache> framebuffer_completeness_cache_; | 238 scoped_refptr<FramebufferCompletenessCache> framebuffer_completeness_cache_; |
249 scoped_refptr<TransferBufferManager> transfer_buffer_manager_; | 239 scoped_refptr<TransferBufferManager> transfer_buffer_manager_; |
250 scoped_refptr<SubscriptionRefSet> subscription_ref_set_; | 240 scoped_refptr<SubscriptionRefSet> subscription_ref_set_; |
251 scoped_refptr<ValueStateMap> pending_valuebuffer_state_; | 241 scoped_refptr<ValueStateMap> pending_valuebuffer_state_; |
252 | 242 |
253 bool enforce_gl_minimums_; | 243 bool enforce_gl_minimums_; |
254 bool bind_generates_resource_; | 244 bool bind_generates_resource_; |
255 | 245 |
256 uint32 max_vertex_attribs_; | 246 uint32_t max_vertex_attribs_; |
257 uint32 max_texture_units_; | 247 uint32_t max_texture_units_; |
258 uint32 max_texture_image_units_; | 248 uint32_t max_texture_image_units_; |
259 uint32 max_vertex_texture_image_units_; | 249 uint32_t max_vertex_texture_image_units_; |
260 uint32 max_fragment_uniform_vectors_; | 250 uint32_t max_fragment_uniform_vectors_; |
261 uint32 max_varying_vectors_; | 251 uint32_t max_varying_vectors_; |
262 uint32 max_vertex_uniform_vectors_; | 252 uint32_t max_vertex_uniform_vectors_; |
263 uint32 max_color_attachments_; | 253 uint32_t max_color_attachments_; |
264 uint32 max_draw_buffers_; | 254 uint32_t max_draw_buffers_; |
265 uint32 max_dual_source_draw_buffers_; | 255 uint32_t max_dual_source_draw_buffers_; |
266 | 256 |
267 ProgramCache* program_cache_; | 257 ProgramCache* program_cache_; |
268 | 258 |
269 scoped_ptr<BufferManager> buffer_manager_; | 259 scoped_ptr<BufferManager> buffer_manager_; |
270 | 260 |
271 scoped_ptr<FramebufferManager> framebuffer_manager_; | 261 scoped_ptr<FramebufferManager> framebuffer_manager_; |
272 | 262 |
273 scoped_ptr<RenderbufferManager> renderbuffer_manager_; | 263 scoped_ptr<RenderbufferManager> renderbuffer_manager_; |
274 | 264 |
275 scoped_ptr<TextureManager> texture_manager_; | 265 scoped_ptr<TextureManager> texture_manager_; |
(...skipping 16 matching lines...) Expand all Loading... |
292 base::hash_map<GLuint, GLuint> transformfeedbacks_id_map_; | 282 base::hash_map<GLuint, GLuint> transformfeedbacks_id_map_; |
293 base::hash_map<GLuint, GLsync> syncs_id_map_; | 283 base::hash_map<GLuint, GLsync> syncs_id_map_; |
294 | 284 |
295 DISALLOW_COPY_AND_ASSIGN(ContextGroup); | 285 DISALLOW_COPY_AND_ASSIGN(ContextGroup); |
296 }; | 286 }; |
297 | 287 |
298 } // namespace gles2 | 288 } // namespace gles2 |
299 } // namespace gpu | 289 } // namespace gpu |
300 | 290 |
301 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ | 291 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ |
OLD | NEW |