Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(386)

Side by Side Diff: gpu/command_buffer/service/framebuffer_manager.cc

Issue 1418603002: Revert of Re-land: ui: Move GLImage::BindTexImage fallback from GLImage implementations to GLES2CmdDecoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "gpu/command_buffer/service/framebuffer_manager.h" 5 #include "gpu/command_buffer/service/framebuffer_manager.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 8 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
9 #include "gpu/command_buffer/service/framebuffer_completeness_cache.h" 9 #include "gpu/command_buffer/service/framebuffer_completeness_cache.h"
10 #include "gpu/command_buffer/service/renderbuffer_manager.h" 10 #include "gpu/command_buffer/service/renderbuffer_manager.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 size_t GetSignatureSize(TextureManager* texture_manager) const override { 80 size_t GetSignatureSize(TextureManager* texture_manager) const override {
81 return renderbuffer_->GetSignatureSize(); 81 return renderbuffer_->GetSignatureSize();
82 } 82 }
83 83
84 void AddToSignature(TextureManager* texture_manager, 84 void AddToSignature(TextureManager* texture_manager,
85 std::string* signature) const override { 85 std::string* signature) const override {
86 DCHECK(signature); 86 DCHECK(signature);
87 renderbuffer_->AddToSignature(signature); 87 renderbuffer_->AddToSignature(signature);
88 } 88 }
89 89
90 void OnWillRenderTo() const override {}
91 void OnDidRenderTo() const override {}
90 bool FormsFeedbackLoop(TextureRef* /* texture */, 92 bool FormsFeedbackLoop(TextureRef* /* texture */,
91 GLint /*level */) const override { 93 GLint /*level */) const override {
92 return false; 94 return false;
93 } 95 }
94 96
95 protected: 97 protected:
96 ~RenderbufferAttachment() override {} 98 ~RenderbufferAttachment() override {}
97 99
98 private: 100 private:
99 scoped_refptr<Renderbuffer> renderbuffer_; 101 scoped_refptr<Renderbuffer> renderbuffer_;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 TextureRef* texture() const { 172 TextureRef* texture() const {
171 return texture_ref_.get(); 173 return texture_ref_.get();
172 } 174 }
173 175
174 bool CanRenderTo() const override { 176 bool CanRenderTo() const override {
175 return texture_ref_->texture()->CanRenderTo(); 177 return texture_ref_->texture()->CanRenderTo();
176 } 178 }
177 179
178 void DetachFromFramebuffer(Framebuffer* framebuffer) const override { 180 void DetachFromFramebuffer(Framebuffer* framebuffer) const override {
179 texture_ref_->texture()->DetachFromFramebuffer(); 181 texture_ref_->texture()->DetachFromFramebuffer();
182 framebuffer->OnTextureRefDetached(texture_ref_.get());
180 } 183 }
181 184
182 bool ValidForAttachmentType(GLenum attachment_type, 185 bool ValidForAttachmentType(GLenum attachment_type,
183 uint32 max_color_attachments) override { 186 uint32 max_color_attachments) override {
184 GLenum type = 0; 187 GLenum type = 0;
185 GLenum internal_format = 0; 188 GLenum internal_format = 0;
186 if (!texture_ref_->texture()->GetLevelType( 189 if (!texture_ref_->texture()->GetLevelType(
187 target_, level_, &type, &internal_format)) { 190 target_, level_, &type, &internal_format)) {
188 return false; 191 return false;
189 } 192 }
(...skipping 14 matching lines...) Expand all
204 return texture_manager->GetSignatureSize(); 207 return texture_manager->GetSignatureSize();
205 } 208 }
206 209
207 void AddToSignature(TextureManager* texture_manager, 210 void AddToSignature(TextureManager* texture_manager,
208 std::string* signature) const override { 211 std::string* signature) const override {
209 DCHECK(signature); 212 DCHECK(signature);
210 texture_manager->AddToSignature( 213 texture_manager->AddToSignature(
211 texture_ref_.get(), target_, level_, signature); 214 texture_ref_.get(), target_, level_, signature);
212 } 215 }
213 216
217 void OnWillRenderTo() const override {
218 texture_ref_->texture()->OnWillModifyPixels();
219 }
220
221 void OnDidRenderTo() const override {
222 texture_ref_->texture()->OnDidModifyPixels();
223 }
224
214 bool FormsFeedbackLoop(TextureRef* texture, GLint level) const override { 225 bool FormsFeedbackLoop(TextureRef* texture, GLint level) const override {
215 return texture == texture_ref_.get() && level == level_; 226 return texture == texture_ref_.get() && level == level_;
216 } 227 }
217 228
218 protected: 229 protected:
219 ~TextureAttachment() override {} 230 ~TextureAttachment() override {}
220 231
221 private: 232 private:
222 scoped_refptr<TextureRef> texture_ref_; 233 scoped_refptr<TextureRef> texture_ref_;
223 GLenum target_; 234 GLenum target_;
224 GLint level_; 235 GLint level_;
225 GLsizei samples_; 236 GLsizei samples_;
226 237
227 DISALLOW_COPY_AND_ASSIGN(TextureAttachment); 238 DISALLOW_COPY_AND_ASSIGN(TextureAttachment);
228 }; 239 };
229 240
241 FramebufferManager::TextureDetachObserver::TextureDetachObserver() {}
242
243 FramebufferManager::TextureDetachObserver::~TextureDetachObserver() {}
244
230 FramebufferManager::FramebufferManager( 245 FramebufferManager::FramebufferManager(
231 uint32 max_draw_buffers, 246 uint32 max_draw_buffers,
232 uint32 max_color_attachments, 247 uint32 max_color_attachments,
233 ContextType context_type, 248 ContextType context_type,
234 const scoped_refptr<FramebufferCompletenessCache>& 249 const scoped_refptr<FramebufferCompletenessCache>&
235 framebuffer_combo_complete_cache) 250 framebuffer_combo_complete_cache)
236 : framebuffer_state_change_count_(1), 251 : framebuffer_state_change_count_(1),
237 framebuffer_count_(0), 252 framebuffer_count_(0),
238 have_context_(true), 253 have_context_(true),
239 max_draw_buffers_(max_draw_buffers), 254 max_draw_buffers_(max_draw_buffers),
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 } 706 }
692 return NULL; 707 return NULL;
693 } 708 }
694 709
695 const Framebuffer::Attachment* Framebuffer::GetReadBufferAttachment() const { 710 const Framebuffer::Attachment* Framebuffer::GetReadBufferAttachment() const {
696 if (read_buffer_ == GL_NONE) 711 if (read_buffer_ == GL_NONE)
697 return nullptr; 712 return nullptr;
698 return GetAttachment(read_buffer_); 713 return GetAttachment(read_buffer_);
699 } 714 }
700 715
716 void Framebuffer::OnTextureRefDetached(TextureRef* texture) {
717 manager_->OnTextureRefDetached(texture);
718 }
719
720 void Framebuffer::OnWillRenderTo(GLenum attachment) const {
721 for (AttachmentMap::const_iterator it = attachments_.begin();
722 it != attachments_.end(); ++it) {
723 if (attachment == 0 || attachment == it->first) {
724 it->second->OnWillRenderTo();
725 }
726 }
727 }
728
729 void Framebuffer::OnDidRenderTo(GLenum attachment) const {
730 for (AttachmentMap::const_iterator it = attachments_.begin();
731 it != attachments_.end(); ++it) {
732 if (attachment == 0 || attachment == it->first) {
733 it->second->OnDidRenderTo();
734 }
735 }
736 }
737
701 bool FramebufferManager::GetClientId( 738 bool FramebufferManager::GetClientId(
702 GLuint service_id, GLuint* client_id) const { 739 GLuint service_id, GLuint* client_id) const {
703 // This doesn't need to be fast. It's only used during slow queries. 740 // This doesn't need to be fast. It's only used during slow queries.
704 for (FramebufferMap::const_iterator it = framebuffers_.begin(); 741 for (FramebufferMap::const_iterator it = framebuffers_.begin();
705 it != framebuffers_.end(); ++it) { 742 it != framebuffers_.end(); ++it) {
706 if (it->second->service_id() == service_id) { 743 if (it->second->service_id() == service_id) {
707 *client_id = it->first; 744 *client_id = it->first;
708 return true; 745 return true;
709 } 746 }
710 } 747 }
(...skipping 17 matching lines...) Expand all
728 framebuffer->MarkAsComplete(framebuffer_state_change_count_); 765 framebuffer->MarkAsComplete(framebuffer_state_change_count_);
729 } 766 }
730 767
731 bool FramebufferManager::IsComplete( 768 bool FramebufferManager::IsComplete(
732 Framebuffer* framebuffer) { 769 Framebuffer* framebuffer) {
733 DCHECK(framebuffer); 770 DCHECK(framebuffer);
734 return framebuffer->framebuffer_complete_state_count_id() == 771 return framebuffer->framebuffer_complete_state_count_id() ==
735 framebuffer_state_change_count_; 772 framebuffer_state_change_count_;
736 } 773 }
737 774
775 void FramebufferManager::OnTextureRefDetached(TextureRef* texture) {
776 for (TextureDetachObserverVector::iterator it =
777 texture_detach_observers_.begin();
778 it != texture_detach_observers_.end();
779 ++it) {
780 TextureDetachObserver* observer = *it;
781 observer->OnTextureRefDetachedFromFramebuffer(texture);
782 }
783 }
784
738 } // namespace gles2 785 } // namespace gles2
739 } // namespace gpu 786 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/framebuffer_manager.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698