Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 7599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7610 &type, | 7610 &type, |
| 7611 &count)) { | 7611 &count)) { |
| 7612 return; | 7612 return; |
| 7613 } | 7613 } |
| 7614 glUniformMatrix4fv(real_location, count, transpose, value); | 7614 glUniformMatrix4fv(real_location, count, transpose, value); |
| 7615 } | 7615 } |
| 7616 | 7616 |
| 7617 void GLES2DecoderImpl::DoUniformMatrix4fvStreamTextureMatrixCHROMIUM( | 7617 void GLES2DecoderImpl::DoUniformMatrix4fvStreamTextureMatrixCHROMIUM( |
| 7618 GLint fake_location, | 7618 GLint fake_location, |
| 7619 GLboolean transpose, | 7619 GLboolean transpose, |
| 7620 const GLfloat* default_value) { | 7620 const GLfloat* transform) { |
| 7621 float gl_matrix[16]; | 7621 float gl_matrix[16]; |
| 7622 | 7622 |
| 7623 // If we can't get a matrix from the texture, then use a default. | |
| 7624 // TODO(liberato): remove |default_value| and replace with an identity matrix. | |
| 7625 // It is only present as a transitionary step until StreamTexture supplies | |
| 7626 // the matrix via GLImage. Once that happens, GLRenderer can quit sending | |
| 7627 // in a default. | |
| 7628 memcpy(gl_matrix, default_value, sizeof(gl_matrix)); | |
| 7629 | |
| 7630 // This refers to the bound external texture on the active unit. | 7623 // This refers to the bound external texture on the active unit. |
| 7631 TextureUnit& unit = state_.texture_units[state_.active_texture_unit]; | 7624 TextureUnit& unit = state_.texture_units[state_.active_texture_unit]; |
| 7632 if (TextureRef* texture_ref = unit.bound_texture_external_oes.get()) { | 7625 if (TextureRef* texture_ref = unit.bound_texture_external_oes.get()) { |
| 7633 if (GLStreamTextureImage* image = | 7626 if (GLStreamTextureImage* image = |
| 7634 texture_ref->texture()->GetLevelStreamTextureImage( | 7627 texture_ref->texture()->GetLevelStreamTextureImage( |
| 7635 GL_TEXTURE_EXTERNAL_OES, 0)) { | 7628 GL_TEXTURE_EXTERNAL_OES, 0)) { |
| 7636 image->GetTextureMatrix(gl_matrix); | 7629 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.
| |
| 7630 GLfloat tmp[16]; | |
|
liberato (no reviews please)
2016/03/31 15:03:16
without this premultiply, does the y-flip without
| |
| 7631 for (int c = 0; c < 16; c += 4) { | |
| 7632 for (int r = 0; r < 4; ++r) { | |
| 7633 tmp[c + r] = 0.0f; | |
| 7634 for (int i = 0; i < 4; ++i) { | |
| 7635 tmp[c + r] += gl_matrix[r + 4 * i] * transform[c + i]; | |
| 7636 } | |
| 7637 } | |
| 7638 } | |
| 7639 std::copy(tmp, tmp + 16, gl_matrix); | |
| 7640 } else { | |
| 7641 // Missing stream texture. Treat matrix as identity. | |
| 7642 memcpy(gl_matrix, transform, sizeof(gl_matrix)); | |
| 7637 } | 7643 } |
| 7638 } else { | 7644 } else { |
| 7639 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, | 7645 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, |
| 7640 "DoUniformMatrix4vStreamTextureMatrix", | 7646 "DoUniformMatrix4vStreamTextureMatrix", |
| 7641 "no texture bound"); | 7647 "no texture bound"); |
| 7642 return; | 7648 return; |
| 7643 } | 7649 } |
| 7644 | 7650 |
| 7645 GLenum type = 0; | 7651 GLenum type = 0; |
| 7646 GLint real_location = -1; | 7652 GLint real_location = -1; |
| (...skipping 8730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 16377 } | 16383 } |
| 16378 | 16384 |
| 16379 // Include the auto-generated part of this file. We split this because it means | 16385 // Include the auto-generated part of this file. We split this because it means |
| 16380 // we can easily edit the non-auto generated parts right here in this file | 16386 // we can easily edit the non-auto generated parts right here in this file |
| 16381 // instead of having to edit some template or the code generator. | 16387 // instead of having to edit some template or the code generator. |
| 16382 #include "base/macros.h" | 16388 #include "base/macros.h" |
| 16383 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 16389 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 16384 | 16390 |
| 16385 } // namespace gles2 | 16391 } // namespace gles2 |
| 16386 } // namespace gpu | 16392 } // namespace gpu |
| OLD | NEW |