| 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 #include "gpu/command_buffer/service/framebuffer_manager.h" | 5 #include "gpu/command_buffer/service/framebuffer_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 std::string* signature) const override { | 122 std::string* signature) const override { |
| 123 DCHECK(signature); | 123 DCHECK(signature); |
| 124 renderbuffer_->AddToSignature(signature); | 124 renderbuffer_->AddToSignature(signature); |
| 125 } | 125 } |
| 126 | 126 |
| 127 bool FormsFeedbackLoop(TextureRef* /* texture */, | 127 bool FormsFeedbackLoop(TextureRef* /* texture */, |
| 128 GLint /*level */) const override { | 128 GLint /*level */) const override { |
| 129 return false; | 129 return false; |
| 130 } | 130 } |
| 131 | 131 |
| 132 bool EmulatingRGB() const override { return false; } |
| 133 |
| 132 protected: | 134 protected: |
| 133 ~RenderbufferAttachment() override {} | 135 ~RenderbufferAttachment() override {} |
| 134 | 136 |
| 135 private: | 137 private: |
| 136 scoped_refptr<Renderbuffer> renderbuffer_; | 138 scoped_refptr<Renderbuffer> renderbuffer_; |
| 137 | 139 |
| 138 DISALLOW_COPY_AND_ASSIGN(RenderbufferAttachment); | 140 DISALLOW_COPY_AND_ASSIGN(RenderbufferAttachment); |
| 139 }; | 141 }; |
| 140 | 142 |
| 141 class TextureAttachment | 143 class TextureAttachment |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 std::string* signature) const override { | 272 std::string* signature) const override { |
| 271 DCHECK(signature); | 273 DCHECK(signature); |
| 272 texture_manager->AddToSignature( | 274 texture_manager->AddToSignature( |
| 273 texture_ref_.get(), target_, level_, signature); | 275 texture_ref_.get(), target_, level_, signature); |
| 274 } | 276 } |
| 275 | 277 |
| 276 bool FormsFeedbackLoop(TextureRef* texture, GLint level) const override { | 278 bool FormsFeedbackLoop(TextureRef* texture, GLint level) const override { |
| 277 return texture == texture_ref_.get() && level == level_; | 279 return texture == texture_ref_.get() && level == level_; |
| 278 } | 280 } |
| 279 | 281 |
| 282 bool EmulatingRGB() const override { |
| 283 return texture_ref_->texture()->EmulatingRGB(); |
| 284 } |
| 285 |
| 280 protected: | 286 protected: |
| 281 ~TextureAttachment() override {} | 287 ~TextureAttachment() override {} |
| 282 | 288 |
| 283 private: | 289 private: |
| 284 scoped_refptr<TextureRef> texture_ref_; | 290 scoped_refptr<TextureRef> texture_ref_; |
| 285 GLenum target_; | 291 GLenum target_; |
| 286 GLint level_; | 292 GLint level_; |
| 287 GLsizei samples_; | 293 GLsizei samples_; |
| 288 GLint layer_; | 294 GLint layer_; |
| 289 | 295 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 } | 536 } |
| 531 | 537 |
| 532 GLenum Framebuffer::GetReadBufferInternalFormat() const { | 538 GLenum Framebuffer::GetReadBufferInternalFormat() const { |
| 533 if (read_buffer_ == GL_NONE) | 539 if (read_buffer_ == GL_NONE) |
| 534 return 0; | 540 return 0; |
| 535 AttachmentMap::const_iterator it = attachments_.find(read_buffer_); | 541 AttachmentMap::const_iterator it = attachments_.find(read_buffer_); |
| 536 if (it == attachments_.end()) { | 542 if (it == attachments_.end()) { |
| 537 return 0; | 543 return 0; |
| 538 } | 544 } |
| 539 const Attachment* attachment = it->second.get(); | 545 const Attachment* attachment = it->second.get(); |
| 546 if (attachment->EmulatingRGB()) { |
| 547 DCHECK_EQ(static_cast<GLenum>(GL_RGBA), attachment->internal_format()); |
| 548 return GL_RGB; |
| 549 } |
| 540 return attachment->internal_format(); | 550 return attachment->internal_format(); |
| 541 } | 551 } |
| 542 | 552 |
| 543 GLenum Framebuffer::GetReadBufferTextureType() const { | 553 GLenum Framebuffer::GetReadBufferTextureType() const { |
| 544 if (read_buffer_ == GL_NONE) | 554 if (read_buffer_ == GL_NONE) |
| 545 return 0; | 555 return 0; |
| 546 AttachmentMap::const_iterator it = attachments_.find(read_buffer_); | 556 AttachmentMap::const_iterator it = attachments_.find(read_buffer_); |
| 547 if (it == attachments_.end()) { | 557 if (it == attachments_.end()) { |
| 548 return 0; | 558 return 0; |
| 549 } | 559 } |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 | 851 |
| 842 bool FramebufferManager::IsComplete( | 852 bool FramebufferManager::IsComplete( |
| 843 Framebuffer* framebuffer) { | 853 Framebuffer* framebuffer) { |
| 844 DCHECK(framebuffer); | 854 DCHECK(framebuffer); |
| 845 return framebuffer->framebuffer_complete_state_count_id() == | 855 return framebuffer->framebuffer_complete_state_count_id() == |
| 846 framebuffer_state_change_count_; | 856 framebuffer_state_change_count_; |
| 847 } | 857 } |
| 848 | 858 |
| 849 } // namespace gles2 | 859 } // namespace gles2 |
| 850 } // namespace gpu | 860 } // namespace gpu |
| OLD | NEW |