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 13533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13544 bool unpack_premultiply_alpha_change = | 13544 bool unpack_premultiply_alpha_change = |
13545 (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; | 13545 (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; |
13546 if (image && !unpack_flip_y && !unpack_premultiply_alpha_change) { | 13546 if (image && !unpack_flip_y && !unpack_premultiply_alpha_change) { |
13547 glBindTexture(dest_target, dest_texture->service_id()); | 13547 glBindTexture(dest_target, dest_texture->service_id()); |
13548 if (image->CopyTexImage(dest_target)) | 13548 if (image->CopyTexImage(dest_target)) |
13549 return; | 13549 return; |
13550 } | 13550 } |
13551 | 13551 |
13552 DoCopyTexImageIfNeeded(source_texture, source_target); | 13552 DoCopyTexImageIfNeeded(source_texture, source_target); |
13553 | 13553 |
13554 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix | 13554 // GL_TEXTURE_EXTERNAL_OES texture requires that we apply a transform matrix |
13555 // before presenting. | 13555 // before presenting. |
13556 if (source_target == GL_TEXTURE_EXTERNAL_OES) { | 13556 if (source_target == GL_TEXTURE_EXTERNAL_OES) { |
13557 // TODO(hkuang): get the StreamTexture transform matrix in GPU process | |
13558 // instead of using kIdentityMatrix crbug.com/226218. AVDACodecImage does | |
13559 // this correctly, but others (e.g., stream_texture_android.cc) don't. | |
13560 // (crbug.com/371500, crbug.com/588837) | |
13561 GLfloat transform_matrix[16]; | 13557 GLfloat transform_matrix[16]; |
13562 memcpy(transform_matrix, kIdentityMatrix, sizeof(transform_matrix)); | 13558 memcpy(transform_matrix, kIdentityMatrix, sizeof(transform_matrix)); |
no sievers
2016/03/01 00:50:27
nit: Looks like we can get rid of |kIdentityMatrix
Tobias Sargeant
2016/03/01 21:56:12
Done.
| |
13563 if (GLStreamTextureImage* image = | 13559 if (GLStreamTextureImage* image = |
13564 source_texture->GetLevelStreamTextureImage(GL_TEXTURE_EXTERNAL_OES, | 13560 source_texture->GetLevelStreamTextureImage(GL_TEXTURE_EXTERNAL_OES, |
13565 0)) { | 13561 0)) { |
13566 image->GetTextureMatrix(transform_matrix); | 13562 image->GetTextureMatrix(transform_matrix); |
13567 } | 13563 } |
13568 copy_texture_CHROMIUM_->DoCopyTextureWithTransform( | 13564 copy_texture_CHROMIUM_->DoCopyTextureWithTransform( |
13569 this, source_target, source_texture->service_id(), dest_target, | 13565 this, source_target, source_texture->service_id(), dest_target, |
13570 dest_texture->service_id(), source_width, source_height, | 13566 dest_texture->service_id(), source_width, source_height, |
13571 unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, | 13567 unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, |
13572 unpack_unmultiply_alpha == GL_TRUE, transform_matrix); | 13568 unpack_unmultiply_alpha == GL_TRUE, transform_matrix); |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13742 ScopedTextureBinder binder( | 13738 ScopedTextureBinder binder( |
13743 &state_, dest_texture->service_id(), dest_target); | 13739 &state_, dest_texture->service_id(), dest_target); |
13744 if (image->CopyTexSubImage(dest_target, gfx::Point(xoffset, yoffset), | 13740 if (image->CopyTexSubImage(dest_target, gfx::Point(xoffset, yoffset), |
13745 gfx::Rect(x, y, width, height))) { | 13741 gfx::Rect(x, y, width, height))) { |
13746 return; | 13742 return; |
13747 } | 13743 } |
13748 } | 13744 } |
13749 | 13745 |
13750 DoCopyTexImageIfNeeded(source_texture, source_target); | 13746 DoCopyTexImageIfNeeded(source_texture, source_target); |
13751 | 13747 |
13752 // TODO(hkuang): get the StreamTexture transform matrix in GPU process. | 13748 |
13753 // crbug.com/226218. | 13749 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix |
liberato (no reviews please)
2016/02/29 22:33:32
you don't have 226218 in the BUG= .
Tobias Sargeant
2016/02/29 23:57:50
Done.
| |
13754 copy_texture_CHROMIUM_->DoCopySubTexture( | 13750 // before presenting. |
13755 this, source_target, source_texture->service_id(), source_internal_format, | 13751 if (source_target == GL_TEXTURE_EXTERNAL_OES) { |
13756 dest_target, dest_texture->service_id(), dest_internal_format, | 13752 // TODO(hkuang): get the StreamTexture transform matrix in GPU process |
13757 xoffset, yoffset, x, y, width, height, dest_width, dest_height, | 13753 // instead of using kIdentityMatrix crbug.com/226218. AVDACodecImage does |
13758 source_width, source_height, | 13754 // this correctly, but others (e.g., stream_texture_android.cc) don't. |
no sievers
2016/03/01 00:50:27
you are fixing this TODO right?
Tobias Sargeant
2016/03/01 21:56:11
Done.
| |
13759 unpack_flip_y == GL_TRUE, | 13755 // (crbug.com/371500, crbug.com/588837) |
13760 unpack_premultiply_alpha == GL_TRUE, | 13756 GLfloat transform_matrix[16]; |
13761 unpack_unmultiply_alpha == GL_TRUE); | 13757 memcpy(transform_matrix, kIdentityMatrix, sizeof(transform_matrix)); |
13758 if (GLStreamTextureImage* image = | |
13759 source_texture->GetLevelStreamTextureImage(GL_TEXTURE_EXTERNAL_OES, | |
13760 0)) { | |
13761 image->GetTextureMatrix(transform_matrix); | |
13762 } | |
13763 copy_texture_CHROMIUM_->DoCopySubTextureWithTransform( | |
no sievers
2016/03/01 00:50:27
see above: if no matrix override we can fall throu
Tobias Sargeant
2016/03/01 21:56:12
Done.
| |
13764 this, source_target, source_texture->service_id(), | |
13765 source_internal_format, dest_target, dest_texture->service_id(), | |
13766 dest_internal_format, xoffset, yoffset, x, y, width, height, dest_width, | |
13767 dest_height, source_width, source_height, unpack_flip_y == GL_TRUE, | |
13768 unpack_premultiply_alpha == GL_TRUE, | |
13769 unpack_unmultiply_alpha == GL_TRUE, | |
13770 transform_matrix); | |
13771 } else { | |
13772 copy_texture_CHROMIUM_->DoCopySubTexture( | |
13773 this, source_target, source_texture->service_id(), | |
13774 source_internal_format, dest_target, dest_texture->service_id(), | |
13775 dest_internal_format, xoffset, yoffset, x, y, width, height, dest_width, | |
13776 dest_height, source_width, source_height, unpack_flip_y == GL_TRUE, | |
13777 unpack_premultiply_alpha == GL_TRUE, | |
13778 unpack_unmultiply_alpha == GL_TRUE); | |
13779 } | |
13762 } | 13780 } |
13763 | 13781 |
13764 void GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM(GLuint source_id, | 13782 void GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM(GLuint source_id, |
13765 GLuint dest_id) { | 13783 GLuint dest_id) { |
13766 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM"); | 13784 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM"); |
13767 | 13785 |
13768 TextureRef* source_texture_ref = GetTexture(source_id); | 13786 TextureRef* source_texture_ref = GetTexture(source_id); |
13769 TextureRef* dest_texture_ref = GetTexture(dest_id); | 13787 TextureRef* dest_texture_ref = GetTexture(dest_id); |
13770 | 13788 |
13771 if (!source_texture_ref || !dest_texture_ref) { | 13789 if (!source_texture_ref || !dest_texture_ref) { |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13912 if (error != GL_NO_ERROR) { | 13930 if (error != GL_NO_ERROR) { |
13913 RestoreCurrentTextureBindings(&state_, dest_texture->target()); | 13931 RestoreCurrentTextureBindings(&state_, dest_texture->target()); |
13914 return; | 13932 return; |
13915 } | 13933 } |
13916 | 13934 |
13917 texture_manager()->SetLevelInfo( | 13935 texture_manager()->SetLevelInfo( |
13918 dest_texture_ref, dest_texture->target(), 0, GL_RGBA, source_width, | 13936 dest_texture_ref, dest_texture->target(), 0, GL_RGBA, source_width, |
13919 source_height, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 13937 source_height, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
13920 gfx::Rect(source_width, source_height)); | 13938 gfx::Rect(source_width, source_height)); |
13921 | 13939 |
13922 // GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix | 13940 // GL_TEXTURE_EXTERNAL_OES texture requires that we apply a transform matrix |
13923 // before presenting. | 13941 // before presenting. |
13924 if (source_texture->target() == GL_TEXTURE_EXTERNAL_OES) { | 13942 if (source_texture->target() == GL_TEXTURE_EXTERNAL_OES) { |
13925 // TODO(hkuang): get the StreamTexture transform matrix in GPU process | |
13926 // instead of using kIdentityMatrix crbug.com/226218. | |
13927 copy_texture_CHROMIUM_->DoCopyTextureWithTransform( | 13943 copy_texture_CHROMIUM_->DoCopyTextureWithTransform( |
13928 this, source_texture->target(), source_texture->service_id(), | 13944 this, source_texture->target(), source_texture->service_id(), |
13929 dest_texture->target(), dest_texture->service_id(), source_width, | 13945 dest_texture->target(), dest_texture->service_id(), source_width, |
13930 source_height, false, false, false, kIdentityMatrix); | 13946 source_height, false, false, false, kIdentityMatrix); |
no sievers
2016/03/01 00:50:27
So you removed the todo but didn't address it.
Is
Tobias Sargeant
2016/03/01 21:56:11
I've removed the explicit support for GL_TEXTURE_E
| |
13931 } else { | 13947 } else { |
13932 copy_texture_CHROMIUM_->DoCopyTexture( | 13948 copy_texture_CHROMIUM_->DoCopyTexture( |
13933 this, source_texture->target(), source_texture->service_id(), | 13949 this, source_texture->target(), source_texture->service_id(), |
13934 source_internal_format, dest_texture->target(), | 13950 source_internal_format, dest_texture->target(), |
13935 dest_texture->service_id(), GL_RGBA, source_width, source_height, false, | 13951 dest_texture->service_id(), GL_RGBA, source_width, source_height, false, |
13936 false, false); | 13952 false, false); |
13937 } | 13953 } |
13938 } | 13954 } |
13939 | 13955 |
13940 void GLES2DecoderImpl::DoTexStorage2DEXT( | 13956 void GLES2DecoderImpl::DoTexStorage2DEXT( |
(...skipping 2005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
15946 } | 15962 } |
15947 | 15963 |
15948 // Include the auto-generated part of this file. We split this because it means | 15964 // Include the auto-generated part of this file. We split this because it means |
15949 // we can easily edit the non-auto generated parts right here in this file | 15965 // we can easily edit the non-auto generated parts right here in this file |
15950 // instead of having to edit some template or the code generator. | 15966 // instead of having to edit some template or the code generator. |
15951 #include "base/macros.h" | 15967 #include "base/macros.h" |
15952 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 15968 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
15953 | 15969 |
15954 } // namespace gles2 | 15970 } // namespace gles2 |
15955 } // namespace gpu | 15971 } // namespace gpu |
OLD | NEW |