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 <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
(...skipping 9834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9845 } | 9845 } |
9846 | 9846 |
9847 texture_manager()->SetLevelInfo( | 9847 texture_manager()->SetLevelInfo( |
9848 dest_texture, GL_TEXTURE_2D, level, internal_format, source_width, | 9848 dest_texture, GL_TEXTURE_2D, level, internal_format, source_width, |
9849 source_height, 1, 0, internal_format, dest_type, true); | 9849 source_height, 1, 0, internal_format, dest_type, true); |
9850 } else { | 9850 } else { |
9851 texture_manager()->SetLevelCleared( | 9851 texture_manager()->SetLevelCleared( |
9852 dest_texture, GL_TEXTURE_2D, level, true); | 9852 dest_texture, GL_TEXTURE_2D, level, true); |
9853 } | 9853 } |
9854 | 9854 |
9855 copy_texture_CHROMIUM_->DoCopyTexture(this, | 9855 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix |
9856 source_texture->target(), | 9856 // before presenting. |
9857 dest_texture->target(), | 9857 if (source_texture->target() == GL_TEXTURE_EXTERNAL_OES) { |
9858 source_texture->service_id(), | 9858 // TODO(hkuang): get the StreamTexture transform matrix in GPU process |
9859 dest_texture->service_id(), level, | 9859 // instead of using default matrix crbug.com/226218. |
9860 source_width, source_height, | 9860 const static GLfloat default_matrix[16] = {1.0f, 0.0f, 0.0f, 0.0f, |
9861 unpack_flip_y_, | 9861 0.0f, 1.0f, 0.0f, 0.0f, |
9862 unpack_premultiply_alpha_, | 9862 0.0f, 0.0f, 1.0f, 0.0f, |
9863 unpack_unpremultiply_alpha_); | 9863 0.0f, 0.0f, 0.0f, 1.0f}; |
| 9864 copy_texture_CHROMIUM_->DoCopyTextureWithTransform( |
| 9865 this, |
| 9866 source_texture->target(), |
| 9867 dest_texture->target(), |
| 9868 source_texture->service_id(), |
| 9869 dest_texture->service_id(), level, |
| 9870 source_width, source_height, |
| 9871 unpack_flip_y_, |
| 9872 unpack_premultiply_alpha_, |
| 9873 unpack_unpremultiply_alpha_, |
| 9874 default_matrix); |
| 9875 } else { |
| 9876 copy_texture_CHROMIUM_->DoCopyTexture( |
| 9877 this, |
| 9878 source_texture->target(), |
| 9879 dest_texture->target(), |
| 9880 source_texture->service_id(), |
| 9881 dest_texture->service_id(), level, |
| 9882 source_width, source_height, |
| 9883 unpack_flip_y_, |
| 9884 unpack_premultiply_alpha_, |
| 9885 unpack_unpremultiply_alpha_); |
| 9886 } |
9864 } | 9887 } |
9865 | 9888 |
9866 static GLenum ExtractTypeFromStorageFormat(GLenum internalformat) { | 9889 static GLenum ExtractTypeFromStorageFormat(GLenum internalformat) { |
9867 switch (internalformat) { | 9890 switch (internalformat) { |
9868 case GL_RGB565: | 9891 case GL_RGB565: |
9869 return GL_UNSIGNED_SHORT_5_6_5; | 9892 return GL_UNSIGNED_SHORT_5_6_5; |
9870 case GL_RGBA4: | 9893 case GL_RGBA4: |
9871 return GL_UNSIGNED_SHORT_4_4_4_4; | 9894 return GL_UNSIGNED_SHORT_4_4_4_4; |
9872 case GL_RGB5_A1: | 9895 case GL_RGB5_A1: |
9873 return GL_UNSIGNED_SHORT_5_5_5_1; | 9896 return GL_UNSIGNED_SHORT_5_5_5_1; |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10504 return error::kNoError; | 10527 return error::kNoError; |
10505 } | 10528 } |
10506 | 10529 |
10507 // Include the auto-generated part of this file. We split this because it means | 10530 // Include the auto-generated part of this file. We split this because it means |
10508 // we can easily edit the non-auto generated parts right here in this file | 10531 // we can easily edit the non-auto generated parts right here in this file |
10509 // instead of having to edit some template or the code generator. | 10532 // instead of having to edit some template or the code generator. |
10510 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10533 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
10511 | 10534 |
10512 } // namespace gles2 | 10535 } // namespace gles2 |
10513 } // namespace gpu | 10536 } // namespace gpu |
OLD | NEW |