| 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" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "gpu/command_buffer/service/gl_utils.h" | 12 #include "gpu/command_buffer/service/gl_utils.h" |
| 13 #include "gpu/gpu_export.h" | 13 #include "gpu/gpu_export.h" |
| 14 | 14 |
| 15 namespace gpu { | 15 namespace gpu { |
| 16 namespace gles2 { | 16 namespace gles2 { |
| 17 | 17 |
| 18 class FramebufferManager; | 18 class FramebufferManager; |
| 19 class Renderbuffer; | 19 class Renderbuffer; |
| 20 class RenderbufferManager; | 20 class RenderbufferManager; |
| 21 class Texture; | 21 class Texture; |
| 22 class TextureRef; |
| 22 class TextureManager; | 23 class TextureManager; |
| 23 | 24 |
| 24 // Info about a particular Framebuffer. | 25 // Info about a particular Framebuffer. |
| 25 class GPU_EXPORT Framebuffer : public base::RefCounted<Framebuffer> { | 26 class GPU_EXPORT Framebuffer : public base::RefCounted<Framebuffer> { |
| 26 public: | 27 public: |
| 27 class Attachment : public base::RefCounted<Attachment> { | 28 class Attachment : public base::RefCounted<Attachment> { |
| 28 public: | 29 public: |
| 29 virtual GLsizei width() const = 0; | 30 virtual GLsizei width() const = 0; |
| 30 virtual GLsizei height() const = 0; | 31 virtual GLsizei height() const = 0; |
| 31 virtual GLenum internal_format() const = 0; | 32 virtual GLenum internal_format() const = 0; |
| 32 virtual GLsizei samples() const = 0; | 33 virtual GLsizei samples() const = 0; |
| 33 virtual bool cleared() const = 0; | 34 virtual bool cleared() const = 0; |
| 34 virtual void SetCleared( | 35 virtual void SetCleared( |
| 35 RenderbufferManager* renderbuffer_manager, | 36 RenderbufferManager* renderbuffer_manager, |
| 36 TextureManager* texture_manager, | 37 TextureManager* texture_manager, |
| 37 bool cleared) = 0; | 38 bool cleared) = 0; |
| 38 virtual bool IsTexture(Texture* texture) const = 0; | 39 virtual bool IsTexture(TextureRef* texture) const = 0; |
| 39 virtual bool IsRenderbuffer( | 40 virtual bool IsRenderbuffer( |
| 40 Renderbuffer* renderbuffer) const = 0; | 41 Renderbuffer* renderbuffer) const = 0; |
| 41 virtual bool CanRenderTo() const = 0; | 42 virtual bool CanRenderTo() const = 0; |
| 42 virtual void DetachFromFramebuffer() const = 0; | 43 virtual void DetachFromFramebuffer() const = 0; |
| 43 virtual bool ValidForAttachmentType( | 44 virtual bool ValidForAttachmentType( |
| 44 GLenum attachment_type, uint32 max_color_attachments) = 0; | 45 GLenum attachment_type, uint32 max_color_attachments) = 0; |
| 45 virtual void AddToSignature( | 46 virtual void AddToSignature( |
| 46 TextureManager* texture_manager, std::string* signature) const = 0; | 47 TextureManager* texture_manager, std::string* signature) const = 0; |
| 47 | 48 |
| 48 protected: | 49 protected: |
| (...skipping 15 matching lines...) Expand all Loading... |
| 64 GLenum attachment, | 65 GLenum attachment, |
| 65 bool cleared); | 66 bool cleared); |
| 66 | 67 |
| 67 // Attaches a renderbuffer to a particlar attachment. | 68 // Attaches a renderbuffer to a particlar attachment. |
| 68 // Pass null to detach. | 69 // Pass null to detach. |
| 69 void AttachRenderbuffer( | 70 void AttachRenderbuffer( |
| 70 GLenum attachment, Renderbuffer* renderbuffer); | 71 GLenum attachment, Renderbuffer* renderbuffer); |
| 71 | 72 |
| 72 // Attaches a texture to a particlar attachment. Pass null to detach. | 73 // Attaches a texture to a particlar attachment. Pass null to detach. |
| 73 void AttachTexture( | 74 void AttachTexture( |
| 74 GLenum attachment, Texture* texture, GLenum target, | 75 GLenum attachment, TextureRef* texture_ref, GLenum target, |
| 75 GLint level); | 76 GLint level); |
| 76 | 77 |
| 77 // Unbinds the given renderbuffer if it is bound. | 78 // Unbinds the given renderbuffer if it is bound. |
| 78 void UnbindRenderbuffer( | 79 void UnbindRenderbuffer( |
| 79 GLenum target, Renderbuffer* renderbuffer); | 80 GLenum target, Renderbuffer* renderbuffer); |
| 80 | 81 |
| 81 // Unbinds the given texture if it is bound. | 82 // Unbinds the given texture if it is bound. |
| 82 void UnbindTexture( | 83 void UnbindTexture( |
| 83 GLenum target, Texture* texture); | 84 GLenum target, TextureRef* texture_ref); |
| 84 | 85 |
| 85 const Attachment* GetAttachment(GLenum attachment) const; | 86 const Attachment* GetAttachment(GLenum attachment) const; |
| 86 | 87 |
| 87 bool IsDeleted() const { | 88 bool IsDeleted() const { |
| 88 return deleted_; | 89 return deleted_; |
| 89 } | 90 } |
| 90 | 91 |
| 91 void MarkAsValid() { | 92 void MarkAsValid() { |
| 92 has_been_bound_ = true; | 93 has_been_bound_ = true; |
| 93 } | 94 } |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 uint32 max_draw_buffers_; | 237 uint32 max_draw_buffers_; |
| 237 uint32 max_color_attachments_; | 238 uint32 max_color_attachments_; |
| 238 | 239 |
| 239 DISALLOW_COPY_AND_ASSIGN(FramebufferManager); | 240 DISALLOW_COPY_AND_ASSIGN(FramebufferManager); |
| 240 }; | 241 }; |
| 241 | 242 |
| 242 } // namespace gles2 | 243 } // namespace gles2 |
| 243 } // namespace gpu | 244 } // namespace gpu |
| 244 | 245 |
| 245 #endif // GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_MANAGER_H_ | 246 #endif // GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_MANAGER_H_ |
| OLD | NEW |