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 13296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13307 GetBoundReadFramebufferServiceId(), | 13307 GetBoundReadFramebufferServiceId(), |
| 13308 GetBoundReadFramebufferInternalFormat()); | 13308 GetBoundReadFramebufferInternalFormat()); |
| 13309 } else { | 13309 } else { |
| 13310 glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, | 13310 glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, |
| 13311 copyWidth, copyHeight); | 13311 copyWidth, copyHeight); |
| 13312 } | 13312 } |
| 13313 } | 13313 } |
| 13314 } else { | 13314 } else { |
| 13315 GLenum final_internal_format = TextureManager::AdjustTexInternalFormat( | 13315 GLenum final_internal_format = TextureManager::AdjustTexInternalFormat( |
| 13316 feature_info_.get(), internal_format); | 13316 feature_info_.get(), internal_format); |
| 13317 if (workarounds().init_two_cube_map_levels_before_copyteximage && | |
| 13318 texture->target() == GL_TEXTURE_CUBE_MAP && | |
| 13319 target != GL_TEXTURE_CUBE_MAP_POSITIVE_X) { | |
| 13320 for (int i = 0; i < 2; ++i) { | |
| 13321 TextureManager::DoTexImageArguments args = { | |
| 13322 target, i, final_internal_format, 1, 1, 1, border, | |
| 13323 format, type, nullptr, 1, 0, | |
| 13324 TextureManager::DoTexImageArguments::kTexImage2D }; | |
| 13325 texture_manager()->WorkaroundCopyTexImageCubeMap(&texture_state_, | |
| 13326 &state_, &framebuffer_state_, texture_ref, func_name, args); | |
| 13327 } | |
| 13328 } | |
| 13317 | 13329 |
| 13318 // The service id and target of the texture attached to READ_FRAMEBUFFER. | 13330 // The service id and target of the texture attached to READ_FRAMEBUFFER. |
| 13319 GLuint source_texture_service_id = 0; | 13331 GLuint source_texture_service_id = 0; |
| 13320 GLenum source_texture_target = 0; | 13332 GLenum source_texture_target = 0; |
| 13321 uint32_t channels_exist = GLES2Util::GetChannelsForFormat(read_format); | 13333 uint32_t channels_exist = GLES2Util::GetChannelsForFormat(read_format); |
| 13322 bool use_workaround = NeedsCopyTextureImageWorkaround( | 13334 bool use_workaround = NeedsCopyTextureImageWorkaround( |
| 13323 final_internal_format, channels_exist, &source_texture_service_id, | 13335 final_internal_format, channels_exist, &source_texture_service_id, |
| 13324 &source_texture_target); | 13336 &source_texture_target); |
| 13325 if (requires_luma_blit) { | 13337 if (requires_luma_blit) { |
| 13326 copy_tex_image_blit_->DoCopyTexImage2DToLUMACompatibilityTexture( | 13338 copy_tex_image_blit_->DoCopyTexImage2DToLUMACompatibilityTexture( |
|
Zhenyao Mo
2016/09/30 16:24:20
Here is the luminance/alpha format emulation. Of
qiankun
2016/09/30 17:44:42
Won't line 13315 do LUMINANCE/ALPHA mapping?
Zhenyao Mo
2016/09/30 18:02:11
That's not enough. The format will still cause an
qiankun
2016/10/01 01:25:06
Mac OSX should be use core profile now. But I didn
| |
| 13327 this, texture->service_id(), texture->target(), target, format, | 13339 this, texture->service_id(), texture->target(), target, format, |
| 13328 type, level, internal_format, copyX, copyY, copyWidth, copyHeight, | 13340 type, level, internal_format, copyX, copyY, copyWidth, copyHeight, |
| 13329 GetBoundReadFramebufferServiceId(), | 13341 GetBoundReadFramebufferServiceId(), |
| 13330 GetBoundReadFramebufferInternalFormat()); | 13342 GetBoundReadFramebufferInternalFormat()); |
| 13331 } else if (use_workaround) { | 13343 } else if (use_workaround) { |
| 13332 GLenum dest_texture_target = target; | 13344 GLenum dest_texture_target = target; |
| 13333 GLenum framebuffer_target = features().chromium_framebuffer_multisample | 13345 GLenum framebuffer_target = features().chromium_framebuffer_multisample |
| 13334 ? GL_READ_FRAMEBUFFER_EXT | 13346 ? GL_READ_FRAMEBUFFER_EXT |
| 13335 : GL_FRAMEBUFFER; | 13347 : GL_FRAMEBUFFER; |
| 13336 | 13348 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 13362 glCopyTexImage2D(dest_texture_target, level, final_internal_format, 0, 0, | 13374 glCopyTexImage2D(dest_texture_target, level, final_internal_format, 0, 0, |
| 13363 copyWidth, copyHeight, 0); | 13375 copyWidth, copyHeight, 0); |
| 13364 | 13376 |
| 13365 // Rebind source texture. | 13377 // Rebind source texture. |
| 13366 glFramebufferTexture2DEXT(framebuffer_target, GL_COLOR_ATTACHMENT0, | 13378 glFramebufferTexture2DEXT(framebuffer_target, GL_COLOR_ATTACHMENT0, |
| 13367 source_texture_target, | 13379 source_texture_target, |
| 13368 source_texture_service_id, 0); | 13380 source_texture_service_id, 0); |
| 13369 | 13381 |
| 13370 glDeleteTextures(1, &temp_texture); | 13382 glDeleteTextures(1, &temp_texture); |
| 13371 } else { | 13383 } else { |
| 13372 if (workarounds().do_teximage_before_copyteximage_to_cube_map && | 13384 if (workarounds().init_one_cube_map_level_before_copyteximage && |
| 13373 texture->target() == GL_TEXTURE_CUBE_MAP && | 13385 texture->target() == GL_TEXTURE_CUBE_MAP && |
| 13374 target != GL_TEXTURE_CUBE_MAP_POSITIVE_X) { | 13386 target != GL_TEXTURE_CUBE_MAP_POSITIVE_X) { |
| 13375 TextureManager::DoTexImageArguments args = { | 13387 TextureManager::DoTexImageArguments args = { |
| 13376 target, level, final_internal_format, width, height, 1, border, | 13388 target, level, final_internal_format, width, height, 1, border, |
| 13377 format, type, nullptr, pixels_size, 0, | 13389 format, type, nullptr, pixels_size, 0, |
| 13378 TextureManager::DoTexImageArguments::kTexImage2D }; | 13390 TextureManager::DoTexImageArguments::kTexImage2D }; |
| 13379 texture_manager()->WorkaroundCopyTexImageCubeMap(&texture_state_, | 13391 texture_manager()->WorkaroundCopyTexImageCubeMap(&texture_state_, |
| 13380 &state_, &framebuffer_state_, texture_ref, func_name, args); | 13392 &state_, &framebuffer_state_, texture_ref, func_name, args); |
| 13381 } | 13393 } |
| 13382 glCopyTexImage2D(target, level, final_internal_format, copyX, copyY, | 13394 glCopyTexImage2D(target, level, final_internal_format, copyX, copyY, |
| (...skipping 4700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 18083 } | 18095 } |
| 18084 | 18096 |
| 18085 // Include the auto-generated part of this file. We split this because it means | 18097 // Include the auto-generated part of this file. We split this because it means |
| 18086 // we can easily edit the non-auto generated parts right here in this file | 18098 // we can easily edit the non-auto generated parts right here in this file |
| 18087 // instead of having to edit some template or the code generator. | 18099 // instead of having to edit some template or the code generator. |
| 18088 #include "base/macros.h" | 18100 #include "base/macros.h" |
| 18089 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 18101 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 18090 | 18102 |
| 18091 } // namespace gles2 | 18103 } // namespace gles2 |
| 18092 } // namespace gpu | 18104 } // namespace gpu |
| OLD | NEW |