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

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

Issue 1231273002: Fix framebuffer completeness ES3 behavior. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add unittest Created 5 years, 5 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
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 <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/containers/hash_tables.h" 11 #include "base/containers/hash_tables.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "gpu/command_buffer/service/context_group.h"
14 #include "gpu/command_buffer/service/gl_utils.h" 15 #include "gpu/command_buffer/service/gl_utils.h"
15 #include "gpu/gpu_export.h" 16 #include "gpu/gpu_export.h"
16 17
17 namespace gpu { 18 namespace gpu {
18 namespace gles2 { 19 namespace gles2 {
19 20
20 class FramebufferManager; 21 class FramebufferManager;
21 class Renderbuffer; 22 class Renderbuffer;
22 class RenderbufferManager; 23 class RenderbufferManager;
23 class Texture; 24 class Texture;
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 public: 234 public:
234 TextureDetachObserver(); 235 TextureDetachObserver();
235 virtual ~TextureDetachObserver(); 236 virtual ~TextureDetachObserver();
236 237
237 virtual void OnTextureRefDetachedFromFramebuffer(TextureRef* texture) = 0; 238 virtual void OnTextureRefDetachedFromFramebuffer(TextureRef* texture) = 0;
238 239
239 private: 240 private:
240 DISALLOW_COPY_AND_ASSIGN(TextureDetachObserver); 241 DISALLOW_COPY_AND_ASSIGN(TextureDetachObserver);
241 }; 242 };
242 243
243 FramebufferManager(uint32 max_draw_buffers, uint32 max_color_attachments); 244 FramebufferManager(uint32 max_draw_buffers, uint32 max_color_attachments,
245 ContextGroup::ContextType context_type);
244 ~FramebufferManager(); 246 ~FramebufferManager();
245 247
246 // Must call before destruction. 248 // Must call before destruction.
247 void Destroy(bool have_context); 249 void Destroy(bool have_context);
248 250
249 // Creates a Framebuffer for the given framebuffer. 251 // Creates a Framebuffer for the given framebuffer.
250 void CreateFramebuffer(GLuint client_id, GLuint service_id); 252 void CreateFramebuffer(GLuint client_id, GLuint service_id);
251 253
252 // Gets the framebuffer info for the given framebuffer. 254 // Gets the framebuffer info for the given framebuffer.
253 Framebuffer* GetFramebuffer(GLuint client_id); 255 Framebuffer* GetFramebuffer(GLuint client_id);
(...skipping 24 matching lines...) Expand all
278 } 280 }
279 281
280 void RemoveObserver(TextureDetachObserver* observer) { 282 void RemoveObserver(TextureDetachObserver* observer) {
281 texture_detach_observers_.erase( 283 texture_detach_observers_.erase(
282 std::remove(texture_detach_observers_.begin(), 284 std::remove(texture_detach_observers_.begin(),
283 texture_detach_observers_.end(), 285 texture_detach_observers_.end(),
284 observer), 286 observer),
285 texture_detach_observers_.end()); 287 texture_detach_observers_.end());
286 } 288 }
287 289
290 ContextGroup::ContextType context_type() const {
291 return context_type_;
292 }
293
288 private: 294 private:
289 friend class Framebuffer; 295 friend class Framebuffer;
290 296
291 void StartTracking(Framebuffer* framebuffer); 297 void StartTracking(Framebuffer* framebuffer);
292 void StopTracking(Framebuffer* framebuffer); 298 void StopTracking(Framebuffer* framebuffer);
293 299
294 void OnTextureRefDetached(TextureRef* texture); 300 void OnTextureRefDetached(TextureRef* texture);
295 301
296 // Info for each framebuffer in the system. 302 // Info for each framebuffer in the system.
297 typedef base::hash_map<GLuint, scoped_refptr<Framebuffer> > 303 typedef base::hash_map<GLuint, scoped_refptr<Framebuffer> >
298 FramebufferMap; 304 FramebufferMap;
299 FramebufferMap framebuffers_; 305 FramebufferMap framebuffers_;
300 306
301 // Incremented anytime anything changes that might effect framebuffer 307 // Incremented anytime anything changes that might effect framebuffer
302 // state. 308 // state.
303 unsigned framebuffer_state_change_count_; 309 unsigned framebuffer_state_change_count_;
304 310
305 // Counts the number of Framebuffer allocated with 'this' as its manager. 311 // Counts the number of Framebuffer allocated with 'this' as its manager.
306 // Allows to check no Framebuffer will outlive this. 312 // Allows to check no Framebuffer will outlive this.
307 unsigned int framebuffer_count_; 313 unsigned int framebuffer_count_;
308 314
309 bool have_context_; 315 bool have_context_;
310 316
311 uint32 max_draw_buffers_; 317 uint32 max_draw_buffers_;
312 uint32 max_color_attachments_; 318 uint32 max_color_attachments_;
313 319
320 ContextGroup::ContextType context_type_;
321
314 typedef std::vector<TextureDetachObserver*> TextureDetachObserverVector; 322 typedef std::vector<TextureDetachObserver*> TextureDetachObserverVector;
315 TextureDetachObserverVector texture_detach_observers_; 323 TextureDetachObserverVector texture_detach_observers_;
316 324
317 DISALLOW_COPY_AND_ASSIGN(FramebufferManager); 325 DISALLOW_COPY_AND_ASSIGN(FramebufferManager);
318 }; 326 };
319 327
320 } // namespace gles2 328 } // namespace gles2
321 } // namespace gpu 329 } // namespace gpu
322 330
323 #endif // GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_MANAGER_H_ 331 #endif // GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_MANAGER_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/context_group.cc ('k') | gpu/command_buffer/service/framebuffer_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698