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 ac7209792314dad5e0dbf7002e85e9847d9e71ca..4f9cda53741583975ea4eb34eb3ab9d86f39e592 100644 |
| --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| @@ -7535,16 +7535,9 @@ void GLES2DecoderImpl::DoUniformMatrix4fv( |
| void GLES2DecoderImpl::DoUniformMatrix4fvStreamTextureMatrixCHROMIUM( |
| GLint fake_location, |
| GLboolean transpose, |
| - const GLfloat* default_value) { |
| + const GLfloat* post_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()) { |
| @@ -7552,6 +7545,20 @@ void GLES2DecoderImpl::DoUniformMatrix4fvStreamTextureMatrixCHROMIUM( |
| texture_ref->texture()->GetLevelStreamTextureImage( |
| GL_TEXTURE_EXTERNAL_OES, 0)) { |
| image->GetTextureMatrix(gl_matrix); |
| + // Pre-multiply |gl_matrix| by |post_transform|. |
|
liberato (no reviews please)
2016/03/21 16:21:56
are you sure that it should be premultiplied? if
|
| + GLfloat tmp[4]; |
| + for (int c = 0; c < 16; c += 4) { |
|
liberato (no reviews please)
2016/03/21 16:21:56
maybe sievers has a way to avoid writing matrix mu
|
| + for (int r = 0; r < 4; ++r) { |
| + tmp[r] = 0.0f; |
| + for (int i = 0; i < 4; ++i) { |
| + tmp[r] += post_transform[r + 4 * i] * gl_matrix[c + i]; |
| + } |
| + } |
| + std::copy(tmp, tmp + 4, gl_matrix + c); |
| + } |
| + } else { |
| + // Missing stream texture. Treat matrix as identity. |
| + memcpy(gl_matrix, post_transform, sizeof(gl_matrix)); |
| } |
| } else { |
| LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, |