Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: gpu/command_buffer/service/framebuffer_manager.h

Issue 12545014: Implement EXT_draw_buffers WebGL extention support in command buffer. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 22 matching lines...) Expand all
33 virtual bool cleared() const = 0; 33 virtual bool cleared() const = 0;
34 virtual void SetCleared( 34 virtual void SetCleared(
35 RenderbufferManager* renderbuffer_manager, 35 RenderbufferManager* renderbuffer_manager,
36 TextureManager* texture_manager, 36 TextureManager* texture_manager,
37 bool cleared) = 0; 37 bool cleared) = 0;
38 virtual bool IsTexture(Texture* texture) const = 0; 38 virtual bool IsTexture(Texture* texture) const = 0;
39 virtual bool IsRenderbuffer( 39 virtual bool IsRenderbuffer(
40 Renderbuffer* renderbuffer) const = 0; 40 Renderbuffer* renderbuffer) const = 0;
41 virtual bool CanRenderTo() const = 0; 41 virtual bool CanRenderTo() const = 0;
42 virtual void DetachFromFramebuffer() const = 0; 42 virtual void DetachFromFramebuffer() const = 0;
43 virtual bool ValidForAttachmentType(GLenum attachment_type) = 0; 43 virtual bool ValidForAttachmentType(
44 GLenum attachment_type, uint32 max_color_attachments) = 0;
44 virtual void AddToSignature( 45 virtual void AddToSignature(
45 TextureManager* texture_manager, std::string* signature) const = 0; 46 TextureManager* texture_manager, std::string* signature) const = 0;
46 47
47 protected: 48 protected:
48 friend class base::RefCounted<Attachment>; 49 friend class base::RefCounted<Attachment>;
49 virtual ~Attachment() {} 50 virtual ~Attachment() {}
50 }; 51 };
51 52
52 Framebuffer(FramebufferManager* manager, GLuint service_id); 53 Framebuffer(FramebufferManager* manager, GLuint service_id);
53 54
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // not mean the real OpenGL will consider it framebuffer complete. It just 108 // not mean the real OpenGL will consider it framebuffer complete. It just
108 // means it passed our tests. 109 // means it passed our tests.
109 GLenum IsPossiblyComplete() const; 110 GLenum IsPossiblyComplete() const;
110 111
111 // Implements optimized glGetFramebufferStatus. 112 // Implements optimized glGetFramebufferStatus.
112 GLenum GetStatus(TextureManager* texture_manager, GLenum target) const; 113 GLenum GetStatus(TextureManager* texture_manager, GLenum target) const;
113 114
114 // Check all attachments are cleared 115 // Check all attachments are cleared
115 bool IsCleared() const; 116 bool IsCleared() const;
116 117
118 GLenum GetDrawBuffer(GLenum draw_buffer) const;
119
120 void SetDrawBuffers(GLsizei n, const GLenum* bufs);
121
117 static void ClearFramebufferCompleteComboMap(); 122 static void ClearFramebufferCompleteComboMap();
118 123
119 private: 124 private:
120 friend class FramebufferManager; 125 friend class FramebufferManager;
121 friend class base::RefCounted<Framebuffer>; 126 friend class base::RefCounted<Framebuffer>;
122 127
123 ~Framebuffer(); 128 ~Framebuffer();
124 129
125 void MarkAsDeleted(); 130 void MarkAsDeleted();
126 131
(...skipping 26 matching lines...) Expand all
153 158
154 // A map of attachments. 159 // A map of attachments.
155 typedef base::hash_map<GLenum, scoped_refptr<Attachment> > AttachmentMap; 160 typedef base::hash_map<GLenum, scoped_refptr<Attachment> > AttachmentMap;
156 AttachmentMap attachments_; 161 AttachmentMap attachments_;
157 162
158 // A map of successful frame buffer combos. If it's in the map 163 // A map of successful frame buffer combos. If it's in the map
159 // it should be FRAMEBUFFER_COMPLETE. 164 // it should be FRAMEBUFFER_COMPLETE.
160 typedef base::hash_map<std::string, bool> FramebufferComboCompleteMap; 165 typedef base::hash_map<std::string, bool> FramebufferComboCompleteMap;
161 static FramebufferComboCompleteMap* framebuffer_combo_complete_map_; 166 static FramebufferComboCompleteMap* framebuffer_combo_complete_map_;
162 167
168 scoped_array<GLenum> draw_buffers_;
169
163 DISALLOW_COPY_AND_ASSIGN(Framebuffer); 170 DISALLOW_COPY_AND_ASSIGN(Framebuffer);
164 }; 171 };
165 172
166 // This class keeps track of the frambebuffers and their attached renderbuffers 173 // This class keeps track of the frambebuffers and their attached renderbuffers
167 // so we can correctly clear them. 174 // so we can correctly clear them.
168 class GPU_EXPORT FramebufferManager { 175 class GPU_EXPORT FramebufferManager {
169 public: 176 public:
170 FramebufferManager(); 177 FramebufferManager(uint32 max_draw_buffers, uint32 max_color_attachments);
171 ~FramebufferManager(); 178 ~FramebufferManager();
172 179
173 // Must call before destruction. 180 // Must call before destruction.
174 void Destroy(bool have_context); 181 void Destroy(bool have_context);
175 182
176 // Creates a Framebuffer for the given framebuffer. 183 // Creates a Framebuffer for the given framebuffer.
177 void CreateFramebuffer(GLuint client_id, GLuint service_id); 184 void CreateFramebuffer(GLuint client_id, GLuint service_id);
178 185
179 // Gets the framebuffer info for the given framebuffer. 186 // Gets the framebuffer info for the given framebuffer.
180 Framebuffer* GetFramebuffer(GLuint client_id); 187 Framebuffer* GetFramebuffer(GLuint client_id);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 // Incremented anytime anything changes that might effect framebuffer 221 // Incremented anytime anything changes that might effect framebuffer
215 // state. 222 // state.
216 unsigned framebuffer_state_change_count_; 223 unsigned framebuffer_state_change_count_;
217 224
218 // Counts the number of Framebuffer allocated with 'this' as its manager. 225 // Counts the number of Framebuffer allocated with 'this' as its manager.
219 // Allows to check no Framebuffer will outlive this. 226 // Allows to check no Framebuffer will outlive this.
220 unsigned int framebuffer_count_; 227 unsigned int framebuffer_count_;
221 228
222 bool have_context_; 229 bool have_context_;
223 230
231 uint32 max_draw_buffers_;
232 uint32 max_color_attachments_;
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_
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/feature_info.cc ('k') | gpu/command_buffer/service/framebuffer_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698