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;
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>;
}
bool HasUnclearedAttachment(GLenum attachment) const;
+ bool HasUnclearedColorAttachments() const;
void MarkAttachmentAsCleared(
RenderbufferManager* renderbuffer_manager,
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
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;
}
void OnTextureRefDetached(TextureRef* texture);
+ void OnWillRenderTo() const;
+ void OnDidRenderTo() const;
private:
friend class FramebufferManager;
return framebuffer_complete_state_count_id_;
}
+ // Helper function for PrepareDrawBuffersForClear() and
+ // RestoreDrawBuffersAfterClear().
+ void ChangeDrawBuffersHelper(bool recover) const;
+
// The managers that owns this.
FramebufferManager* manager_;