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 f28cc4387e7832e07bdf8335f303ff646fd0293c..18a74226eb05871b9d46c01e4e714c01ee932384 100644 |
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
@@ -7617,16 +7617,9 @@ void GLES2DecoderImpl::DoUniformMatrix4fv( |
void GLES2DecoderImpl::DoUniformMatrix4fvStreamTextureMatrixCHROMIUM( |
GLint fake_location, |
GLboolean transpose, |
- const GLfloat* default_value) { |
+ const GLfloat* transform) { |
float gl_matrix[16]; |
- // If we can't get a matrix from the texture, then use a 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. |
- memcpy(gl_matrix, default_value, sizeof(gl_matrix)); |
- |
// 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()) { |
@@ -7634,6 +7627,19 @@ void GLES2DecoderImpl::DoUniformMatrix4fvStreamTextureMatrixCHROMIUM( |
texture_ref->texture()->GetLevelStreamTextureImage( |
GL_TEXTURE_EXTERNAL_OES, 0)) { |
image->GetTextureMatrix(gl_matrix); |
+ GLfloat tmp[16]; |
+ for (int c = 0; c < 16; c += 4) { |
+ for (int r = 0; r < 4; ++r) { |
no sievers
2016/04/01 21:39:53
Can you use gfx::Transform for the multiplication?
no sievers
2016/04/11 18:08:50
^^ what about this?
Tobias Sargeant
2016/04/12 11:05:24
I've reimplemented with gfx::Transform. WDYT?
|
+ tmp[c + r] = 0.0f; |
+ for (int i = 0; i < 4; ++i) { |
+ tmp[c + r] += gl_matrix[r + 4 * i] * transform[c + i]; |
+ } |
+ } |
+ } |
+ std::copy(tmp, tmp + 16, gl_matrix); |
+ } else { |
+ // Missing stream texture. Treat matrix as identity. |
+ memcpy(gl_matrix, transform, sizeof(gl_matrix)); |
} |
} else { |
LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, |
@@ -13917,10 +13923,8 @@ void GLES2DecoderImpl::DoCopyTextureCHROMIUM( |
if (GLStreamTextureImage* image = |
source_texture->GetLevelStreamTextureImage(GL_TEXTURE_EXTERNAL_OES, |
0)) { |
- // The coordinate system of this matrix is y-up, not y-down, so a flip is |
- // needed. |
GLfloat transform_matrix[16]; |
- image->GetFlippedTextureMatrix(transform_matrix); |
+ image->GetTextureMatrix(transform_matrix); |
copy_texture_CHROMIUM_->DoCopyTextureWithTransform( |
this, source_target, source_texture->service_id(), dest_target, |
dest_texture->service_id(), source_width, source_height, |
@@ -14111,10 +14115,8 @@ void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( |
if (GLStreamTextureImage* image = |
source_texture->GetLevelStreamTextureImage(GL_TEXTURE_EXTERNAL_OES, |
0)) { |
- // The coordinate system of this matrix is y-up, not y-down, so a flip is |
- // needed. |
GLfloat transform_matrix[16]; |
- image->GetFlippedTextureMatrix(transform_matrix); |
+ image->GetTextureMatrix(transform_matrix); |
copy_texture_CHROMIUM_->DoCopySubTextureWithTransform( |
this, source_target, source_texture->service_id(), |
source_internal_format, dest_target, dest_texture->service_id(), |