| 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 <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/gl_utils.h" | 14 #include "gpu/command_buffer/service/gl_utils.h" |
| 15 #include "gpu/gpu_export.h" | 15 #include "gpu/gpu_export.h" |
| 16 | 16 |
| 17 namespace gpu { | 17 namespace gpu { |
| 18 namespace gles2 { | 18 namespace gles2 { |
| 19 | 19 |
| 20 class FeatureInfo; |
| 20 class FramebufferManager; | 21 class FramebufferManager; |
| 21 class Renderbuffer; | 22 class Renderbuffer; |
| 22 class RenderbufferManager; | 23 class RenderbufferManager; |
| 23 class Texture; | 24 class Texture; |
| 24 class TextureRef; | 25 class TextureRef; |
| 25 class TextureManager; | 26 class TextureManager; |
| 26 | 27 |
| 27 // Info about a particular Framebuffer. | 28 // Info about a particular Framebuffer. |
| 28 class GPU_EXPORT Framebuffer : public base::RefCounted<Framebuffer> { | 29 class GPU_EXPORT Framebuffer : public base::RefCounted<Framebuffer> { |
| 29 public: | 30 public: |
| 30 class Attachment : public base::RefCounted<Attachment> { | 31 class Attachment : public base::RefCounted<Attachment> { |
| 31 public: | 32 public: |
| 32 virtual GLsizei width() const = 0; | 33 virtual GLsizei width() const = 0; |
| 33 virtual GLsizei height() const = 0; | 34 virtual GLsizei height() const = 0; |
| 34 virtual GLenum internal_format() const = 0; | 35 virtual GLenum internal_format() const = 0; |
| 35 virtual GLenum texture_type() const = 0; | 36 virtual GLenum texture_type() const = 0; |
| 36 virtual GLsizei samples() const = 0; | 37 virtual GLsizei samples() const = 0; |
| 37 virtual GLuint object_name() const = 0; | 38 virtual GLuint object_name() const = 0; |
| 38 virtual bool cleared() const = 0; | 39 virtual bool cleared() const = 0; |
| 39 virtual void SetCleared( | 40 virtual void SetCleared( |
| 40 RenderbufferManager* renderbuffer_manager, | 41 RenderbufferManager* renderbuffer_manager, |
| 41 TextureManager* texture_manager, | 42 TextureManager* texture_manager, |
| 42 bool cleared) = 0; | 43 bool cleared) = 0; |
| 43 virtual bool IsTexture(TextureRef* texture) const = 0; | 44 virtual bool IsTexture(TextureRef* texture) const = 0; |
| 44 virtual bool IsRenderbuffer( | 45 virtual bool IsRenderbuffer( |
| 45 Renderbuffer* renderbuffer) const = 0; | 46 Renderbuffer* renderbuffer) const = 0; |
| 46 virtual bool CanRenderTo() const = 0; | 47 virtual bool CanRenderTo() const = 0; |
| 47 virtual void DetachFromFramebuffer(Framebuffer* framebuffer) const = 0; | 48 virtual void DetachFromFramebuffer(Framebuffer* framebuffer) const = 0; |
| 48 virtual bool ValidForAttachmentType( | 49 virtual bool ValidForAttachmentType( |
| 49 GLenum attachment_type, uint32 max_color_attachments) = 0; | 50 GLenum attachment_type, uint32 max_color_attachments, |
| 51 const FeatureInfo* feature_info) = 0; |
| 50 virtual void AddToSignature( | 52 virtual void AddToSignature( |
| 51 TextureManager* texture_manager, std::string* signature) const = 0; | 53 TextureManager* texture_manager, std::string* signature) const = 0; |
| 52 | 54 |
| 53 protected: | 55 protected: |
| 54 friend class base::RefCounted<Attachment>; | 56 friend class base::RefCounted<Attachment>; |
| 55 virtual ~Attachment() {} | 57 virtual ~Attachment() {} |
| 56 }; | 58 }; |
| 57 | 59 |
| 58 Framebuffer(FramebufferManager* manager, GLuint service_id); | 60 Framebuffer(FramebufferManager* manager, GLuint service_id); |
| 59 | 61 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // returns 0. | 110 // returns 0. |
| 109 GLenum GetColorAttachmentTextureType() const; | 111 GLenum GetColorAttachmentTextureType() const; |
| 110 | 112 |
| 111 // Verify all the rules in OpenGL ES 2.0.25 4.4.5 are followed. | 113 // Verify all the rules in OpenGL ES 2.0.25 4.4.5 are followed. |
| 112 // Returns GL_FRAMEBUFFER_COMPLETE if there are no reasons we know we can't | 114 // Returns GL_FRAMEBUFFER_COMPLETE if there are no reasons we know we can't |
| 113 // use this combination of attachments. Otherwise returns the value | 115 // use this combination of attachments. Otherwise returns the value |
| 114 // that glCheckFramebufferStatus should return for this set of attachments. | 116 // that glCheckFramebufferStatus should return for this set of attachments. |
| 115 // Note that receiving GL_FRAMEBUFFER_COMPLETE from this function does | 117 // Note that receiving GL_FRAMEBUFFER_COMPLETE from this function does |
| 116 // not mean the real OpenGL will consider it framebuffer complete. It just | 118 // not mean the real OpenGL will consider it framebuffer complete. It just |
| 117 // means it passed our tests. | 119 // means it passed our tests. |
| 118 GLenum IsPossiblyComplete() const; | 120 GLenum IsPossiblyComplete(const FeatureInfo* feature_info) const; |
| 119 | 121 |
| 120 // Implements optimized glGetFramebufferStatus. | 122 // Implements optimized glGetFramebufferStatus. |
| 121 GLenum GetStatus(TextureManager* texture_manager, GLenum target) const; | 123 GLenum GetStatus(TextureManager* texture_manager, GLenum target) const; |
| 122 | 124 |
| 123 // Check all attachments are cleared | 125 // Check all attachments are cleared |
| 124 bool IsCleared() const; | 126 bool IsCleared() const; |
| 125 | 127 |
| 126 GLenum GetDrawBuffer(GLenum draw_buffer) const; | 128 GLenum GetDrawBuffer(GLenum draw_buffer) const; |
| 127 | 129 |
| 128 void SetDrawBuffers(GLsizei n, const GLenum* bufs); | 130 void SetDrawBuffers(GLsizei n, const GLenum* bufs); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 typedef std::vector<TextureDetachObserver*> TextureDetachObserverVector; | 292 typedef std::vector<TextureDetachObserver*> TextureDetachObserverVector; |
| 291 TextureDetachObserverVector texture_detach_observers_; | 293 TextureDetachObserverVector texture_detach_observers_; |
| 292 | 294 |
| 293 DISALLOW_COPY_AND_ASSIGN(FramebufferManager); | 295 DISALLOW_COPY_AND_ASSIGN(FramebufferManager); |
| 294 }; | 296 }; |
| 295 | 297 |
| 296 } // namespace gles2 | 298 } // namespace gles2 |
| 297 } // namespace gpu | 299 } // namespace gpu |
| 298 | 300 |
| 299 #endif // GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_MANAGER_H_ | 301 #endif // GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_MANAGER_H_ |
| OLD | NEW |