OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 <vector> | 5 #include <vector> |
6 #include <string> | 6 #include <string> |
7 #include <map> | 7 #include <map> |
8 #include <build/build_config.h> | 8 #include <build/build_config.h> |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #define GLES2_GPU_SERVICE 1 | 10 #define GLES2_GPU_SERVICE 1 |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 switch (command) { | 669 switch (command) { |
670 #define GLES2_CMD_OP(name) \ | 670 #define GLES2_CMD_OP(name) \ |
671 case name::kCmdId: \ | 671 case name::kCmdId: \ |
672 result = Handle ## name( \ | 672 result = Handle ## name( \ |
673 immediate_data_size, \ | 673 immediate_data_size, \ |
674 *static_cast<const name*>(cmd_data)); \ | 674 *static_cast<const name*>(cmd_data)); \ |
675 break; \ | 675 break; \ |
676 | 676 |
677 GLES2_COMMAND_LIST(GLES2_CMD_OP) | 677 GLES2_COMMAND_LIST(GLES2_CMD_OP) |
678 #undef GLES2_CMD_OP | 678 #undef GLES2_CMD_OP |
679 if (debug()) { | 679 } |
680 if (glGetError() != 0) { | 680 if (debug()) { |
681 // TODO(gman): Change output to something useful for NaCl. | 681 if (glGetError() != 0) { |
682 printf("GL ERROR b4: %s\n", GetCommandName(command)); | 682 // TODO(gman): Change output to something useful for NaCl. |
683 } | 683 printf("GL ERROR b4: %s\n", GetCommandName(command)); |
684 } | 684 } |
685 } | 685 } |
686 } else { | 686 } else { |
687 result = parse_error::kParseInvalidArguments; | 687 result = parse_error::kParseInvalidArguments; |
688 } | 688 } |
689 } else { | 689 } else { |
690 result = DoCommonCommand(command, arg_count, cmd_data); | 690 result = DoCommonCommand(command, arg_count, cmd_data); |
691 } | 691 } |
692 return result; | 692 return result; |
693 } | 693 } |
(...skipping 16 matching lines...) Expand all Loading... |
710 | 710 |
711 void GLES2DecoderImpl::DoBindBuffer(GLenum target, GLuint buffer) { | 711 void GLES2DecoderImpl::DoBindBuffer(GLenum target, GLuint buffer) { |
712 switch (target) { | 712 switch (target) { |
713 case GL_ARRAY_BUFFER: | 713 case GL_ARRAY_BUFFER: |
714 bound_array_buffer_ = buffer; | 714 bound_array_buffer_ = buffer; |
715 break; | 715 break; |
716 case GL_ELEMENT_ARRAY_BUFFER: | 716 case GL_ELEMENT_ARRAY_BUFFER: |
717 bound_element_array_buffer_ = buffer; | 717 bound_element_array_buffer_ = buffer; |
718 break; | 718 break; |
719 default: | 719 default: |
| 720 DCHECK(false); // Validation should prevent us getting here. |
720 break; | 721 break; |
721 } | 722 } |
722 glBindBuffer(target, buffer); | 723 glBindBuffer(target, buffer); |
723 } | 724 } |
724 | 725 |
725 parse_error::ParseError GLES2DecoderImpl::HandleDeleteShader( | 726 parse_error::ParseError GLES2DecoderImpl::HandleDeleteShader( |
726 uint32 immediate_data_size, const gles2::DeleteShader& c) { | 727 uint32 immediate_data_size, const gles2::DeleteShader& c) { |
727 GLuint shader = c.shader; | 728 GLuint shader = c.shader; |
728 GLuint service_id; | 729 GLuint service_id; |
729 if (!id_map_.GetServiceId(shader, &service_id)) { | 730 if (!id_map_.GetServiceId(shader, &service_id)) { |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 const char** data = GetImmediateDataAs<const char**>(c); | 869 const char** data = GetImmediateDataAs<const char**>(c); |
869 if (!data) { | 870 if (!data) { |
870 return parse_error::kParseOutOfBounds; | 871 return parse_error::kParseOutOfBounds; |
871 } | 872 } |
872 return ShaderSourceHelper( | 873 return ShaderSourceHelper( |
873 shader, count, reinterpret_cast<const char*>(data), data_size); | 874 shader, count, reinterpret_cast<const char*>(data), data_size); |
874 } | 875 } |
875 | 876 |
876 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttribPointer( | 877 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttribPointer( |
877 uint32 immediate_data_size, const gles2::VertexAttribPointer& c) { | 878 uint32 immediate_data_size, const gles2::VertexAttribPointer& c) { |
| 879 // TODO(gman): Is this a valid check or does this check have to come |
| 880 // at glDrawElements time. |
878 if (bound_array_buffer_ != 0) { | 881 if (bound_array_buffer_ != 0) { |
879 GLuint indx = c.indx; | 882 GLuint indx = c.indx; |
880 GLint size = c.size; | 883 GLint size = c.size; |
881 GLenum type = c.type; | 884 GLenum type = c.type; |
882 GLboolean normalized = c.normalized; | 885 GLboolean normalized = c.normalized; |
883 GLsizei stride = c.stride; | 886 GLsizei stride = c.stride; |
884 GLuint offset = c.offset; | 887 GLuint offset = c.offset; |
885 const void* ptr = reinterpret_cast<const void*>(c.offset); | 888 const void* ptr = reinterpret_cast<const void*>(c.offset); |
886 // TODO(gman): Do manual validation. | |
887 if (!ptr) { | |
888 return parse_error::kParseOutOfBounds; | |
889 } | |
890 if (!ValidateGLenumVertexAttribType(type) || | 889 if (!ValidateGLenumVertexAttribType(type) || |
891 !ValidateGLenumVertexAttribSize(size)) { | 890 !ValidateGLenumVertexAttribSize(size)) { |
892 SetGLError(GL_INVALID_VALUE); | 891 SetGLError(GL_INVALID_VALUE); |
893 return parse_error::kParseNoError; | 892 return parse_error::kParseNoError; |
894 } | 893 } |
895 glVertexAttribPointer(indx, size, type, normalized, stride, ptr); | 894 glVertexAttribPointer(indx, size, type, normalized, stride, ptr); |
896 } else { | 895 } else { |
897 SetGLError(GL_INVALID_VALUE); | 896 SetGLError(GL_INVALID_VALUE); |
898 } | 897 } |
899 return parse_error::kParseNoError; | 898 return parse_error::kParseNoError; |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1233 } | 1232 } |
1234 | 1233 |
1235 // Include the auto-generated part of this file. We split this because it means | 1234 // Include the auto-generated part of this file. We split this because it means |
1236 // we can easily edit the non-auto generated parts right here in this file | 1235 // we can easily edit the non-auto generated parts right here in this file |
1237 // instead of having to edit some template or the code generator. | 1236 // instead of having to edit some template or the code generator. |
1238 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 1237 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
1239 | 1238 |
1240 } // namespace gles2 | 1239 } // namespace gles2 |
1241 } // namespace gpu | 1240 } // namespace gpu |
1242 | 1241 |
OLD | NEW |