| 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 <limits.h> | 7 #include <limits.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 13640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13651 GetBoundReadFramebufferServiceId(), | 13651 GetBoundReadFramebufferServiceId(), |
| 13652 GetBoundReadFramebufferInternalFormat()); | 13652 GetBoundReadFramebufferInternalFormat()); |
| 13653 } else { | 13653 } else { |
| 13654 glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, | 13654 glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, |
| 13655 copyWidth, copyHeight); | 13655 copyWidth, copyHeight); |
| 13656 } | 13656 } |
| 13657 } | 13657 } |
| 13658 } else { | 13658 } else { |
| 13659 GLenum final_internal_format = TextureManager::AdjustTexInternalFormat( | 13659 GLenum final_internal_format = TextureManager::AdjustTexInternalFormat( |
| 13660 feature_info_.get(), internal_format); | 13660 feature_info_.get(), internal_format); |
| 13661 if (workarounds().init_two_cube_map_levels_before_copyteximage && |
| 13662 texture->target() == GL_TEXTURE_CUBE_MAP && |
| 13663 target != GL_TEXTURE_CUBE_MAP_POSITIVE_X) { |
| 13664 for (int i = 0; i < 2; ++i) { |
| 13665 TextureManager::DoTexImageArguments args = { |
| 13666 target, i, final_internal_format, 1, 1, 1, border, |
| 13667 format, type, nullptr, 1, 0, |
| 13668 TextureManager::DoTexImageArguments::kTexImage2D }; |
| 13669 texture_manager()->WorkaroundCopyTexImageCubeMap(&texture_state_, |
| 13670 &state_, &framebuffer_state_, texture_ref, func_name, args); |
| 13671 } |
| 13672 } |
| 13661 | 13673 |
| 13662 // The service id and target of the texture attached to READ_FRAMEBUFFER. | 13674 // The service id and target of the texture attached to READ_FRAMEBUFFER. |
| 13663 GLuint source_texture_service_id = 0; | 13675 GLuint source_texture_service_id = 0; |
| 13664 GLenum source_texture_target = 0; | 13676 GLenum source_texture_target = 0; |
| 13665 uint32_t channels_exist = GLES2Util::GetChannelsForFormat(read_format); | 13677 uint32_t channels_exist = GLES2Util::GetChannelsForFormat(read_format); |
| 13666 bool use_workaround = NeedsCopyTextureImageWorkaround( | 13678 bool use_workaround = NeedsCopyTextureImageWorkaround( |
| 13667 final_internal_format, channels_exist, &source_texture_service_id, | 13679 final_internal_format, channels_exist, &source_texture_service_id, |
| 13668 &source_texture_target); | 13680 &source_texture_target); |
| 13669 if (requires_luma_blit) { | 13681 if (requires_luma_blit) { |
| 13670 copy_tex_image_blit_->DoCopyTexImage2DToLUMACompatibilityTexture( | 13682 copy_tex_image_blit_->DoCopyTexImage2DToLUMACompatibilityTexture( |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13706 glCopyTexImage2D(dest_texture_target, level, final_internal_format, 0, 0, | 13718 glCopyTexImage2D(dest_texture_target, level, final_internal_format, 0, 0, |
| 13707 copyWidth, copyHeight, 0); | 13719 copyWidth, copyHeight, 0); |
| 13708 | 13720 |
| 13709 // Rebind source texture. | 13721 // Rebind source texture. |
| 13710 glFramebufferTexture2DEXT(framebuffer_target, GL_COLOR_ATTACHMENT0, | 13722 glFramebufferTexture2DEXT(framebuffer_target, GL_COLOR_ATTACHMENT0, |
| 13711 source_texture_target, | 13723 source_texture_target, |
| 13712 source_texture_service_id, 0); | 13724 source_texture_service_id, 0); |
| 13713 | 13725 |
| 13714 glDeleteTextures(1, &temp_texture); | 13726 glDeleteTextures(1, &temp_texture); |
| 13715 } else { | 13727 } else { |
| 13716 if (workarounds().do_teximage_before_copyteximage_to_cube_map && | 13728 if (workarounds().init_one_cube_map_level_before_copyteximage && |
| 13717 texture->target() == GL_TEXTURE_CUBE_MAP && | 13729 texture->target() == GL_TEXTURE_CUBE_MAP && |
| 13718 target != GL_TEXTURE_CUBE_MAP_POSITIVE_X) { | 13730 target != GL_TEXTURE_CUBE_MAP_POSITIVE_X) { |
| 13719 TextureManager::DoTexImageArguments args = { | 13731 TextureManager::DoTexImageArguments args = { |
| 13720 target, level, final_internal_format, width, height, 1, border, | 13732 target, level, final_internal_format, width, height, 1, border, |
| 13721 format, type, nullptr, pixels_size, 0, | 13733 format, type, nullptr, pixels_size, 0, |
| 13722 TextureManager::DoTexImageArguments::kTexImage2D }; | 13734 TextureManager::DoTexImageArguments::kTexImage2D }; |
| 13723 texture_manager()->WorkaroundCopyTexImageCubeMap(&texture_state_, | 13735 texture_manager()->WorkaroundCopyTexImageCubeMap(&texture_state_, |
| 13724 &state_, &framebuffer_state_, texture_ref, func_name, args); | 13736 &state_, &framebuffer_state_, texture_ref, func_name, args); |
| 13725 } | 13737 } |
| 13726 glCopyTexImage2D(target, level, final_internal_format, copyX, copyY, | 13738 glCopyTexImage2D(target, level, final_internal_format, copyX, copyY, |
| (...skipping 4805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18532 } | 18544 } |
| 18533 | 18545 |
| 18534 // Include the auto-generated part of this file. We split this because it means | 18546 // Include the auto-generated part of this file. We split this because it means |
| 18535 // we can easily edit the non-auto generated parts right here in this file | 18547 // we can easily edit the non-auto generated parts right here in this file |
| 18536 // instead of having to edit some template or the code generator. | 18548 // instead of having to edit some template or the code generator. |
| 18537 #include "base/macros.h" | 18549 #include "base/macros.h" |
| 18538 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 18550 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 18539 | 18551 |
| 18540 } // namespace gles2 | 18552 } // namespace gles2 |
| 18541 } // namespace gpu | 18553 } // namespace gpu |
| OLD | NEW |