Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 1818073002: Always apply UniformMatrix4fvStreamTextureMatrixCHROMIUM matrix argument. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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,
« no previous file with comments | « gpu/command_buffer/common/gles2_cmd_format_autogen.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698