| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "gpu/command_buffer/service/gl_utils.h" | 10 #include "gpu/command_buffer/service/gl_utils.h" |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 GLsizei height, | 323 GLsizei height, |
| 324 bool flip_y, | 324 bool flip_y, |
| 325 bool premultiply_alpha, | 325 bool premultiply_alpha, |
| 326 bool unpremultiply_alpha) { | 326 bool unpremultiply_alpha) { |
| 327 bool premultiply_alpha_change = premultiply_alpha ^ unpremultiply_alpha; | 327 bool premultiply_alpha_change = premultiply_alpha ^ unpremultiply_alpha; |
| 328 // GL_INVALID_OPERATION is generated if the currently bound framebuffer's | 328 // GL_INVALID_OPERATION is generated if the currently bound framebuffer's |
| 329 // format does not contain a superset of the components required by the base | 329 // format does not contain a superset of the components required by the base |
| 330 // format of internalformat. | 330 // format of internalformat. |
| 331 // https://www.khronos.org/opengles/sdk/docs/man/xhtml/glCopyTexImage2D.xml | 331 // https://www.khronos.org/opengles/sdk/docs/man/xhtml/glCopyTexImage2D.xml |
| 332 bool source_format_contain_superset_of_dest_format = | 332 bool source_format_contain_superset_of_dest_format = |
| 333 source_internal_format == dest_internal_format || | 333 (source_internal_format == dest_internal_format && |
| 334 source_internal_format != GL_BGRA_EXT) || |
| 334 (source_internal_format == GL_RGBA && dest_internal_format == GL_RGB); | 335 (source_internal_format == GL_RGBA && dest_internal_format == GL_RGB); |
| 335 // GL_TEXTURE_RECTANGLE_ARB on FBO is supported by OpenGL, not GLES2, | 336 // GL_TEXTURE_RECTANGLE_ARB on FBO is supported by OpenGL, not GLES2, |
| 336 // so restrict this to GL_TEXTURE_2D. | 337 // so restrict this to GL_TEXTURE_2D. |
| 337 if (source_target == GL_TEXTURE_2D && !flip_y && !premultiply_alpha_change && | 338 if (source_target == GL_TEXTURE_2D && !flip_y && !premultiply_alpha_change && |
| 338 source_format_contain_superset_of_dest_format) { | 339 source_format_contain_superset_of_dest_format) { |
| 339 DoCopyTexImage2D(decoder, | 340 DoCopyTexImage2D(decoder, |
| 340 source_target, | 341 source_target, |
| 341 source_id, | 342 source_id, |
| 342 dest_id, | 343 dest_id, |
| 343 dest_level, | 344 dest_level, |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 decoder->RestoreTextureState(dest_id); | 474 decoder->RestoreTextureState(dest_id); |
| 474 decoder->RestoreTextureUnitBindings(0); | 475 decoder->RestoreTextureUnitBindings(0); |
| 475 decoder->RestoreActiveTexture(); | 476 decoder->RestoreActiveTexture(); |
| 476 decoder->RestoreProgramBindings(); | 477 decoder->RestoreProgramBindings(); |
| 477 decoder->RestoreBufferBindings(); | 478 decoder->RestoreBufferBindings(); |
| 478 decoder->RestoreFramebufferBindings(); | 479 decoder->RestoreFramebufferBindings(); |
| 479 decoder->RestoreGlobalState(); | 480 decoder->RestoreGlobalState(); |
| 480 } | 481 } |
| 481 | 482 |
| 482 } // namespace gpu | 483 } // namespace gpu |
| OLD | NEW |