| 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/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <list> | 10 #include <list> |
| (...skipping 5764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5775 if (textarget != GL_TEXTURE_2D) | 5775 if (textarget != GL_TEXTURE_2D) |
| 5776 return; | 5776 return; |
| 5777 // Image is still in use if texture is attached to a framebuffer. | 5777 // Image is still in use if texture is attached to a framebuffer. |
| 5778 if (texture && !texture->IsAttachedToFramebuffer()) { | 5778 if (texture && !texture->IsAttachedToFramebuffer()) { |
| 5779 gfx::GLImage* image = texture->GetLevelImage(textarget, 0); | 5779 gfx::GLImage* image = texture->GetLevelImage(textarget, 0); |
| 5780 if (image) { | 5780 if (image) { |
| 5781 ScopedGLErrorSuppressor suppressor( | 5781 ScopedGLErrorSuppressor suppressor( |
| 5782 "GLES2DecoderImpl::DoDidUseTexImageIfNeeded", | 5782 "GLES2DecoderImpl::DoDidUseTexImageIfNeeded", |
| 5783 GetErrorState()); | 5783 GetErrorState()); |
| 5784 glBindTexture(textarget, texture->service_id()); | 5784 glBindTexture(textarget, texture->service_id()); |
| 5785 image->DidUseTexImage(); | 5785 image->DidUseTexImage( |
| 5786 workarounds().unbind_image_target_texture_before_lock); |
| 5786 RestoreCurrentTexture2DBindings(&state_); | 5787 RestoreCurrentTexture2DBindings(&state_); |
| 5787 } | 5788 } |
| 5788 } | 5789 } |
| 5789 } | 5790 } |
| 5790 | 5791 |
| 5791 bool GLES2DecoderImpl::PrepareTexturesForRender() { | 5792 bool GLES2DecoderImpl::PrepareTexturesForRender() { |
| 5792 DCHECK(state_.current_program.get()); | 5793 DCHECK(state_.current_program.get()); |
| 5793 if (!texture_manager()->HaveUnrenderableTextures() && | 5794 if (!texture_manager()->HaveUnrenderableTextures() && |
| 5794 !texture_manager()->HaveImages() && | 5795 !texture_manager()->HaveImages() && |
| 5795 !features().oes_egl_image_external) { | 5796 !features().oes_egl_image_external) { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5872 } | 5873 } |
| 5873 | 5874 |
| 5874 Texture* texture = texture_ref->texture(); | 5875 Texture* texture = texture_ref->texture(); |
| 5875 if (texture_unit.bind_target == GL_TEXTURE_2D) { | 5876 if (texture_unit.bind_target == GL_TEXTURE_2D) { |
| 5876 gfx::GLImage* image = texture->GetLevelImage( | 5877 gfx::GLImage* image = texture->GetLevelImage( |
| 5877 texture_unit.bind_target, 0); | 5878 texture_unit.bind_target, 0); |
| 5878 if (image && !texture->IsAttachedToFramebuffer()) { | 5879 if (image && !texture->IsAttachedToFramebuffer()) { |
| 5879 ScopedGLErrorSuppressor suppressor( | 5880 ScopedGLErrorSuppressor suppressor( |
| 5880 "GLES2DecoderImpl::RestoreStateForTextures", GetErrorState()); | 5881 "GLES2DecoderImpl::RestoreStateForTextures", GetErrorState()); |
| 5881 glActiveTexture(GL_TEXTURE0 + texture_unit_index); | 5882 glActiveTexture(GL_TEXTURE0 + texture_unit_index); |
| 5882 image->DidUseTexImage(); | 5883 image->DidUseTexImage( |
| 5884 workarounds().unbind_image_target_texture_before_lock); |
| 5883 continue; | 5885 continue; |
| 5884 } | 5886 } |
| 5885 } | 5887 } |
| 5886 } | 5888 } |
| 5887 } | 5889 } |
| 5888 } | 5890 } |
| 5889 // Set the active texture back to whatever the user had it as. | 5891 // Set the active texture back to whatever the user had it as. |
| 5890 glActiveTexture(GL_TEXTURE0 + state_.active_texture_unit); | 5892 glActiveTexture(GL_TEXTURE0 + state_.active_texture_unit); |
| 5891 } | 5893 } |
| 5892 | 5894 |
| (...skipping 4506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10399 DoDidUseTexImageIfNeeded(texture, texture->target()); | 10401 DoDidUseTexImageIfNeeded(texture, texture->target()); |
| 10400 } | 10402 } |
| 10401 | 10403 |
| 10402 // Include the auto-generated part of this file. We split this because it means | 10404 // Include the auto-generated part of this file. We split this because it means |
| 10403 // we can easily edit the non-auto generated parts right here in this file | 10405 // we can easily edit the non-auto generated parts right here in this file |
| 10404 // instead of having to edit some template or the code generator. | 10406 // instead of having to edit some template or the code generator. |
| 10405 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10407 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 10406 | 10408 |
| 10407 } // namespace gles2 | 10409 } // namespace gles2 |
| 10408 } // namespace gpu | 10410 } // namespace gpu |
| OLD | NEW |