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 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1590 | 1591 |
1591 void DoUniformMatrix2fv( | 1592 void DoUniformMatrix2fv( |
1592 GLint fake_location, GLsizei count, GLboolean transpose, | 1593 GLint fake_location, GLsizei count, GLboolean transpose, |
1593 const GLfloat* value); | 1594 const GLfloat* value); |
1594 void DoUniformMatrix3fv( | 1595 void DoUniformMatrix3fv( |
1595 GLint fake_location, GLsizei count, GLboolean transpose, | 1596 GLint fake_location, GLsizei count, GLboolean transpose, |
1596 const GLfloat* value); | 1597 const GLfloat* value); |
1597 void DoUniformMatrix4fv( | 1598 void DoUniformMatrix4fv( |
1598 GLint fake_location, GLsizei count, GLboolean transpose, | 1599 GLint fake_location, GLsizei count, GLboolean transpose, |
1599 const GLfloat* value); | 1600 const GLfloat* value); |
| 1601 void DoUniformMatrix4fvStreamTextureMatrixCHROMIUM( |
| 1602 GLint fake_location, |
| 1603 GLboolean transpose, |
| 1604 const GLfloat* default_value); |
1600 void DoUniformMatrix2x3fv( | 1605 void DoUniformMatrix2x3fv( |
1601 GLint fake_location, GLsizei count, GLboolean transpose, | 1606 GLint fake_location, GLsizei count, GLboolean transpose, |
1602 const GLfloat* value); | 1607 const GLfloat* value); |
1603 void DoUniformMatrix2x4fv( | 1608 void DoUniformMatrix2x4fv( |
1604 GLint fake_location, GLsizei count, GLboolean transpose, | 1609 GLint fake_location, GLsizei count, GLboolean transpose, |
1605 const GLfloat* value); | 1610 const GLfloat* value); |
1606 void DoUniformMatrix3x2fv( | 1611 void DoUniformMatrix3x2fv( |
1607 GLint fake_location, GLsizei count, GLboolean transpose, | 1612 GLint fake_location, GLsizei count, GLboolean transpose, |
1608 const GLfloat* value); | 1613 const GLfloat* value); |
1609 void DoUniformMatrix3x4fv( | 1614 void DoUniformMatrix3x4fv( |
(...skipping 5824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7434 "glUniformMatrix4fv", | 7439 "glUniformMatrix4fv", |
7435 Program::kUniformMatrix4f, | 7440 Program::kUniformMatrix4f, |
7436 &real_location, | 7441 &real_location, |
7437 &type, | 7442 &type, |
7438 &count)) { | 7443 &count)) { |
7439 return; | 7444 return; |
7440 } | 7445 } |
7441 glUniformMatrix4fv(real_location, count, transpose, value); | 7446 glUniformMatrix4fv(real_location, count, transpose, value); |
7442 } | 7447 } |
7443 | 7448 |
| 7449 void GLES2DecoderImpl::DoUniformMatrix4fvStreamTextureMatrixCHROMIUM( |
| 7450 GLint fake_location, |
| 7451 GLboolean transpose, |
| 7452 const GLfloat* default_value) { |
| 7453 float gl_matrix[16]; |
| 7454 |
| 7455 // If we can't get a matrix from the texture, then use a default. |
| 7456 // TODO(liberato): remove |default_value| and replace with an identity matrix. |
| 7457 // It is only present as a transitionary step until StreamTexture supplies |
| 7458 // the matrix via GLImage. Once that happens, GLRenderer can quit sending |
| 7459 // in a default. |
| 7460 memcpy(gl_matrix, default_value, sizeof(gl_matrix)); |
| 7461 |
| 7462 // This refers to the bound external texture on the active unit. |
| 7463 TextureUnit& unit = state_.texture_units[state_.active_texture_unit]; |
| 7464 if (TextureRef* texture_ref = unit.bound_texture_external_oes.get()) { |
| 7465 if (GLStreamTextureImage* image = |
| 7466 texture_ref->texture()->GetLevelStreamTextureImage( |
| 7467 GL_TEXTURE_EXTERNAL_OES, 0)) { |
| 7468 image->GetTextureMatrix(gl_matrix); |
| 7469 } |
| 7470 } else { |
| 7471 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, |
| 7472 "DoUniformMatrix4vStreamTextureMatrix", |
| 7473 "no texture bound"); |
| 7474 return; |
| 7475 } |
| 7476 |
| 7477 GLenum type = 0; |
| 7478 GLint real_location = -1; |
| 7479 GLsizei count = 1; |
| 7480 if (!PrepForSetUniformByLocation(fake_location, "glUniformMatrix4fv", |
| 7481 Program::kUniformMatrix4f, &real_location, |
| 7482 &type, &count)) { |
| 7483 return; |
| 7484 } |
| 7485 |
| 7486 glUniformMatrix4fv(real_location, count, transpose, gl_matrix); |
| 7487 } |
| 7488 |
7444 void GLES2DecoderImpl::DoUniformMatrix2x3fv( | 7489 void GLES2DecoderImpl::DoUniformMatrix2x3fv( |
7445 GLint fake_location, GLsizei count, GLboolean transpose, | 7490 GLint fake_location, GLsizei count, GLboolean transpose, |
7446 const GLfloat* value) { | 7491 const GLfloat* value) { |
7447 GLenum type = 0; | 7492 GLenum type = 0; |
7448 GLint real_location = -1; | 7493 GLint real_location = -1; |
7449 if (!PrepForSetUniformByLocation(fake_location, | 7494 if (!PrepForSetUniformByLocation(fake_location, |
7450 "glUniformMatrix2x3fv", | 7495 "glUniformMatrix2x3fv", |
7451 Program::kUniformMatrix2x3f, | 7496 Program::kUniformMatrix2x3f, |
7452 &real_location, | 7497 &real_location, |
7453 &type, | 7498 &type, |
(...skipping 8293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15747 } | 15792 } |
15748 | 15793 |
15749 // Include the auto-generated part of this file. We split this because it means | 15794 // Include the auto-generated part of this file. We split this because it means |
15750 // we can easily edit the non-auto generated parts right here in this file | 15795 // we can easily edit the non-auto generated parts right here in this file |
15751 // instead of having to edit some template or the code generator. | 15796 // instead of having to edit some template or the code generator. |
15752 #include "base/macros.h" | 15797 #include "base/macros.h" |
15753 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 15798 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
15754 | 15799 |
15755 } // namespace gles2 | 15800 } // namespace gles2 |
15756 } // namespace gpu | 15801 } // namespace gpu |
OLD | NEW |