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 19 matching lines...) Expand all Loading... |
30 #include "gpu/command_buffer/common/debug_marker_manager.h" | 30 #include "gpu/command_buffer/common/debug_marker_manager.h" |
31 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 31 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
32 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 32 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
33 #include "gpu/command_buffer/common/mailbox.h" | 33 #include "gpu/command_buffer/common/mailbox.h" |
34 #include "gpu/command_buffer/service/buffer_manager.h" | 34 #include "gpu/command_buffer/service/buffer_manager.h" |
35 #include "gpu/command_buffer/service/context_group.h" | 35 #include "gpu/command_buffer/service/context_group.h" |
36 #include "gpu/command_buffer/service/context_state.h" | 36 #include "gpu/command_buffer/service/context_state.h" |
37 #include "gpu/command_buffer/service/error_state.h" | 37 #include "gpu/command_buffer/service/error_state.h" |
38 #include "gpu/command_buffer/service/feature_info.h" | 38 #include "gpu/command_buffer/service/feature_info.h" |
39 #include "gpu/command_buffer/service/framebuffer_manager.h" | 39 #include "gpu/command_buffer/service/framebuffer_manager.h" |
| 40 #include "gpu/command_buffer/service/gl_stream_texture_image.h" |
40 #include "gpu/command_buffer/service/gl_utils.h" | 41 #include "gpu/command_buffer/service/gl_utils.h" |
41 #include "gpu/command_buffer/service/gles2_cmd_clear_framebuffer.h" | 42 #include "gpu/command_buffer/service/gles2_cmd_clear_framebuffer.h" |
42 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" | 43 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" |
43 #include "gpu/command_buffer/service/gles2_cmd_validation.h" | 44 #include "gpu/command_buffer/service/gles2_cmd_validation.h" |
44 #include "gpu/command_buffer/service/gpu_state_tracer.h" | 45 #include "gpu/command_buffer/service/gpu_state_tracer.h" |
45 #include "gpu/command_buffer/service/gpu_switches.h" | 46 #include "gpu/command_buffer/service/gpu_switches.h" |
46 #include "gpu/command_buffer/service/gpu_tracer.h" | 47 #include "gpu/command_buffer/service/gpu_tracer.h" |
47 #include "gpu/command_buffer/service/image_manager.h" | 48 #include "gpu/command_buffer/service/image_manager.h" |
48 #include "gpu/command_buffer/service/logger.h" | 49 #include "gpu/command_buffer/service/logger.h" |
49 #include "gpu/command_buffer/service/mailbox_manager.h" | 50 #include "gpu/command_buffer/service/mailbox_manager.h" |
(...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1618 | 1619 |
1619 void DoUniformMatrix2fv( | 1620 void DoUniformMatrix2fv( |
1620 GLint fake_location, GLsizei count, GLboolean transpose, | 1621 GLint fake_location, GLsizei count, GLboolean transpose, |
1621 const GLfloat* value); | 1622 const GLfloat* value); |
1622 void DoUniformMatrix3fv( | 1623 void DoUniformMatrix3fv( |
1623 GLint fake_location, GLsizei count, GLboolean transpose, | 1624 GLint fake_location, GLsizei count, GLboolean transpose, |
1624 const GLfloat* value); | 1625 const GLfloat* value); |
1625 void DoUniformMatrix4fv( | 1626 void DoUniformMatrix4fv( |
1626 GLint fake_location, GLsizei count, GLboolean transpose, | 1627 GLint fake_location, GLsizei count, GLboolean transpose, |
1627 const GLfloat* value); | 1628 const GLfloat* value); |
| 1629 void DoUniformMatrix4fvStreamTextureMatrixCHROMIUM( |
| 1630 GLint fake_location, |
| 1631 GLboolean transpose, |
| 1632 const GLfloat* default_value); |
1628 void DoUniformMatrix2x3fv( | 1633 void DoUniformMatrix2x3fv( |
1629 GLint fake_location, GLsizei count, GLboolean transpose, | 1634 GLint fake_location, GLsizei count, GLboolean transpose, |
1630 const GLfloat* value); | 1635 const GLfloat* value); |
1631 void DoUniformMatrix2x4fv( | 1636 void DoUniformMatrix2x4fv( |
1632 GLint fake_location, GLsizei count, GLboolean transpose, | 1637 GLint fake_location, GLsizei count, GLboolean transpose, |
1633 const GLfloat* value); | 1638 const GLfloat* value); |
1634 void DoUniformMatrix3x2fv( | 1639 void DoUniformMatrix3x2fv( |
1635 GLint fake_location, GLsizei count, GLboolean transpose, | 1640 GLint fake_location, GLsizei count, GLboolean transpose, |
1636 const GLfloat* value); | 1641 const GLfloat* value); |
1637 void DoUniformMatrix3x4fv( | 1642 void DoUniformMatrix3x4fv( |
(...skipping 5841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7479 "glUniformMatrix4fv", | 7484 "glUniformMatrix4fv", |
7480 Program::kUniformMatrix4f, | 7485 Program::kUniformMatrix4f, |
7481 &real_location, | 7486 &real_location, |
7482 &type, | 7487 &type, |
7483 &count)) { | 7488 &count)) { |
7484 return; | 7489 return; |
7485 } | 7490 } |
7486 glUniformMatrix4fv(real_location, count, transpose, value); | 7491 glUniformMatrix4fv(real_location, count, transpose, value); |
7487 } | 7492 } |
7488 | 7493 |
| 7494 void GLES2DecoderImpl::DoUniformMatrix4fvStreamTextureMatrixCHROMIUM( |
| 7495 GLint fake_location, |
| 7496 GLboolean transpose, |
| 7497 const GLfloat* default_value) { |
| 7498 float gl_matrix[16]; |
| 7499 |
| 7500 // If we can't get a matrix from the texture, then use a default. |
| 7501 // TODO(liberato): remove |default_value| and replace with an identity matrix. |
| 7502 // It is only present as a transitionary step until StreamTexture supplies |
| 7503 // the matrix via GLImage. Once that happens, GLRenderer can quit sending |
| 7504 // in a default. |
| 7505 memcpy(gl_matrix, default_value, sizeof(gl_matrix)); |
| 7506 |
| 7507 // This refers to the bound external texture on the active unit. |
| 7508 TextureUnit& unit = state_.texture_units[state_.active_texture_unit]; |
| 7509 if (TextureRef* texture_ref = unit.bound_texture_external_oes.get()) { |
| 7510 if (GLStreamTextureImage* image = |
| 7511 texture_ref->texture()->GetLevelStreamTextureImage( |
| 7512 GL_TEXTURE_EXTERNAL_OES, 0)) { |
| 7513 image->GetTextureMatrix(gl_matrix); |
| 7514 } |
| 7515 } else { |
| 7516 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, |
| 7517 "DoUniformMatrix4vStreamTextureMatrix", |
| 7518 "no texture bound"); |
| 7519 return; |
| 7520 } |
| 7521 |
| 7522 GLenum type = 0; |
| 7523 GLint real_location = -1; |
| 7524 GLsizei count = 1; |
| 7525 if (!PrepForSetUniformByLocation(fake_location, "glUniformMatrix4fv", |
| 7526 Program::kUniformMatrix4f, &real_location, |
| 7527 &type, &count)) { |
| 7528 return; |
| 7529 } |
| 7530 |
| 7531 glUniformMatrix4fv(real_location, count, transpose, gl_matrix); |
| 7532 } |
| 7533 |
7489 void GLES2DecoderImpl::DoUniformMatrix2x3fv( | 7534 void GLES2DecoderImpl::DoUniformMatrix2x3fv( |
7490 GLint fake_location, GLsizei count, GLboolean transpose, | 7535 GLint fake_location, GLsizei count, GLboolean transpose, |
7491 const GLfloat* value) { | 7536 const GLfloat* value) { |
7492 GLenum type = 0; | 7537 GLenum type = 0; |
7493 GLint real_location = -1; | 7538 GLint real_location = -1; |
7494 if (!PrepForSetUniformByLocation(fake_location, | 7539 if (!PrepForSetUniformByLocation(fake_location, |
7495 "glUniformMatrix2x3fv", | 7540 "glUniformMatrix2x3fv", |
7496 Program::kUniformMatrix2x3f, | 7541 Program::kUniformMatrix2x3f, |
7497 &real_location, | 7542 &real_location, |
7498 &type, | 7543 &type, |
(...skipping 8398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15897 } | 15942 } |
15898 | 15943 |
15899 // Include the auto-generated part of this file. We split this because it means | 15944 // Include the auto-generated part of this file. We split this because it means |
15900 // we can easily edit the non-auto generated parts right here in this file | 15945 // we can easily edit the non-auto generated parts right here in this file |
15901 // instead of having to edit some template or the code generator. | 15946 // instead of having to edit some template or the code generator. |
15902 #include "base/macros.h" | 15947 #include "base/macros.h" |
15903 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 15948 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
15904 | 15949 |
15905 } // namespace gles2 | 15950 } // namespace gles2 |
15906 } // namespace gpu | 15951 } // namespace gpu |
OLD | NEW |