Chromium Code Reviews| Index: gpu/command_buffer/service/gles2_cmd_decoder.cc |
| diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| index 6165f0bfc01810488d24d95cdefd13dc05ad1f66..b84e4030d4a33de7dde6b43fd00e0ccb73e54236 100644 |
| --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| @@ -70,6 +70,7 @@ |
| #include "ui/gl/gl_fence.h" |
| #include "ui/gl/gl_image.h" |
| #include "ui/gl/gl_implementation.h" |
| +#include "ui/gl/gl_stream_texture_image.h" |
| #include "ui/gl/gl_surface.h" |
| #include "ui/gl/gl_version_info.h" |
| #include "ui/gl/gpu_timing.h" |
| @@ -1597,6 +1598,9 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient { |
| void DoUniformMatrix4fv( |
| GLint fake_location, GLsizei count, GLboolean transpose, |
| const GLfloat* value); |
| + void DoUniformMatrix4fvWithStreamTextureMatrixCHROMIUM(GLint fake_location, |
| + GLboolean transpose, |
| + const GLfloat* value); |
|
reveman
2016/02/18 20:20:56
nit: s/value/default_value/
liberato (no reviews please)
2016/02/19 18:39:56
Done.
|
| void DoUniformMatrix2x3fv( |
| GLint fake_location, GLsizei count, GLboolean transpose, |
| const GLfloat* value); |
| @@ -7441,6 +7445,45 @@ void GLES2DecoderImpl::DoUniformMatrix4fv( |
| glUniformMatrix4fv(real_location, count, transpose, value); |
| } |
| +void GLES2DecoderImpl::DoUniformMatrix4fvWithStreamTextureMatrixCHROMIUM( |
| + GLint fake_location, |
| + GLboolean transpose, |
| + const GLfloat* default_value) { |
| + float gl_matrix[16]; |
| + bool copied_matrix = false; |
|
reveman
2016/02/18 20:20:56
nit: move the memcpy here and remove this copied_m
liberato (no reviews please)
2016/02/19 18:39:56
Done.
|
| + |
| + // This refers to the bound external texture on the active unit. |
| + TextureUnit& unit = state_.texture_units[state_.active_texture_unit]; |
| + if (TextureRef* texture_ref = unit.bound_texture_external_oes.get()) { |
| + if (gl::GLStreamTextureImage* image = |
| + texture_ref->texture()->GetLevelStreamTextureImage( |
| + GL_TEXTURE_EXTERNAL_OES, 0)) { |
| + image->GetTextureMatrix(gl_matrix); |
| + copied_matrix = true; |
| + // TODO(liberato): verify cl comments about !image. |
|
reveman
2016/02/18 20:20:56
not sure what this refers to
liberato (no reviews please)
2016/02/19 18:39:55
note to myself. i forgot to remove it.
|
| + } |
| + } |
| + |
| + // If the matrix was unsupported, then supply the default. |
| + // TODO(liberato): remove |default_value| and replace with an identity matrix. |
| + // It is only present as a transitionary step until StreamTexture supplies |
| + // the matrix via GLImage. Once that happens, GLRenderer can quit sending |
| + // in a default. |
| + if (!copied_matrix) |
| + memcpy(gl_matrix, default_value, sizeof(gl_matrix)); |
| + |
| + GLenum type = 0; |
| + GLint real_location = -1; |
| + GLsizei count = 1; |
| + if (!PrepForSetUniformByLocation(fake_location, "glUniformMatrix4fv", |
| + Program::kUniformMatrix4f, &real_location, |
| + &type, &count)) { |
| + return; |
| + } |
| + |
| + glUniformMatrix4fv(real_location, count, transpose, gl_matrix); |
| +} |
| + |
| void GLES2DecoderImpl::DoUniformMatrix2x3fv( |
| GLint fake_location, GLsizei count, GLboolean transpose, |
| const GLfloat* value) { |
| @@ -13361,14 +13404,23 @@ void GLES2DecoderImpl::DoCopyTextureCHROMIUM( |
| // before presenting. |
| if (source_target == GL_TEXTURE_EXTERNAL_OES) { |
| // TODO(hkuang): get the StreamTexture transform matrix in GPU process |
| - // instead of using kIdentityMatrix crbug.com/226218. |
| + // instead of using kIdentityMatrix crbug.com/226218. AVDACodecImage does |
| + // this correctly, but others (e.g., stream_texture_android.cc) don't. |
| + GLfloat transform_matrix[16]; |
| + bool got_matrix = false; |
|
reveman
2016/02/18 20:20:56
nit: same here. move memcpy here instead of this f
liberato (no reviews please)
2016/02/19 18:39:56
Done.
|
| + if (gl::GLStreamTextureImage* image = |
| + source_texture->GetLevelStreamTextureImage(GL_TEXTURE_EXTERNAL_OES, |
| + 0)) { |
| + image->GetTextureMatrix(transform_matrix); |
| + got_matrix = true; |
| + } |
| + if (!got_matrix) |
| + memcpy(transform_matrix, kIdentityMatrix, sizeof(transform_matrix)); |
| copy_texture_CHROMIUM_->DoCopyTextureWithTransform( |
| - this, source_target, source_texture->service_id(), |
| - dest_target, dest_texture->service_id(), source_width, source_height, |
| - unpack_flip_y == GL_TRUE, |
| - unpack_premultiply_alpha == GL_TRUE, |
| - unpack_unmultiply_alpha == GL_TRUE, |
| - kIdentityMatrix); |
| + this, source_target, source_texture->service_id(), dest_target, |
| + dest_texture->service_id(), source_width, source_height, |
| + unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, |
| + unpack_unmultiply_alpha == GL_TRUE, transform_matrix); |
| } else { |
| copy_texture_CHROMIUM_->DoCopyTexture( |
| this, source_target, source_texture->service_id(), |