Chromium Code Reviews| 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 13359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13370 GetBoundReadFramebufferServiceId(), | 13370 GetBoundReadFramebufferServiceId(), |
| 13371 GetBoundReadFramebufferInternalFormat()); | 13371 GetBoundReadFramebufferInternalFormat()); |
| 13372 } else { | 13372 } else { |
| 13373 glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, | 13373 glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, |
| 13374 copyWidth, copyHeight); | 13374 copyWidth, copyHeight); |
| 13375 } | 13375 } |
| 13376 } | 13376 } |
| 13377 } else { | 13377 } else { |
| 13378 GLenum final_internal_format = TextureManager::AdjustTexInternalFormat( | 13378 GLenum final_internal_format = TextureManager::AdjustTexInternalFormat( |
| 13379 feature_info_.get(), internal_format); | 13379 feature_info_.get(), internal_format); |
| 13380 if (workarounds().init_two_cube_map_levels_before_copyteximage && | |
| 13381 texture->target() == GL_TEXTURE_CUBE_MAP && | |
| 13382 target != GL_TEXTURE_CUBE_MAP_POSITIVE_X) { | |
| 13383 for (int i = 0; i < 2; ++i) { | |
| 13384 TextureManager::DoTexImageArguments args = { | |
| 13385 target, i, final_internal_format, 1, 1, 1, border, | |
| 13386 format, type, nullptr, 1, 0, | |
| 13387 TextureManager::DoTexImageArguments::kTexImage2D }; | |
| 13388 texture_manager()->WorkaroundCopyTexImageCubeMap(&texture_state_, | |
|
Zhenyao Mo
2016/10/11 03:10:18
Here is my question:
WorkaroundCopyTexImageCubeM
qiankun
2016/10/11 03:18:19
In TextureManager::DoTexImage, format is translate
| |
| 13389 &state_, &framebuffer_state_, texture_ref, func_name, args); | |
| 13390 } | |
| 13391 } | |
| 13380 | 13392 |
| 13381 // The service id and target of the texture attached to READ_FRAMEBUFFER. | 13393 // The service id and target of the texture attached to READ_FRAMEBUFFER. |
| 13382 GLuint source_texture_service_id = 0; | 13394 GLuint source_texture_service_id = 0; |
| 13383 GLenum source_texture_target = 0; | 13395 GLenum source_texture_target = 0; |
| 13384 uint32_t channels_exist = GLES2Util::GetChannelsForFormat(read_format); | 13396 uint32_t channels_exist = GLES2Util::GetChannelsForFormat(read_format); |
| 13385 bool use_workaround = NeedsCopyTextureImageWorkaround( | 13397 bool use_workaround = NeedsCopyTextureImageWorkaround( |
| 13386 final_internal_format, channels_exist, &source_texture_service_id, | 13398 final_internal_format, channels_exist, &source_texture_service_id, |
| 13387 &source_texture_target); | 13399 &source_texture_target); |
| 13388 if (requires_luma_blit) { | 13400 if (requires_luma_blit) { |
| 13389 copy_tex_image_blit_->DoCopyTexImage2DToLUMACompatibilityTexture( | 13401 copy_tex_image_blit_->DoCopyTexImage2DToLUMACompatibilityTexture( |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13425 glCopyTexImage2D(dest_texture_target, level, final_internal_format, 0, 0, | 13437 glCopyTexImage2D(dest_texture_target, level, final_internal_format, 0, 0, |
| 13426 copyWidth, copyHeight, 0); | 13438 copyWidth, copyHeight, 0); |
| 13427 | 13439 |
| 13428 // Rebind source texture. | 13440 // Rebind source texture. |
| 13429 glFramebufferTexture2DEXT(framebuffer_target, GL_COLOR_ATTACHMENT0, | 13441 glFramebufferTexture2DEXT(framebuffer_target, GL_COLOR_ATTACHMENT0, |
| 13430 source_texture_target, | 13442 source_texture_target, |
| 13431 source_texture_service_id, 0); | 13443 source_texture_service_id, 0); |
| 13432 | 13444 |
| 13433 glDeleteTextures(1, &temp_texture); | 13445 glDeleteTextures(1, &temp_texture); |
| 13434 } else { | 13446 } else { |
| 13435 if (workarounds().do_teximage_before_copyteximage_to_cube_map && | 13447 if (workarounds().init_one_cube_map_level_before_copyteximage && |
| 13436 texture->target() == GL_TEXTURE_CUBE_MAP && | 13448 texture->target() == GL_TEXTURE_CUBE_MAP && |
| 13437 target != GL_TEXTURE_CUBE_MAP_POSITIVE_X) { | 13449 target != GL_TEXTURE_CUBE_MAP_POSITIVE_X) { |
| 13438 TextureManager::DoTexImageArguments args = { | 13450 TextureManager::DoTexImageArguments args = { |
| 13439 target, level, final_internal_format, width, height, 1, border, | 13451 target, level, final_internal_format, width, height, 1, border, |
| 13440 format, type, nullptr, pixels_size, 0, | 13452 format, type, nullptr, pixels_size, 0, |
| 13441 TextureManager::DoTexImageArguments::kTexImage2D }; | 13453 TextureManager::DoTexImageArguments::kTexImage2D }; |
| 13442 texture_manager()->WorkaroundCopyTexImageCubeMap(&texture_state_, | 13454 texture_manager()->WorkaroundCopyTexImageCubeMap(&texture_state_, |
| 13443 &state_, &framebuffer_state_, texture_ref, func_name, args); | 13455 &state_, &framebuffer_state_, texture_ref, func_name, args); |
| 13444 } | 13456 } |
| 13445 glCopyTexImage2D(target, level, final_internal_format, copyX, copyY, | 13457 glCopyTexImage2D(target, level, final_internal_format, copyX, copyY, |
| (...skipping 4799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 18245 } | 18257 } |
| 18246 | 18258 |
| 18247 // Include the auto-generated part of this file. We split this because it means | 18259 // Include the auto-generated part of this file. We split this because it means |
| 18248 // we can easily edit the non-auto generated parts right here in this file | 18260 // we can easily edit the non-auto generated parts right here in this file |
| 18249 // instead of having to edit some template or the code generator. | 18261 // instead of having to edit some template or the code generator. |
| 18250 #include "base/macros.h" | 18262 #include "base/macros.h" |
| 18251 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 18263 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 18252 | 18264 |
| 18253 } // namespace gles2 | 18265 } // namespace gles2 |
| 18254 } // namespace gpu | 18266 } // namespace gpu |
| OLD | NEW |