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 12419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
12430 GLenum final_internal_format = TextureManager::AdjustTexInternalFormat( | 12430 GLenum final_internal_format = TextureManager::AdjustTexInternalFormat( |
12431 feature_info_.get(), internal_format); | 12431 feature_info_.get(), internal_format); |
12432 | 12432 |
12433 // The service id and target of the texture attached to READ_FRAMEBUFFER. | 12433 // The service id and target of the texture attached to READ_FRAMEBUFFER. |
12434 GLuint source_texture_service_id = 0; | 12434 GLuint source_texture_service_id = 0; |
12435 GLenum source_texture_target = 0; | 12435 GLenum source_texture_target = 0; |
12436 uint32_t channels_exist = GLES2Util::GetChannelsForFormat(read_format); | 12436 uint32_t channels_exist = GLES2Util::GetChannelsForFormat(read_format); |
12437 bool use_workaround = NeedsCopyTextureImageWorkaround( | 12437 bool use_workaround = NeedsCopyTextureImageWorkaround( |
12438 final_internal_format, channels_exist, &source_texture_service_id, | 12438 final_internal_format, channels_exist, &source_texture_service_id, |
12439 &source_texture_target); | 12439 &source_texture_target); |
12440 if (use_workaround) { | 12440 if (requires_luma_blit) { |
12441 DCHECK(!requires_luma_blit); | 12441 copy_tex_image_blit_->DoCopyTexImage2DToLUMAComatabilityTexture( |
12442 this, texture->service_id(), texture->target(), target, format, | |
12443 type, level, internal_format, copyX, copyY, copyWidth, copyHeight, | |
12444 framebuffer_state_.bound_read_framebuffer->service_id(), | |
12445 framebuffer_state_.bound_read_framebuffer | |
12446 ->GetReadBufferInternalFormat()); | |
12447 } else if(use_workaround) { | |
Zhenyao Mo
2016/06/14 22:49:14
nit: a space after if.
erikchen
2016/06/14 22:53:19
Done.
| |
12442 GLenum dest_texture_target = target; | 12448 GLenum dest_texture_target = target; |
12443 GLenum framebuffer_target = features().chromium_framebuffer_multisample | 12449 GLenum framebuffer_target = features().chromium_framebuffer_multisample |
12444 ? GL_READ_FRAMEBUFFER_EXT | 12450 ? GL_READ_FRAMEBUFFER_EXT |
12445 : GL_FRAMEBUFFER; | 12451 : GL_FRAMEBUFFER; |
12446 | 12452 |
12447 GLenum temp_internal_format = 0; | 12453 GLenum temp_internal_format = 0; |
12448 if (channels_exist == GLES2Util::kRGBA) { | 12454 if (channels_exist == GLES2Util::kRGBA) { |
12449 temp_internal_format = GL_RGBA; | 12455 temp_internal_format = GL_RGBA; |
12450 } else if (channels_exist == GLES2Util::kRGB) { | 12456 } else if (channels_exist == GLES2Util::kRGB) { |
12451 temp_internal_format = GL_RGB; | 12457 temp_internal_format = GL_RGB; |
(...skipping 20 matching lines...) Expand all Loading... | |
12472 glCopyTexImage2D(dest_texture_target, level, final_internal_format, 0, 0, | 12478 glCopyTexImage2D(dest_texture_target, level, final_internal_format, 0, 0, |
12473 copyWidth, copyHeight, 0); | 12479 copyWidth, copyHeight, 0); |
12474 | 12480 |
12475 // Rebind source texture. | 12481 // Rebind source texture. |
12476 glFramebufferTexture2DEXT(framebuffer_target, GL_COLOR_ATTACHMENT0, | 12482 glFramebufferTexture2DEXT(framebuffer_target, GL_COLOR_ATTACHMENT0, |
12477 source_texture_target, | 12483 source_texture_target, |
12478 source_texture_service_id, 0); | 12484 source_texture_service_id, 0); |
12479 | 12485 |
12480 glDeleteTextures(1, &temp_texture); | 12486 glDeleteTextures(1, &temp_texture); |
12481 } else { | 12487 } else { |
12482 if (requires_luma_blit) { | 12488 glCopyTexImage2D(target, level, final_internal_format, copyX, copyY, |
12483 copy_tex_image_blit_->DoCopyTexImage2DToLUMAComatabilityTexture( | 12489 copyWidth, copyHeight, border); |
12484 this, texture->service_id(), texture->target(), target, format, | |
12485 type, level, internal_format, copyX, copyY, copyWidth, copyHeight, | |
12486 framebuffer_state_.bound_read_framebuffer->service_id(), | |
12487 framebuffer_state_.bound_read_framebuffer | |
12488 ->GetReadBufferInternalFormat()); | |
12489 } else { | |
12490 glCopyTexImage2D(target, level, final_internal_format, copyX, copyY, | |
12491 copyWidth, copyHeight, border); | |
12492 } | |
12493 } | 12490 } |
12494 } | 12491 } |
12495 GLenum error = LOCAL_PEEK_GL_ERROR(func_name); | 12492 GLenum error = LOCAL_PEEK_GL_ERROR(func_name); |
12496 if (error == GL_NO_ERROR) { | 12493 if (error == GL_NO_ERROR) { |
12497 texture_manager()->SetLevelInfo(texture_ref, target, level, internal_format, | 12494 texture_manager()->SetLevelInfo(texture_ref, target, level, internal_format, |
12498 width, height, 1, border, format, | 12495 width, height, 1, border, format, |
12499 type, gfx::Rect(width, height)); | 12496 type, gfx::Rect(width, height)); |
12500 texture->ApplyFormatWorkarounds(feature_info_.get()); | 12497 texture->ApplyFormatWorkarounds(feature_info_.get()); |
12501 } | 12498 } |
12502 | 12499 |
(...skipping 4442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
16945 } | 16942 } |
16946 | 16943 |
16947 // Include the auto-generated part of this file. We split this because it means | 16944 // Include the auto-generated part of this file. We split this because it means |
16948 // we can easily edit the non-auto generated parts right here in this file | 16945 // we can easily edit the non-auto generated parts right here in this file |
16949 // instead of having to edit some template or the code generator. | 16946 // instead of having to edit some template or the code generator. |
16950 #include "base/macros.h" | 16947 #include "base/macros.h" |
16951 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 16948 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
16952 | 16949 |
16953 } // namespace gles2 | 16950 } // namespace gles2 |
16954 } // namespace gpu | 16951 } // namespace gpu |
OLD | NEW |