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_FRAMEBUFFER_MANAGER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_MANAGER_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_MANAGER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_MANAGER_H_ |
7 | 7 |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
8 #include <vector> | 11 #include <vector> |
9 | 12 |
10 #include "base/basictypes.h" | |
11 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
| 14 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
14 #include "gpu/command_buffer/service/context_group.h" | 17 #include "gpu/command_buffer/service/context_group.h" |
15 #include "gpu/command_buffer/service/gl_utils.h" | 18 #include "gpu/command_buffer/service/gl_utils.h" |
16 #include "gpu/gpu_export.h" | 19 #include "gpu/gpu_export.h" |
17 | 20 |
18 namespace gpu { | 21 namespace gpu { |
19 namespace gles2 { | 22 namespace gles2 { |
20 | 23 |
21 class FramebufferCompletenessCache; | 24 class FramebufferCompletenessCache; |
(...skipping 18 matching lines...) Expand all Loading... |
40 virtual bool cleared() const = 0; | 43 virtual bool cleared() const = 0; |
41 virtual void SetCleared( | 44 virtual void SetCleared( |
42 RenderbufferManager* renderbuffer_manager, | 45 RenderbufferManager* renderbuffer_manager, |
43 TextureManager* texture_manager, | 46 TextureManager* texture_manager, |
44 bool cleared) = 0; | 47 bool cleared) = 0; |
45 virtual bool IsTexture(TextureRef* texture) const = 0; | 48 virtual bool IsTexture(TextureRef* texture) const = 0; |
46 virtual bool IsRenderbuffer( | 49 virtual bool IsRenderbuffer( |
47 Renderbuffer* renderbuffer) const = 0; | 50 Renderbuffer* renderbuffer) const = 0; |
48 virtual bool CanRenderTo() const = 0; | 51 virtual bool CanRenderTo() const = 0; |
49 virtual void DetachFromFramebuffer(Framebuffer* framebuffer) const = 0; | 52 virtual void DetachFromFramebuffer(Framebuffer* framebuffer) const = 0; |
50 virtual bool ValidForAttachmentType( | 53 virtual bool ValidForAttachmentType(GLenum attachment_type, |
51 GLenum attachment_type, uint32 max_color_attachments) = 0; | 54 uint32_t max_color_attachments) = 0; |
52 virtual size_t GetSignatureSize(TextureManager* texture_manager) const = 0; | 55 virtual size_t GetSignatureSize(TextureManager* texture_manager) const = 0; |
53 virtual void AddToSignature( | 56 virtual void AddToSignature( |
54 TextureManager* texture_manager, std::string* signature) const = 0; | 57 TextureManager* texture_manager, std::string* signature) const = 0; |
55 virtual bool FormsFeedbackLoop(TextureRef* texture, GLint level) const = 0; | 58 virtual bool FormsFeedbackLoop(TextureRef* texture, GLint level) const = 0; |
56 | 59 |
57 protected: | 60 protected: |
58 friend class base::RefCounted<Attachment>; | 61 friend class base::RefCounted<Attachment>; |
59 virtual ~Attachment() {} | 62 virtual ~Attachment() {} |
60 }; | 63 }; |
61 | 64 |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 | 232 |
230 // The currently bound framebuffers | 233 // The currently bound framebuffers |
231 scoped_refptr<Framebuffer> bound_read_framebuffer; | 234 scoped_refptr<Framebuffer> bound_read_framebuffer; |
232 scoped_refptr<Framebuffer> bound_draw_framebuffer; | 235 scoped_refptr<Framebuffer> bound_draw_framebuffer; |
233 }; | 236 }; |
234 | 237 |
235 // This class keeps track of the frambebuffers and their attached renderbuffers | 238 // This class keeps track of the frambebuffers and their attached renderbuffers |
236 // so we can correctly clear them. | 239 // so we can correctly clear them. |
237 class GPU_EXPORT FramebufferManager { | 240 class GPU_EXPORT FramebufferManager { |
238 public: | 241 public: |
239 FramebufferManager(uint32 max_draw_buffers, | 242 FramebufferManager(uint32_t max_draw_buffers, |
240 uint32 max_color_attachments, | 243 uint32_t max_color_attachments, |
241 ContextType context_type, | 244 ContextType context_type, |
242 const scoped_refptr<FramebufferCompletenessCache>& | 245 const scoped_refptr<FramebufferCompletenessCache>& |
243 framebuffer_combo_complete_cache); | 246 framebuffer_combo_complete_cache); |
244 ~FramebufferManager(); | 247 ~FramebufferManager(); |
245 | 248 |
246 // Must call before destruction. | 249 // Must call before destruction. |
247 void Destroy(bool have_context); | 250 void Destroy(bool have_context); |
248 | 251 |
249 // Creates a Framebuffer for the given framebuffer. | 252 // Creates a Framebuffer for the given framebuffer. |
250 void CreateFramebuffer(GLuint client_id, GLuint service_id); | 253 void CreateFramebuffer(GLuint client_id, GLuint service_id); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 // Incremented anytime anything changes that might effect framebuffer | 296 // Incremented anytime anything changes that might effect framebuffer |
294 // state. | 297 // state. |
295 unsigned framebuffer_state_change_count_; | 298 unsigned framebuffer_state_change_count_; |
296 | 299 |
297 // Counts the number of Framebuffer allocated with 'this' as its manager. | 300 // Counts the number of Framebuffer allocated with 'this' as its manager. |
298 // Allows to check no Framebuffer will outlive this. | 301 // Allows to check no Framebuffer will outlive this. |
299 unsigned int framebuffer_count_; | 302 unsigned int framebuffer_count_; |
300 | 303 |
301 bool have_context_; | 304 bool have_context_; |
302 | 305 |
303 uint32 max_draw_buffers_; | 306 uint32_t max_draw_buffers_; |
304 uint32 max_color_attachments_; | 307 uint32_t max_color_attachments_; |
305 | 308 |
306 ContextType context_type_; | 309 ContextType context_type_; |
307 | 310 |
308 scoped_refptr<FramebufferCompletenessCache> framebuffer_combo_complete_cache_; | 311 scoped_refptr<FramebufferCompletenessCache> framebuffer_combo_complete_cache_; |
309 | 312 |
310 DISALLOW_COPY_AND_ASSIGN(FramebufferManager); | 313 DISALLOW_COPY_AND_ASSIGN(FramebufferManager); |
311 }; | 314 }; |
312 | 315 |
313 } // namespace gles2 | 316 } // namespace gles2 |
314 } // namespace gpu | 317 } // namespace gpu |
315 | 318 |
316 #endif // GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_MANAGER_H_ | 319 #endif // GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_MANAGER_H_ |
OLD | NEW |