| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <list> | 10 #include <list> |
| (...skipping 3642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3653 | 3653 |
| 3654 void GLES2DecoderImpl::DoUniform1fv( | 3654 void GLES2DecoderImpl::DoUniform1fv( |
| 3655 GLint location, GLsizei count, const GLfloat* value) { | 3655 GLint location, GLsizei count, const GLfloat* value) { |
| 3656 GLenum type; | 3656 GLenum type; |
| 3657 if (!GetUniformTypeByLocation(location, "glUniform1fv", &type)) { | 3657 if (!GetUniformTypeByLocation(location, "glUniform1fv", &type)) { |
| 3658 return; | 3658 return; |
| 3659 } | 3659 } |
| 3660 if (type == GL_BOOL) { | 3660 if (type == GL_BOOL) { |
| 3661 scoped_array<GLint> temp(new GLint[count]); | 3661 scoped_array<GLint> temp(new GLint[count]); |
| 3662 for (GLsizei ii = 0; ii < count; ++ii) { | 3662 for (GLsizei ii = 0; ii < count; ++ii) { |
| 3663 temp[ii] = static_cast<GLint>(value[ii]); | 3663 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); |
| 3664 } | 3664 } |
| 3665 DoUniform1iv(location, count, temp.get()); | 3665 DoUniform1iv(location, count, temp.get()); |
| 3666 } else { | 3666 } else { |
| 3667 glUniform1fv(location, count, value); | 3667 glUniform1fv(location, count, value); |
| 3668 } | 3668 } |
| 3669 } | 3669 } |
| 3670 | 3670 |
| 3671 void GLES2DecoderImpl::DoUniform2fv( | 3671 void GLES2DecoderImpl::DoUniform2fv( |
| 3672 GLint location, GLsizei count, const GLfloat* value) { | 3672 GLint location, GLsizei count, const GLfloat* value) { |
| 3673 GLenum type; | 3673 GLenum type; |
| 3674 if (!GetUniformTypeByLocation(location, "glUniform2fv", &type)) { | 3674 if (!GetUniformTypeByLocation(location, "glUniform2fv", &type)) { |
| 3675 return; | 3675 return; |
| 3676 } | 3676 } |
| 3677 if (type == GL_BOOL_VEC2) { | 3677 if (type == GL_BOOL_VEC2) { |
| 3678 GLsizei num_values = count * 2; | 3678 GLsizei num_values = count * 2; |
| 3679 scoped_array<GLint> temp(new GLint[num_values]); | 3679 scoped_array<GLint> temp(new GLint[num_values]); |
| 3680 for (GLsizei ii = 0; ii < num_values; ++ii) { | 3680 for (GLsizei ii = 0; ii < num_values; ++ii) { |
| 3681 temp[ii] = static_cast<GLint>(value[ii]); | 3681 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); |
| 3682 } | 3682 } |
| 3683 glUniform2iv(location, count, temp.get()); | 3683 glUniform2iv(location, count, temp.get()); |
| 3684 } else { | 3684 } else { |
| 3685 glUniform2fv(location, count, value); | 3685 glUniform2fv(location, count, value); |
| 3686 } | 3686 } |
| 3687 } | 3687 } |
| 3688 | 3688 |
| 3689 void GLES2DecoderImpl::DoUniform3fv( | 3689 void GLES2DecoderImpl::DoUniform3fv( |
| 3690 GLint location, GLsizei count, const GLfloat* value) { | 3690 GLint location, GLsizei count, const GLfloat* value) { |
| 3691 GLenum type; | 3691 GLenum type; |
| 3692 if (!GetUniformTypeByLocation(location, "glUniform3fv", &type)) { | 3692 if (!GetUniformTypeByLocation(location, "glUniform3fv", &type)) { |
| 3693 return; | 3693 return; |
| 3694 } | 3694 } |
| 3695 if (type == GL_BOOL_VEC3) { | 3695 if (type == GL_BOOL_VEC3) { |
| 3696 GLsizei num_values = count * 3; | 3696 GLsizei num_values = count * 3; |
| 3697 scoped_array<GLint> temp(new GLint[num_values]); | 3697 scoped_array<GLint> temp(new GLint[num_values]); |
| 3698 for (GLsizei ii = 0; ii < num_values; ++ii) { | 3698 for (GLsizei ii = 0; ii < num_values; ++ii) { |
| 3699 temp[ii] = static_cast<GLint>(value[ii]); | 3699 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); |
| 3700 } | 3700 } |
| 3701 glUniform3iv(location, count, temp.get()); | 3701 glUniform3iv(location, count, temp.get()); |
| 3702 } else { | 3702 } else { |
| 3703 glUniform3fv(location, count, value); | 3703 glUniform3fv(location, count, value); |
| 3704 } | 3704 } |
| 3705 } | 3705 } |
| 3706 | 3706 |
| 3707 void GLES2DecoderImpl::DoUniform4fv( | 3707 void GLES2DecoderImpl::DoUniform4fv( |
| 3708 GLint location, GLsizei count, const GLfloat* value) { | 3708 GLint location, GLsizei count, const GLfloat* value) { |
| 3709 GLenum type; | 3709 GLenum type; |
| 3710 if (!GetUniformTypeByLocation(location, "glUniform4fv", &type)) { | 3710 if (!GetUniformTypeByLocation(location, "glUniform4fv", &type)) { |
| 3711 return; | 3711 return; |
| 3712 } | 3712 } |
| 3713 if (type == GL_BOOL_VEC4) { | 3713 if (type == GL_BOOL_VEC4) { |
| 3714 GLsizei num_values = count * 4; | 3714 GLsizei num_values = count * 4; |
| 3715 scoped_array<GLint> temp(new GLint[num_values]); | 3715 scoped_array<GLint> temp(new GLint[num_values]); |
| 3716 for (GLsizei ii = 0; ii < num_values; ++ii) { | 3716 for (GLsizei ii = 0; ii < num_values; ++ii) { |
| 3717 temp[ii] = static_cast<GLint>(value[ii]); | 3717 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); |
| 3718 } | 3718 } |
| 3719 glUniform4iv(location, count, temp.get()); | 3719 glUniform4iv(location, count, temp.get()); |
| 3720 } else { | 3720 } else { |
| 3721 glUniform4fv(location, count, value); | 3721 glUniform4fv(location, count, value); |
| 3722 } | 3722 } |
| 3723 } | 3723 } |
| 3724 | 3724 |
| 3725 void GLES2DecoderImpl::DoUseProgram(GLuint program) { | 3725 void GLES2DecoderImpl::DoUseProgram(GLuint program) { |
| 3726 GLuint service_id = 0; | 3726 GLuint service_id = 0; |
| 3727 ProgramManager::ProgramInfo* info = NULL; | 3727 ProgramManager::ProgramInfo* info = NULL; |
| (...skipping 2019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5747 return error::kNoError; | 5747 return error::kNoError; |
| 5748 } | 5748 } |
| 5749 | 5749 |
| 5750 // Include the auto-generated part of this file. We split this because it means | 5750 // Include the auto-generated part of this file. We split this because it means |
| 5751 // we can easily edit the non-auto generated parts right here in this file | 5751 // we can easily edit the non-auto generated parts right here in this file |
| 5752 // instead of having to edit some template or the code generator. | 5752 // instead of having to edit some template or the code generator. |
| 5753 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 5753 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 5754 | 5754 |
| 5755 } // namespace gles2 | 5755 } // namespace gles2 |
| 5756 } // namespace gpu | 5756 } // namespace gpu |
| OLD | NEW |