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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 7517 matching lines...) Expand 10 before | Expand all | Expand 10 after
7528 &type, 7528 &type,
7529 &count)) { 7529 &count)) {
7530 return; 7530 return;
7531 } 7531 }
7532 glUniformMatrix4fv(real_location, count, transpose, value); 7532 glUniformMatrix4fv(real_location, count, transpose, value);
7533 } 7533 }
7534 7534
7535 void GLES2DecoderImpl::DoUniformMatrix4fvStreamTextureMatrixCHROMIUM( 7535 void GLES2DecoderImpl::DoUniformMatrix4fvStreamTextureMatrixCHROMIUM(
7536 GLint fake_location, 7536 GLint fake_location,
7537 GLboolean transpose, 7537 GLboolean transpose,
7538 const GLfloat* default_value) { 7538 const GLfloat* post_transform) {
7539 float gl_matrix[16]; 7539 float gl_matrix[16];
7540 7540
7541 // If we can't get a matrix from the texture, then use a default.
7542 // TODO(liberato): remove |default_value| and replace with an identity matrix.
7543 // It is only present as a transitionary step until StreamTexture supplies
7544 // the matrix via GLImage. Once that happens, GLRenderer can quit sending
7545 // in a default.
7546 memcpy(gl_matrix, default_value, sizeof(gl_matrix));
7547
7548 // This refers to the bound external texture on the active unit. 7541 // This refers to the bound external texture on the active unit.
7549 TextureUnit& unit = state_.texture_units[state_.active_texture_unit]; 7542 TextureUnit& unit = state_.texture_units[state_.active_texture_unit];
7550 if (TextureRef* texture_ref = unit.bound_texture_external_oes.get()) { 7543 if (TextureRef* texture_ref = unit.bound_texture_external_oes.get()) {
7551 if (GLStreamTextureImage* image = 7544 if (GLStreamTextureImage* image =
7552 texture_ref->texture()->GetLevelStreamTextureImage( 7545 texture_ref->texture()->GetLevelStreamTextureImage(
7553 GL_TEXTURE_EXTERNAL_OES, 0)) { 7546 GL_TEXTURE_EXTERNAL_OES, 0)) {
7554 image->GetTextureMatrix(gl_matrix); 7547 image->GetTextureMatrix(gl_matrix);
7548 // 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
7549 GLfloat tmp[4];
7550 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
7551 for (int r = 0; r < 4; ++r) {
7552 tmp[r] = 0.0f;
7553 for (int i = 0; i < 4; ++i) {
7554 tmp[r] += post_transform[r + 4 * i] * gl_matrix[c + i];
7555 }
7556 }
7557 std::copy(tmp, tmp + 4, gl_matrix + c);
7558 }
7559 } else {
7560 // Missing stream texture. Treat matrix as identity.
7561 memcpy(gl_matrix, post_transform, sizeof(gl_matrix));
7555 } 7562 }
7556 } else { 7563 } else {
7557 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, 7564 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION,
7558 "DoUniformMatrix4vStreamTextureMatrix", 7565 "DoUniformMatrix4vStreamTextureMatrix",
7559 "no texture bound"); 7566 "no texture bound");
7560 return; 7567 return;
7561 } 7568 }
7562 7569
7563 GLenum type = 0; 7570 GLenum type = 0;
7564 GLint real_location = -1; 7571 GLint real_location = -1;
(...skipping 8683 matching lines...) Expand 10 before | Expand all | Expand 10 after
16248 } 16255 }
16249 16256
16250 // Include the auto-generated part of this file. We split this because it means 16257 // Include the auto-generated part of this file. We split this because it means
16251 // we can easily edit the non-auto generated parts right here in this file 16258 // we can easily edit the non-auto generated parts right here in this file
16252 // instead of having to edit some template or the code generator. 16259 // instead of having to edit some template or the code generator.
16253 #include "base/macros.h" 16260 #include "base/macros.h"
16254 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 16261 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
16255 16262
16256 } // namespace gles2 16263 } // namespace gles2
16257 } // namespace gpu 16264 } // namespace gpu
OLDNEW
« 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