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 "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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 // not mean the real OpenGL will consider it framebuffer complete. It just | 107 // not mean the real OpenGL will consider it framebuffer complete. It just |
108 // means it passed our tests. | 108 // means it passed our tests. |
109 GLenum IsPossiblyComplete() const; | 109 GLenum IsPossiblyComplete() const; |
110 | 110 |
111 // Implements optimized glGetFramebufferStatus. | 111 // Implements optimized glGetFramebufferStatus. |
112 GLenum GetStatus(TextureManager* texture_manager, GLenum target) const; | 112 GLenum GetStatus(TextureManager* texture_manager, GLenum target) const; |
113 | 113 |
114 // Check all attachments are cleared | 114 // Check all attachments are cleared |
115 bool IsCleared() const; | 115 bool IsCleared() const; |
116 | 116 |
| 117 GLenum GetDrawBuffer(GLenum draw_buffer) const; |
| 118 |
| 119 void SetDrawBuffers(GLsizei n, const GLenum* bufs); |
| 120 |
117 static void ClearFramebufferCompleteComboMap(); | 121 static void ClearFramebufferCompleteComboMap(); |
118 | 122 |
119 private: | 123 private: |
120 friend class FramebufferManager; | 124 friend class FramebufferManager; |
121 friend class base::RefCounted<Framebuffer>; | 125 friend class base::RefCounted<Framebuffer>; |
122 | 126 |
123 ~Framebuffer(); | 127 ~Framebuffer(); |
124 | 128 |
125 void MarkAsDeleted(); | 129 void MarkAsDeleted(); |
126 | 130 |
(...skipping 26 matching lines...) Expand all Loading... |
153 | 157 |
154 // A map of attachments. | 158 // A map of attachments. |
155 typedef base::hash_map<GLenum, scoped_refptr<Attachment> > AttachmentMap; | 159 typedef base::hash_map<GLenum, scoped_refptr<Attachment> > AttachmentMap; |
156 AttachmentMap attachments_; | 160 AttachmentMap attachments_; |
157 | 161 |
158 // A map of successful frame buffer combos. If it's in the map | 162 // A map of successful frame buffer combos. If it's in the map |
159 // it should be FRAMEBUFFER_COMPLETE. | 163 // it should be FRAMEBUFFER_COMPLETE. |
160 typedef base::hash_map<std::string, bool> FramebufferComboCompleteMap; | 164 typedef base::hash_map<std::string, bool> FramebufferComboCompleteMap; |
161 static FramebufferComboCompleteMap* framebuffer_combo_complete_map_; | 165 static FramebufferComboCompleteMap* framebuffer_combo_complete_map_; |
162 | 166 |
| 167 scoped_array<GLenum> draw_buffers_; |
| 168 |
163 DISALLOW_COPY_AND_ASSIGN(Framebuffer); | 169 DISALLOW_COPY_AND_ASSIGN(Framebuffer); |
164 }; | 170 }; |
165 | 171 |
166 // This class keeps track of the frambebuffers and their attached renderbuffers | 172 // This class keeps track of the frambebuffers and their attached renderbuffers |
167 // so we can correctly clear them. | 173 // so we can correctly clear them. |
168 class GPU_EXPORT FramebufferManager { | 174 class GPU_EXPORT FramebufferManager { |
169 public: | 175 public: |
170 FramebufferManager(); | 176 explicit FramebufferManager(uint32 max_draw_buffers); |
171 ~FramebufferManager(); | 177 ~FramebufferManager(); |
172 | 178 |
173 // Must call before destruction. | 179 // Must call before destruction. |
174 void Destroy(bool have_context); | 180 void Destroy(bool have_context); |
175 | 181 |
176 // Creates a Framebuffer for the given framebuffer. | 182 // Creates a Framebuffer for the given framebuffer. |
177 void CreateFramebuffer(GLuint client_id, GLuint service_id); | 183 void CreateFramebuffer(GLuint client_id, GLuint service_id); |
178 | 184 |
179 // Gets the framebuffer info for the given framebuffer. | 185 // Gets the framebuffer info for the given framebuffer. |
180 Framebuffer* GetFramebuffer(GLuint client_id); | 186 Framebuffer* GetFramebuffer(GLuint client_id); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 // Incremented anytime anything changes that might effect framebuffer | 220 // Incremented anytime anything changes that might effect framebuffer |
215 // state. | 221 // state. |
216 unsigned framebuffer_state_change_count_; | 222 unsigned framebuffer_state_change_count_; |
217 | 223 |
218 // Counts the number of Framebuffer allocated with 'this' as its manager. | 224 // Counts the number of Framebuffer allocated with 'this' as its manager. |
219 // Allows to check no Framebuffer will outlive this. | 225 // Allows to check no Framebuffer will outlive this. |
220 unsigned int framebuffer_count_; | 226 unsigned int framebuffer_count_; |
221 | 227 |
222 bool have_context_; | 228 bool have_context_; |
223 | 229 |
| 230 uint32 max_draw_buffers_; |
| 231 |
224 DISALLOW_COPY_AND_ASSIGN(FramebufferManager); | 232 DISALLOW_COPY_AND_ASSIGN(FramebufferManager); |
225 }; | 233 }; |
226 | 234 |
227 } // namespace gles2 | 235 } // namespace gles2 |
228 } // namespace gpu | 236 } // namespace gpu |
229 | 237 |
230 #endif // GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_MANAGER_H_ | 238 #endif // GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_MANAGER_H_ |
OLD | NEW |