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..e4728293d3aaac1b8f9e96ac3a787925771f141c 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); |
liberato (no reviews please)
2016/03/31 15:03:16
maybe not for this CL, but GetFlippedTextureMatrix
liberato (no reviews please)
2016/03/31 15:03:16
don't we want this to be GetFlippedTextureMatrix?
Tobias Sargeant
2016/04/01 11:59:10
Done. On reflection I decided against GetChromiumT
liberato (no reviews please)
2016/04/01 14:07:13
makes sense.
|
+ GLfloat tmp[16]; |
liberato (no reviews please)
2016/03/31 15:03:16
without this premultiply, does the y-flip without
|
+ for (int c = 0; c < 16; c += 4) { |
+ for (int r = 0; r < 4; ++r) { |
+ 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, |