OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/hash_tables.h" | 9 #include "base/hash_tables.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 virtual ~Attachment() { } | 32 virtual ~Attachment() { } |
33 virtual GLsizei width() const = 0; | 33 virtual GLsizei width() const = 0; |
34 virtual GLsizei height() const = 0; | 34 virtual GLsizei height() const = 0; |
35 virtual GLenum internal_format() const = 0; | 35 virtual GLenum internal_format() const = 0; |
36 virtual GLsizei samples() const = 0; | 36 virtual GLsizei samples() const = 0; |
37 virtual bool cleared() const = 0; | 37 virtual bool cleared() const = 0; |
38 virtual void SetCleared( | 38 virtual void SetCleared( |
39 RenderbufferManager* renderbuffer_manager, | 39 RenderbufferManager* renderbuffer_manager, |
40 TextureManager* texture_manager) = 0; | 40 TextureManager* texture_manager) = 0; |
41 virtual bool IsTexture(TextureManager::TextureInfo* texture) const = 0; | 41 virtual bool IsTexture(TextureManager::TextureInfo* texture) const = 0; |
| 42 virtual bool IsRenderbuffer( |
| 43 RenderbufferManager::RenderbufferInfo* renderbuffer) const = 0; |
42 virtual bool CanRenderTo() const = 0; | 44 virtual bool CanRenderTo() const = 0; |
43 virtual void DetachFromFramebuffer() = 0; | 45 virtual void DetachFromFramebuffer() = 0; |
44 virtual bool ValidForAttachmentType(GLenum attachment_type) = 0; | 46 virtual bool ValidForAttachmentType(GLenum attachment_type) = 0; |
45 }; | 47 }; |
46 | 48 |
47 explicit FramebufferInfo(GLuint service_id); | 49 explicit FramebufferInfo(GLuint service_id); |
48 | 50 |
49 GLuint service_id() const { | 51 GLuint service_id() const { |
50 return service_id_; | 52 return service_id_; |
51 } | 53 } |
52 | 54 |
53 bool HasUnclearedAttachment(GLenum attachment) const; | 55 bool HasUnclearedAttachment(GLenum attachment) const; |
54 | 56 |
55 // Attaches a renderbuffer to a particlar attachment. | 57 // Attaches a renderbuffer to a particlar attachment. |
56 // Pass null to detach. | 58 // Pass null to detach. |
57 void AttachRenderbuffer( | 59 void AttachRenderbuffer( |
58 GLenum attachment, RenderbufferManager::RenderbufferInfo* renderbuffer); | 60 GLenum attachment, RenderbufferManager::RenderbufferInfo* renderbuffer); |
59 | 61 |
60 // Attaches a texture to a particlar attachment. Pass null to detach. | 62 // Attaches a texture to a particlar attachment. Pass null to detach. |
61 void AttachTexture( | 63 void AttachTexture( |
62 GLenum attachment, TextureManager::TextureInfo* texture, GLenum target, | 64 GLenum attachment, TextureManager::TextureInfo* texture, GLenum target, |
63 GLint level); | 65 GLint level); |
64 | 66 |
| 67 // Unbinds the given renderbuffer if it is bound. |
| 68 void UnbindRenderbuffer( |
| 69 GLenum target, RenderbufferManager::RenderbufferInfo* renderbuffer); |
| 70 |
| 71 // Unbinds the given texture if it is bound. |
| 72 void UnbindTexture( |
| 73 GLenum target, TextureManager::TextureInfo* texture); |
| 74 |
65 void MarkAttachmentsAsCleared( | 75 void MarkAttachmentsAsCleared( |
66 RenderbufferManager* renderbuffer_manager, | 76 RenderbufferManager* renderbuffer_manager, |
67 TextureManager* texture_manager); | 77 TextureManager* texture_manager); |
68 | 78 |
69 const Attachment* GetAttachment(GLenum attachment) const; | 79 const Attachment* GetAttachment(GLenum attachment) const; |
70 | 80 |
71 bool IsDeleted() const { | 81 bool IsDeleted() const { |
72 return service_id_ == 0; | 82 return service_id_ == 0; |
73 } | 83 } |
74 | 84 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 typedef base::hash_map<GLuint, FramebufferInfo::Ref> FramebufferInfoMap; | 150 typedef base::hash_map<GLuint, FramebufferInfo::Ref> FramebufferInfoMap; |
141 FramebufferInfoMap framebuffer_infos_; | 151 FramebufferInfoMap framebuffer_infos_; |
142 | 152 |
143 DISALLOW_COPY_AND_ASSIGN(FramebufferManager); | 153 DISALLOW_COPY_AND_ASSIGN(FramebufferManager); |
144 }; | 154 }; |
145 | 155 |
146 } // namespace gles2 | 156 } // namespace gles2 |
147 } // namespace gpu | 157 } // namespace gpu |
148 | 158 |
149 #endif // GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_MANAGER_H_ | 159 #endif // GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_MANAGER_H_ |
OLD | NEW |