Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / gpu / command_buffer / service / framebuffer_manager.h
index 23fd1ba..78c11ad 100644 (file)
@@ -32,6 +32,7 @@ class GPU_EXPORT Framebuffer : public base::RefCounted<Framebuffer> {
     virtual GLsizei width() const = 0;
     virtual GLsizei height() const = 0;
     virtual GLenum internal_format() const = 0;
+    virtual GLenum texture_type() const = 0;
     virtual GLsizei samples() const = 0;
     virtual GLuint object_name() const = 0;
     virtual bool cleared() const = 0;
@@ -46,8 +47,12 @@ class GPU_EXPORT Framebuffer : public base::RefCounted<Framebuffer> {
     virtual void DetachFromFramebuffer(Framebuffer* framebuffer) const = 0;
     virtual bool ValidForAttachmentType(
         GLenum attachment_type, uint32 max_color_attachments) = 0;
+    virtual size_t GetSignatureSize(TextureManager* texture_manager) const = 0;
     virtual void AddToSignature(
         TextureManager* texture_manager, std::string* signature) const = 0;
+    virtual void OnWillRenderTo() const = 0;
+    virtual void OnDidRenderTo() const = 0;
+    virtual bool FormsFeedbackLoop(TextureRef* texture, GLint level) const = 0;
 
    protected:
     friend class base::RefCounted<Attachment>;
@@ -61,6 +66,7 @@ class GPU_EXPORT Framebuffer : public base::RefCounted<Framebuffer> {
   }
 
   bool HasUnclearedAttachment(GLenum attachment) const;
+  bool HasUnclearedColorAttachments() const;
 
   void MarkAttachmentAsCleared(
     RenderbufferManager* renderbuffer_manager,
@@ -103,6 +109,9 @@ class GPU_EXPORT Framebuffer : public base::RefCounted<Framebuffer> {
   bool HasDepthAttachment() const;
   bool HasStencilAttachment() const;
   GLenum GetColorAttachmentFormat() const;
+  // If the color attachment is a texture, returns its type; otherwise,
+  // returns 0.
+  GLenum GetColorAttachmentTextureType() const;
 
   // Verify all the rules in OpenGL ES 2.0.25 4.4.5 are followed.
   // Returns GL_FRAMEBUFFER_COMPLETE if there are no reasons we know we can't
@@ -123,6 +132,14 @@ class GPU_EXPORT Framebuffer : public base::RefCounted<Framebuffer> {
 
   void SetDrawBuffers(GLsizei n, const GLenum* bufs);
 
+  // If a color buffer is attached to GL_COLOR_ATTACHMENTi, enable that
+  // draw buffer for glClear().
+  void PrepareDrawBuffersForClear() const;
+
+  // Restore draw buffers states that have been changed in
+  // PrepareDrawBuffersForClear().
+  void RestoreDrawBuffersAfterClear() const;
+
   // Return true if any draw buffers has an alpha channel.
   bool HasAlphaMRT() const;
 
@@ -133,6 +150,8 @@ class GPU_EXPORT Framebuffer : public base::RefCounted<Framebuffer> {
   }
 
   void OnTextureRefDetached(TextureRef* texture);
+  void OnWillRenderTo() const;
+  void OnDidRenderTo() const;
 
  private:
   friend class FramebufferManager;
@@ -155,6 +174,10 @@ class GPU_EXPORT Framebuffer : public base::RefCounted<Framebuffer> {
     return framebuffer_complete_state_count_id_;
   }
 
+  // Helper function for PrepareDrawBuffersForClear() and
+  // RestoreDrawBuffersAfterClear().
+  void ChangeDrawBuffersHelper(bool recover) const;
+
   // The managers that owns this.
   FramebufferManager* manager_;