Index: gpu/command_buffer/service/framebuffer_manager.h |
diff --git a/gpu/command_buffer/service/framebuffer_manager.h b/gpu/command_buffer/service/framebuffer_manager.h |
index db78ffeb6328476a9a415c05d66aa65864307ae9..7216654e86c26accb91309133e49077a279598ff 100644 |
--- a/gpu/command_buffer/service/framebuffer_manager.h |
+++ b/gpu/command_buffer/service/framebuffer_manager.h |
@@ -52,6 +52,8 @@ |
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: |
@@ -158,6 +160,13 @@ |
// formats. |
bool HasSameInternalFormatsMRT() const; |
+ void OnTextureRefDetached(TextureRef* texture); |
+ |
+ // If attachment is 0, apply to all attachments; otherwise, apply only to |
+ // the specified attachment. |
+ void OnWillRenderTo(GLenum attachment) const; |
+ void OnDidRenderTo(GLenum attachment) const; |
+ |
void set_read_buffer(GLenum read_buffer) { |
read_buffer_ = read_buffer; |
} |
@@ -233,6 +242,17 @@ |
// so we can correctly clear them. |
class GPU_EXPORT FramebufferManager { |
public: |
+ class GPU_EXPORT TextureDetachObserver { |
+ public: |
+ TextureDetachObserver(); |
+ virtual ~TextureDetachObserver(); |
+ |
+ virtual void OnTextureRefDetachedFromFramebuffer(TextureRef* texture) = 0; |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(TextureDetachObserver); |
+ }; |
+ |
FramebufferManager(uint32 max_draw_buffers, |
uint32 max_color_attachments, |
ContextType context_type, |
@@ -270,6 +290,18 @@ |
(framebuffer_state_change_count_ + 1) | 0x80000000U; |
} |
+ void AddObserver(TextureDetachObserver* observer) { |
+ texture_detach_observers_.push_back(observer); |
+ } |
+ |
+ void RemoveObserver(TextureDetachObserver* observer) { |
+ texture_detach_observers_.erase( |
+ std::remove(texture_detach_observers_.begin(), |
+ texture_detach_observers_.end(), |
+ observer), |
+ texture_detach_observers_.end()); |
+ } |
+ |
ContextType context_type() const { return context_type_; } |
private: |
@@ -277,6 +309,8 @@ |
void StartTracking(Framebuffer* framebuffer); |
void StopTracking(Framebuffer* framebuffer); |
+ |
+ void OnTextureRefDetached(TextureRef* texture); |
FramebufferCompletenessCache* GetFramebufferComboCompleteCache() { |
return framebuffer_combo_complete_cache_.get(); |
@@ -302,6 +336,9 @@ |
ContextType context_type_; |
+ typedef std::vector<TextureDetachObserver*> TextureDetachObserverVector; |
+ TextureDetachObserverVector texture_detach_observers_; |
+ |
scoped_refptr<FramebufferCompletenessCache> framebuffer_combo_complete_cache_; |
DISALLOW_COPY_AND_ASSIGN(FramebufferManager); |