Chromium Code Reviews| 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 // Hardwired to 16. Might be expanded in the future. | |
| 168 // This is not the max drawbuffers supported by the hardware, but the number | |
| 169 // of defined GL_DRAW_BUFFER*_ARB enum. | |
| 170 static const GLsizei kMaxDrawBuffers = 16; | |
|
greggman
2013/03/08 21:48:28
We don't do this for textures, why do it for draw
Zhenyao Mo
2013/03/13 01:22:02
Done.
| |
| 171 GLenum draw_buffers_[kMaxDrawBuffers]; | |
| 172 | |
| 163 DISALLOW_COPY_AND_ASSIGN(Framebuffer); | 173 DISALLOW_COPY_AND_ASSIGN(Framebuffer); |
| 164 }; | 174 }; |
| 165 | 175 |
| 166 // This class keeps track of the frambebuffers and their attached renderbuffers | 176 // This class keeps track of the frambebuffers and their attached renderbuffers |
| 167 // so we can correctly clear them. | 177 // so we can correctly clear them. |
| 168 class GPU_EXPORT FramebufferManager { | 178 class GPU_EXPORT FramebufferManager { |
| 169 public: | 179 public: |
| 170 FramebufferManager(); | 180 FramebufferManager(); |
| 171 ~FramebufferManager(); | 181 ~FramebufferManager(); |
| 172 | 182 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 | 231 |
| 222 bool have_context_; | 232 bool have_context_; |
| 223 | 233 |
| 224 DISALLOW_COPY_AND_ASSIGN(FramebufferManager); | 234 DISALLOW_COPY_AND_ASSIGN(FramebufferManager); |
| 225 }; | 235 }; |
| 226 | 236 |
| 227 } // namespace gles2 | 237 } // namespace gles2 |
| 228 } // namespace gpu | 238 } // namespace gpu |
| 229 | 239 |
| 230 #endif // GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_MANAGER_H_ | 240 #endif // GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_MANAGER_H_ |
| OLD | NEW |