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_copy_texture_chromium.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 412 bool unpremultiply_alpha) { | 412 bool unpremultiply_alpha) { |
| 413 bool premultiply_alpha_change = premultiply_alpha ^ unpremultiply_alpha; | 413 bool premultiply_alpha_change = premultiply_alpha ^ unpremultiply_alpha; |
| 414 // GL_INVALID_OPERATION is generated if the currently bound framebuffer's | 414 // GL_INVALID_OPERATION is generated if the currently bound framebuffer's |
| 415 // format does not contain a superset of the components required by the base | 415 // format does not contain a superset of the components required by the base |
| 416 // format of internalformat. | 416 // format of internalformat. |
| 417 // https://www.khronos.org/opengles/sdk/docs/man/xhtml/glCopyTexImage2D.xml | 417 // https://www.khronos.org/opengles/sdk/docs/man/xhtml/glCopyTexImage2D.xml |
| 418 bool source_format_contain_superset_of_dest_format = | 418 bool source_format_contain_superset_of_dest_format = |
| 419 (source_internal_format == dest_internal_format && | 419 (source_internal_format == dest_internal_format && |
| 420 source_internal_format != GL_BGRA_EXT) || | 420 source_internal_format != GL_BGRA_EXT) || |
| 421 (source_internal_format == GL_RGBA && dest_internal_format == GL_RGB); | 421 (source_internal_format == GL_RGBA && dest_internal_format == GL_RGB); |
| 422 if (!source_format_contain_superset_of_dest_format) { | |
| 423 using GL = gles2::GLES2Util; | |
| 424 uint32_t source_channels = GL::GetChannelsForFormat(source_internal_format); | |
| 425 uint32_t dest_channels = GL::GetChannelsForFormat(dest_internal_format); | |
| 426 const gles2::FeatureInfo* info = decoder->GetFeatureInfo(); | |
| 427 source_format_contain_superset_of_dest_format = | |
| 428 (GL::IsIntegerFormat(dest_internal_format) == | |
| 429 GL::IsIntegerFormat(source_internal_format)) && | |
| 430 (source_channels == dest_channels) && | |
| 431 (((dest_channels == GL::kRed || dest_channels == GL::kAlpha || | |
| 432 dest_channels == (GL::kRed | GL::kGreen)) && | |
| 433 info->IsES3Capable()) || | |
| 434 (dest_channels == GL::kRed && info->feature_flags().ext_texture_rg && | |
| 435 !GL::IsIntegerFormat(dest_internal_format))); | |
|
Ken Russell (switch to Gerrit)
2016/09/30 23:01:29
This addition to the code is very highly specializ
aleksandar.stojiljkovic
2016/10/03 10:56:52
Done. This would be useful later - edited out from
| |
| 436 } | |
| 422 // GL_TEXTURE_RECTANGLE_ARB on FBO is supported by OpenGL, not GLES2, | 437 // GL_TEXTURE_RECTANGLE_ARB on FBO is supported by OpenGL, not GLES2, |
| 423 // so restrict this to GL_TEXTURE_2D. | 438 // so restrict this to GL_TEXTURE_2D. |
| 424 if (source_target == GL_TEXTURE_2D && dest_target == GL_TEXTURE_2D && | 439 if (source_target == GL_TEXTURE_2D && dest_target == GL_TEXTURE_2D && |
| 425 !flip_y && !premultiply_alpha_change && | 440 !flip_y && !premultiply_alpha_change && |
| 426 source_format_contain_superset_of_dest_format) { | 441 source_format_contain_superset_of_dest_format) { |
| 427 DoCopyTexImage2D(decoder, | 442 DoCopyTexImage2D(decoder, |
| 428 source_target, | 443 source_target, |
| 429 source_id, | 444 source_id, |
| 430 dest_target, | 445 dest_target, |
| 431 dest_id, | 446 dest_id, |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 752 decoder->RestoreTextureState(dest_id); | 767 decoder->RestoreTextureState(dest_id); |
| 753 decoder->RestoreTextureUnitBindings(0); | 768 decoder->RestoreTextureUnitBindings(0); |
| 754 decoder->RestoreActiveTexture(); | 769 decoder->RestoreActiveTexture(); |
| 755 decoder->RestoreProgramBindings(); | 770 decoder->RestoreProgramBindings(); |
| 756 decoder->RestoreBufferBindings(); | 771 decoder->RestoreBufferBindings(); |
| 757 decoder->RestoreFramebufferBindings(); | 772 decoder->RestoreFramebufferBindings(); |
| 758 decoder->RestoreGlobalState(); | 773 decoder->RestoreGlobalState(); |
| 759 } | 774 } |
| 760 | 775 |
| 761 } // namespace gpu | 776 } // namespace gpu |
| OLD | NEW |