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 1777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1788 void DoValidateProgram(GLuint program_client_id); | 1788 void DoValidateProgram(GLuint program_client_id); |
1789 | 1789 |
1790 void DoInsertEventMarkerEXT(GLsizei length, const GLchar* marker); | 1790 void DoInsertEventMarkerEXT(GLsizei length, const GLchar* marker); |
1791 void DoPushGroupMarkerEXT(GLsizei length, const GLchar* group); | 1791 void DoPushGroupMarkerEXT(GLsizei length, const GLchar* group); |
1792 void DoPopGroupMarkerEXT(void); | 1792 void DoPopGroupMarkerEXT(void); |
1793 | 1793 |
1794 // Gets the number of values that will be returned by glGetXXX. Returns | 1794 // Gets the number of values that will be returned by glGetXXX. Returns |
1795 // false if pname is unknown. | 1795 // false if pname is unknown. |
1796 bool GetNumValuesReturnedForGLGet(GLenum pname, GLsizei* num_values); | 1796 bool GetNumValuesReturnedForGLGet(GLenum pname, GLsizei* num_values); |
1797 | 1797 |
1798 // Checks if every attribute's type set by vertexAttrib API match | |
1799 // the type of corresponding attribute in vertex shader. | |
1800 bool AttribsTypeMatch(); | |
1801 | |
1798 // Checks if the current program and vertex attributes are valid for drawing. | 1802 // Checks if the current program and vertex attributes are valid for drawing. |
1799 bool IsDrawValid( | 1803 bool IsDrawValid( |
1800 const char* function_name, GLuint max_vertex_accessed, bool instanced, | 1804 const char* function_name, GLuint max_vertex_accessed, bool instanced, |
1801 GLsizei primcount); | 1805 GLsizei primcount); |
1802 | 1806 |
1803 // Returns true if successful, simulated will be true if attrib0 was | 1807 // Returns true if successful, simulated will be true if attrib0 was |
1804 // simulated. | 1808 // simulated. |
1805 bool SimulateAttrib0( | 1809 bool SimulateAttrib0( |
1806 const char* function_name, GLuint max_vertex_accessed, bool* simulated); | 1810 const char* function_name, GLuint max_vertex_accessed, bool* simulated); |
1807 void RestoreStateForAttrib(GLuint attrib, bool restore_array_binding); | 1811 void RestoreStateForAttrib(GLuint attrib, bool restore_array_binding); |
(...skipping 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3059 glGenTransformFeedbacks(1, &default_transform_feedback); | 3063 glGenTransformFeedbacks(1, &default_transform_feedback); |
3060 state_.default_transform_feedback = | 3064 state_.default_transform_feedback = |
3061 transform_feedback_manager_->CreateTransformFeedback( | 3065 transform_feedback_manager_->CreateTransformFeedback( |
3062 0, default_transform_feedback); | 3066 0, default_transform_feedback); |
3063 glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, default_transform_feedback); | 3067 glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, default_transform_feedback); |
3064 state_.bound_transform_feedback = state_.default_transform_feedback.get(); | 3068 state_.bound_transform_feedback = state_.default_transform_feedback.get(); |
3065 } | 3069 } |
3066 state_.indexed_uniform_buffer_bindings = new IndexedBufferBindingHost( | 3070 state_.indexed_uniform_buffer_bindings = new IndexedBufferBindingHost( |
3067 group_->max_uniform_buffer_bindings(), needs_emulation); | 3071 group_->max_uniform_buffer_bindings(), needs_emulation); |
3068 | 3072 |
3073 state_.InitGenericAttribBaseType(group_->max_vertex_attribs()); | |
3069 state_.attrib_values.resize(group_->max_vertex_attribs()); | 3074 state_.attrib_values.resize(group_->max_vertex_attribs()); |
3070 vertex_array_manager_.reset(new VertexArrayManager()); | 3075 vertex_array_manager_.reset(new VertexArrayManager()); |
3071 | 3076 |
3072 GLuint default_vertex_attrib_service_id = 0; | 3077 GLuint default_vertex_attrib_service_id = 0; |
3073 if (features().native_vertex_array_object) { | 3078 if (features().native_vertex_array_object) { |
3074 glGenVertexArraysOES(1, &default_vertex_attrib_service_id); | 3079 glGenVertexArraysOES(1, &default_vertex_attrib_service_id); |
3075 glBindVertexArrayOES(default_vertex_attrib_service_id); | 3080 glBindVertexArrayOES(default_vertex_attrib_service_id); |
3076 } | 3081 } |
3077 | 3082 |
3078 state_.default_vertex_attrib_manager = | 3083 state_.default_vertex_attrib_manager = |
(...skipping 5993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9072 | 9077 |
9073 void GLES2DecoderImpl::RestoreStateForSimulatedFixedAttribs() { | 9078 void GLES2DecoderImpl::RestoreStateForSimulatedFixedAttribs() { |
9074 // There's no need to call glVertexAttribPointer because we shadow all the | 9079 // There's no need to call glVertexAttribPointer because we shadow all the |
9075 // settings and passing GL_FIXED to it will not work. | 9080 // settings and passing GL_FIXED to it will not work. |
9076 glBindBuffer( | 9081 glBindBuffer( |
9077 GL_ARRAY_BUFFER, | 9082 GL_ARRAY_BUFFER, |
9078 state_.bound_array_buffer.get() ? state_.bound_array_buffer->service_id() | 9083 state_.bound_array_buffer.get() ? state_.bound_array_buffer->service_id() |
9079 : 0); | 9084 : 0); |
9080 } | 9085 } |
9081 | 9086 |
9087 bool GLES2DecoderImpl::AttribsTypeMatch() { | |
Zhenyao Mo
2016/07/22 14:36:47
This is still incorrect. See my comment in vertex_
Zhenyao Mo
2016/07/22 16:05:43
Sorry I missed the enable/disable part in the vert
| |
9088 for (uint32_t index = 0; index < group_->max_vertex_attribs(); index += 16) { | |
9089 uint32_t shader_attrib_written_mask = | |
9090 state_.current_program->vertex_input_type_written_mask(index); | |
9091 uint32_t vao_attrib_written_mask = | |
9092 state_.vertex_attrib_manager->attrib_type_written_mask(index); | |
9093 | |
9094 uint32_t vertex_attrib_base_type_mask = | |
9095 (~vao_attrib_written_mask & | |
9096 state_.GetGenericVertexAttribBaseTypeMask(index)) | | |
Zhenyao Mo
2016/07/22 14:36:47
nit: one extra indent
| |
9097 (vao_attrib_written_mask & | |
9098 state_.vertex_attrib_manager->attrib_base_type_mask(index)); | |
Zhenyao Mo
2016/07/22 14:36:47
nit: one extra indent.
| |
9099 | |
9100 if ((state_.current_program->vertex_input_base_type_mask(index) | |
9101 & shader_attrib_written_mask) != | |
9102 (vertex_attrib_base_type_mask & shader_attrib_written_mask)) { | |
9103 return false; | |
9104 } | |
9105 } | |
9106 return true; | |
9107 } | |
9108 | |
9082 error::Error GLES2DecoderImpl::DoDrawArrays( | 9109 error::Error GLES2DecoderImpl::DoDrawArrays( |
9083 const char* function_name, | 9110 const char* function_name, |
9084 bool instanced, | 9111 bool instanced, |
9085 GLenum mode, | 9112 GLenum mode, |
9086 GLint first, | 9113 GLint first, |
9087 GLsizei count, | 9114 GLsizei count, |
9088 GLsizei primcount) { | 9115 GLsizei primcount) { |
9089 error::Error error = WillAccessBoundFramebufferForDraw(); | 9116 error::Error error = WillAccessBoundFramebufferForDraw(); |
9090 if (error != error::kNoError) | 9117 if (error != error::kNoError) |
9091 return error; | 9118 return error; |
(...skipping 26 matching lines...) Expand all Loading... | |
9118 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, | 9145 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, |
9119 "mode is not identical with active transformfeedback's primitiveMode"); | 9146 "mode is not identical with active transformfeedback's primitiveMode"); |
9120 return error::kNoError; | 9147 return error::kNoError; |
9121 } | 9148 } |
9122 | 9149 |
9123 if (count == 0 || primcount == 0) { | 9150 if (count == 0 || primcount == 0) { |
9124 LOCAL_RENDER_WARNING("Render count or primcount is 0."); | 9151 LOCAL_RENDER_WARNING("Render count or primcount is 0."); |
9125 return error::kNoError; | 9152 return error::kNoError; |
9126 } | 9153 } |
9127 | 9154 |
9155 if (feature_info_->IsWebGL2OrES3Context() && !AttribsTypeMatch()) { | |
9156 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, | |
9157 "vertexAttrib function must match shader attrib type"); | |
9158 return error::kNoError; | |
9159 } | |
9160 | |
9128 GLuint max_vertex_accessed = first + count - 1; | 9161 GLuint max_vertex_accessed = first + count - 1; |
9129 if (IsDrawValid(function_name, max_vertex_accessed, instanced, primcount)) { | 9162 if (IsDrawValid(function_name, max_vertex_accessed, instanced, primcount)) { |
9130 if (!ClearUnclearedTextures()) { | 9163 if (!ClearUnclearedTextures()) { |
9131 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "out of memory"); | 9164 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "out of memory"); |
9132 return error::kNoError; | 9165 return error::kNoError; |
9133 } | 9166 } |
9134 bool simulated_attrib_0 = false; | 9167 bool simulated_attrib_0 = false; |
9135 if (!SimulateAttrib0( | 9168 if (!SimulateAttrib0( |
9136 function_name, max_vertex_accessed, &simulated_attrib_0)) { | 9169 function_name, max_vertex_accessed, &simulated_attrib_0)) { |
9137 return error::kNoError; | 9170 return error::kNoError; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9244 !state_.bound_transform_feedback->paused()) { | 9277 !state_.bound_transform_feedback->paused()) { |
9245 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, | 9278 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, |
9246 "transformfeedback is active and not paused"); | 9279 "transformfeedback is active and not paused"); |
9247 return error::kNoError; | 9280 return error::kNoError; |
9248 } | 9281 } |
9249 | 9282 |
9250 if (count == 0 || primcount == 0) { | 9283 if (count == 0 || primcount == 0) { |
9251 return error::kNoError; | 9284 return error::kNoError; |
9252 } | 9285 } |
9253 | 9286 |
9287 if (feature_info_->IsWebGL2OrES3Context() && !AttribsTypeMatch()) { | |
9288 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, | |
9289 "vertexAttrib function must match shader attrib type"); | |
9290 return error::kNoError; | |
9291 } | |
9292 | |
9254 GLuint max_vertex_accessed; | 9293 GLuint max_vertex_accessed; |
9255 Buffer* element_array_buffer = | 9294 Buffer* element_array_buffer = |
9256 state_.vertex_attrib_manager->element_array_buffer(); | 9295 state_.vertex_attrib_manager->element_array_buffer(); |
9257 | 9296 |
9258 if (!element_array_buffer->GetMaxValueForRange( | 9297 if (!element_array_buffer->GetMaxValueForRange( |
9259 offset, count, type, | 9298 offset, count, type, |
9260 state_.enable_flags.primitive_restart_fixed_index, | 9299 state_.enable_flags.primitive_restart_fixed_index, |
9261 &max_vertex_accessed)) { | 9300 &max_vertex_accessed)) { |
9262 LOCAL_SET_GL_ERROR( | 9301 LOCAL_SET_GL_ERROR( |
9263 GL_INVALID_OPERATION, function_name, "range out of bounds for buffer"); | 9302 GL_INVALID_OPERATION, function_name, "range out of bounds for buffer"); |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9843 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "index out of range"); | 9882 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "index out of range"); |
9844 return false; | 9883 return false; |
9845 } | 9884 } |
9846 state_.attrib_values[index].SetValues(value); | 9885 state_.attrib_values[index].SetValues(value); |
9847 return true; | 9886 return true; |
9848 } | 9887 } |
9849 | 9888 |
9850 void GLES2DecoderImpl::DoVertexAttrib1f(GLuint index, GLfloat v0) { | 9889 void GLES2DecoderImpl::DoVertexAttrib1f(GLuint index, GLfloat v0) { |
9851 GLfloat v[4] = { v0, 0.0f, 0.0f, 1.0f, }; | 9890 GLfloat v[4] = { v0, 0.0f, 0.0f, 1.0f, }; |
9852 if (SetVertexAttribValue("glVertexAttrib1f", index, v)) { | 9891 if (SetVertexAttribValue("glVertexAttrib1f", index, v)) { |
9892 state_.SetGenericVertexAttribBaseType( | |
9893 index, SHADER_VARIABLE_FLOAT); | |
9853 glVertexAttrib1f(index, v0); | 9894 glVertexAttrib1f(index, v0); |
9854 } | 9895 } |
9855 } | 9896 } |
9856 | 9897 |
9857 void GLES2DecoderImpl::DoVertexAttrib2f(GLuint index, GLfloat v0, GLfloat v1) { | 9898 void GLES2DecoderImpl::DoVertexAttrib2f(GLuint index, GLfloat v0, GLfloat v1) { |
9858 GLfloat v[4] = { v0, v1, 0.0f, 1.0f, }; | 9899 GLfloat v[4] = { v0, v1, 0.0f, 1.0f, }; |
9859 if (SetVertexAttribValue("glVertexAttrib2f", index, v)) { | 9900 if (SetVertexAttribValue("glVertexAttrib2f", index, v)) { |
9901 state_.SetGenericVertexAttribBaseType( | |
9902 index, SHADER_VARIABLE_FLOAT); | |
9860 glVertexAttrib2f(index, v0, v1); | 9903 glVertexAttrib2f(index, v0, v1); |
9861 } | 9904 } |
9862 } | 9905 } |
9863 | 9906 |
9864 void GLES2DecoderImpl::DoVertexAttrib3f( | 9907 void GLES2DecoderImpl::DoVertexAttrib3f( |
9865 GLuint index, GLfloat v0, GLfloat v1, GLfloat v2) { | 9908 GLuint index, GLfloat v0, GLfloat v1, GLfloat v2) { |
9866 GLfloat v[4] = { v0, v1, v2, 1.0f, }; | 9909 GLfloat v[4] = { v0, v1, v2, 1.0f, }; |
9867 if (SetVertexAttribValue("glVertexAttrib3f", index, v)) { | 9910 if (SetVertexAttribValue("glVertexAttrib3f", index, v)) { |
9911 state_.SetGenericVertexAttribBaseType( | |
9912 index, SHADER_VARIABLE_FLOAT); | |
9868 glVertexAttrib3f(index, v0, v1, v2); | 9913 glVertexAttrib3f(index, v0, v1, v2); |
9869 } | 9914 } |
9870 } | 9915 } |
9871 | 9916 |
9872 void GLES2DecoderImpl::DoVertexAttrib4f( | 9917 void GLES2DecoderImpl::DoVertexAttrib4f( |
9873 GLuint index, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) { | 9918 GLuint index, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) { |
9874 GLfloat v[4] = { v0, v1, v2, v3, }; | 9919 GLfloat v[4] = { v0, v1, v2, v3, }; |
9875 if (SetVertexAttribValue("glVertexAttrib4f", index, v)) { | 9920 if (SetVertexAttribValue("glVertexAttrib4f", index, v)) { |
9921 state_.SetGenericVertexAttribBaseType( | |
9922 index, SHADER_VARIABLE_FLOAT); | |
9876 glVertexAttrib4f(index, v0, v1, v2, v3); | 9923 glVertexAttrib4f(index, v0, v1, v2, v3); |
9877 } | 9924 } |
9878 } | 9925 } |
9879 | 9926 |
9880 void GLES2DecoderImpl::DoVertexAttrib1fv(GLuint index, const GLfloat* v) { | 9927 void GLES2DecoderImpl::DoVertexAttrib1fv(GLuint index, const GLfloat* v) { |
9881 GLfloat t[4] = { v[0], 0.0f, 0.0f, 1.0f, }; | 9928 GLfloat t[4] = { v[0], 0.0f, 0.0f, 1.0f, }; |
9882 if (SetVertexAttribValue("glVertexAttrib1fv", index, t)) { | 9929 if (SetVertexAttribValue("glVertexAttrib1fv", index, t)) { |
9930 state_.SetGenericVertexAttribBaseType( | |
9931 index, SHADER_VARIABLE_FLOAT); | |
9883 glVertexAttrib1fv(index, v); | 9932 glVertexAttrib1fv(index, v); |
9884 } | 9933 } |
9885 } | 9934 } |
9886 | 9935 |
9887 void GLES2DecoderImpl::DoVertexAttrib2fv(GLuint index, const GLfloat* v) { | 9936 void GLES2DecoderImpl::DoVertexAttrib2fv(GLuint index, const GLfloat* v) { |
9888 GLfloat t[4] = { v[0], v[1], 0.0f, 1.0f, }; | 9937 GLfloat t[4] = { v[0], v[1], 0.0f, 1.0f, }; |
9889 if (SetVertexAttribValue("glVertexAttrib2fv", index, t)) { | 9938 if (SetVertexAttribValue("glVertexAttrib2fv", index, t)) { |
9939 state_.SetGenericVertexAttribBaseType( | |
9940 index, SHADER_VARIABLE_FLOAT); | |
9890 glVertexAttrib2fv(index, v); | 9941 glVertexAttrib2fv(index, v); |
9891 } | 9942 } |
9892 } | 9943 } |
9893 | 9944 |
9894 void GLES2DecoderImpl::DoVertexAttrib3fv(GLuint index, const GLfloat* v) { | 9945 void GLES2DecoderImpl::DoVertexAttrib3fv(GLuint index, const GLfloat* v) { |
9895 GLfloat t[4] = { v[0], v[1], v[2], 1.0f, }; | 9946 GLfloat t[4] = { v[0], v[1], v[2], 1.0f, }; |
9896 if (SetVertexAttribValue("glVertexAttrib3fv", index, t)) { | 9947 if (SetVertexAttribValue("glVertexAttrib3fv", index, t)) { |
9948 state_.SetGenericVertexAttribBaseType( | |
9949 index, SHADER_VARIABLE_FLOAT); | |
9897 glVertexAttrib3fv(index, v); | 9950 glVertexAttrib3fv(index, v); |
9898 } | 9951 } |
9899 } | 9952 } |
9900 | 9953 |
9901 void GLES2DecoderImpl::DoVertexAttrib4fv(GLuint index, const GLfloat* v) { | 9954 void GLES2DecoderImpl::DoVertexAttrib4fv(GLuint index, const GLfloat* v) { |
9902 if (SetVertexAttribValue("glVertexAttrib4fv", index, v)) { | 9955 if (SetVertexAttribValue("glVertexAttrib4fv", index, v)) { |
9956 state_.SetGenericVertexAttribBaseType( | |
9957 index, SHADER_VARIABLE_FLOAT); | |
9903 glVertexAttrib4fv(index, v); | 9958 glVertexAttrib4fv(index, v); |
9904 } | 9959 } |
9905 } | 9960 } |
9906 | 9961 |
9907 void GLES2DecoderImpl::DoVertexAttribI4i( | 9962 void GLES2DecoderImpl::DoVertexAttribI4i( |
9908 GLuint index, GLint v0, GLint v1, GLint v2, GLint v3) { | 9963 GLuint index, GLint v0, GLint v1, GLint v2, GLint v3) { |
9909 GLint v[4] = { v0, v1, v2, v3 }; | 9964 GLint v[4] = { v0, v1, v2, v3 }; |
9910 if (SetVertexAttribValue("glVertexAttribI4i", index, v)) { | 9965 if (SetVertexAttribValue("glVertexAttribI4i", index, v)) { |
9966 state_.SetGenericVertexAttribBaseType( | |
9967 index, SHADER_VARIABLE_INT); | |
9911 glVertexAttribI4i(index, v0, v1, v2, v3); | 9968 glVertexAttribI4i(index, v0, v1, v2, v3); |
9912 } | 9969 } |
9913 } | 9970 } |
9914 | 9971 |
9915 void GLES2DecoderImpl::DoVertexAttribI4iv(GLuint index, const GLint* v) { | 9972 void GLES2DecoderImpl::DoVertexAttribI4iv(GLuint index, const GLint* v) { |
9916 if (SetVertexAttribValue("glVertexAttribI4iv", index, v)) { | 9973 if (SetVertexAttribValue("glVertexAttribI4iv", index, v)) { |
9974 state_.SetGenericVertexAttribBaseType( | |
9975 index, SHADER_VARIABLE_INT); | |
9917 glVertexAttribI4iv(index, v); | 9976 glVertexAttribI4iv(index, v); |
9918 } | 9977 } |
9919 } | 9978 } |
9920 | 9979 |
9921 void GLES2DecoderImpl::DoVertexAttribI4ui( | 9980 void GLES2DecoderImpl::DoVertexAttribI4ui( |
9922 GLuint index, GLuint v0, GLuint v1, GLuint v2, GLuint v3) { | 9981 GLuint index, GLuint v0, GLuint v1, GLuint v2, GLuint v3) { |
9923 GLuint v[4] = { v0, v1, v2, v3 }; | 9982 GLuint v[4] = { v0, v1, v2, v3 }; |
9924 if (SetVertexAttribValue("glVertexAttribI4ui", index, v)) { | 9983 if (SetVertexAttribValue("glVertexAttribI4ui", index, v)) { |
9984 state_.SetGenericVertexAttribBaseType( | |
9985 index, SHADER_VARIABLE_UINT); | |
9925 glVertexAttribI4ui(index, v0, v1, v2, v3); | 9986 glVertexAttribI4ui(index, v0, v1, v2, v3); |
9926 } | 9987 } |
9927 } | 9988 } |
9928 | 9989 |
9929 void GLES2DecoderImpl::DoVertexAttribI4uiv(GLuint index, const GLuint* v) { | 9990 void GLES2DecoderImpl::DoVertexAttribI4uiv(GLuint index, const GLuint* v) { |
9930 if (SetVertexAttribValue("glVertexAttribI4uiv", index, v)) { | 9991 if (SetVertexAttribValue("glVertexAttribI4uiv", index, v)) { |
9992 state_.SetGenericVertexAttribBaseType( | |
9993 index, SHADER_VARIABLE_UINT); | |
9931 glVertexAttribI4uiv(index, v); | 9994 glVertexAttribI4uiv(index, v); |
9932 } | 9995 } |
9933 } | 9996 } |
9934 | 9997 |
9935 error::Error GLES2DecoderImpl::HandleVertexAttribIPointer( | 9998 error::Error GLES2DecoderImpl::HandleVertexAttribIPointer( |
9936 uint32_t immediate_data_size, | 9999 uint32_t immediate_data_size, |
9937 const void* cmd_data) { | 10000 const void* cmd_data) { |
9938 if (!unsafe_es3_apis_enabled()) | 10001 if (!unsafe_es3_apis_enabled()) |
9939 return error::kUnknownCommand; | 10002 return error::kUnknownCommand; |
9940 const gles2::cmds::VertexAttribIPointer& c = | 10003 const gles2::cmds::VertexAttribIPointer& c = |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9999 GL_INVALID_OPERATION, | 10062 GL_INVALID_OPERATION, |
10000 "glVertexAttribIPointer", "offset not valid for type"); | 10063 "glVertexAttribIPointer", "offset not valid for type"); |
10001 return error::kNoError; | 10064 return error::kNoError; |
10002 } | 10065 } |
10003 if (stride & (type_size - 1)) { | 10066 if (stride & (type_size - 1)) { |
10004 LOCAL_SET_GL_ERROR( | 10067 LOCAL_SET_GL_ERROR( |
10005 GL_INVALID_OPERATION, | 10068 GL_INVALID_OPERATION, |
10006 "glVertexAttribIPointer", "stride not valid for type"); | 10069 "glVertexAttribIPointer", "stride not valid for type"); |
10007 return error::kNoError; | 10070 return error::kNoError; |
10008 } | 10071 } |
10072 | |
10073 GLenum base_type = (type == GL_BYTE || type == GL_SHORT || type == GL_INT) ? | |
10074 SHADER_VARIABLE_INT : SHADER_VARIABLE_UINT; | |
10075 state_.vertex_attrib_manager->UpdateAttribBaseTypeAndMask(indx, base_type); | |
10076 | |
10009 GLsizei group_size = GLES2Util::GetGroupSizeForBufferType(size, type); | 10077 GLsizei group_size = GLES2Util::GetGroupSizeForBufferType(size, type); |
10010 state_.vertex_attrib_manager | 10078 state_.vertex_attrib_manager |
10011 ->SetAttribInfo(indx, | 10079 ->SetAttribInfo(indx, |
10012 state_.bound_array_buffer.get(), | 10080 state_.bound_array_buffer.get(), |
10013 size, | 10081 size, |
10014 type, | 10082 type, |
10015 GL_FALSE, | 10083 GL_FALSE, |
10016 stride, | 10084 stride, |
10017 stride != 0 ? stride : group_size, | 10085 stride != 0 ? stride : group_size, |
10018 offset, | 10086 offset, |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10093 GL_INVALID_OPERATION, | 10161 GL_INVALID_OPERATION, |
10094 "glVertexAttribPointer", "offset not valid for type"); | 10162 "glVertexAttribPointer", "offset not valid for type"); |
10095 return error::kNoError; | 10163 return error::kNoError; |
10096 } | 10164 } |
10097 if (stride & (type_size - 1)) { | 10165 if (stride & (type_size - 1)) { |
10098 LOCAL_SET_GL_ERROR( | 10166 LOCAL_SET_GL_ERROR( |
10099 GL_INVALID_OPERATION, | 10167 GL_INVALID_OPERATION, |
10100 "glVertexAttribPointer", "stride not valid for type"); | 10168 "glVertexAttribPointer", "stride not valid for type"); |
10101 return error::kNoError; | 10169 return error::kNoError; |
10102 } | 10170 } |
10171 | |
10172 state_.vertex_attrib_manager->UpdateAttribBaseTypeAndMask( | |
10173 indx, SHADER_VARIABLE_FLOAT); | |
10174 | |
10103 GLsizei group_size = GLES2Util::GetGroupSizeForBufferType(size, type); | 10175 GLsizei group_size = GLES2Util::GetGroupSizeForBufferType(size, type); |
10104 state_.vertex_attrib_manager | 10176 state_.vertex_attrib_manager |
10105 ->SetAttribInfo(indx, | 10177 ->SetAttribInfo(indx, |
10106 state_.bound_array_buffer.get(), | 10178 state_.bound_array_buffer.get(), |
10107 size, | 10179 size, |
10108 type, | 10180 type, |
10109 normalized, | 10181 normalized, |
10110 stride, | 10182 stride, |
10111 stride != 0 ? stride : group_size, | 10183 stride != 0 ? stride : group_size, |
10112 offset, | 10184 offset, |
(...skipping 7394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
17507 } | 17579 } |
17508 | 17580 |
17509 // Include the auto-generated part of this file. We split this because it means | 17581 // Include the auto-generated part of this file. We split this because it means |
17510 // we can easily edit the non-auto generated parts right here in this file | 17582 // we can easily edit the non-auto generated parts right here in this file |
17511 // instead of having to edit some template or the code generator. | 17583 // instead of having to edit some template or the code generator. |
17512 #include "base/macros.h" | 17584 #include "base/macros.h" |
17513 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 17585 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
17514 | 17586 |
17515 } // namespace gles2 | 17587 } // namespace gles2 |
17516 } // namespace gpu | 17588 } // namespace gpu |
OLD | NEW |