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 <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1170 void DoUniformMatrix2fv( | 1170 void DoUniformMatrix2fv( |
1171 GLint fake_location, GLsizei count, GLboolean transpose, | 1171 GLint fake_location, GLsizei count, GLboolean transpose, |
1172 const GLfloat* value); | 1172 const GLfloat* value); |
1173 void DoUniformMatrix3fv( | 1173 void DoUniformMatrix3fv( |
1174 GLint fake_location, GLsizei count, GLboolean transpose, | 1174 GLint fake_location, GLsizei count, GLboolean transpose, |
1175 const GLfloat* value); | 1175 const GLfloat* value); |
1176 void DoUniformMatrix4fv( | 1176 void DoUniformMatrix4fv( |
1177 GLint fake_location, GLsizei count, GLboolean transpose, | 1177 GLint fake_location, GLsizei count, GLboolean transpose, |
1178 const GLfloat* value); | 1178 const GLfloat* value); |
1179 | 1179 |
| 1180 bool SetVertexAttribValue( |
| 1181 const char* function_name, GLuint index, const GLfloat* value); |
| 1182 |
1180 // Wrappers for glVertexAttrib?? | 1183 // Wrappers for glVertexAttrib?? |
1181 void DoVertexAttrib1f(GLuint index, GLfloat v0); | 1184 void DoVertexAttrib1f(GLuint index, GLfloat v0); |
1182 void DoVertexAttrib2f(GLuint index, GLfloat v0, GLfloat v1); | 1185 void DoVertexAttrib2f(GLuint index, GLfloat v0, GLfloat v1); |
1183 void DoVertexAttrib3f(GLuint index, GLfloat v0, GLfloat v1, GLfloat v2); | 1186 void DoVertexAttrib3f(GLuint index, GLfloat v0, GLfloat v1, GLfloat v2); |
1184 void DoVertexAttrib4f( | 1187 void DoVertexAttrib4f( |
1185 GLuint index, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); | 1188 GLuint index, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); |
1186 void DoVertexAttrib1fv(GLuint index, const GLfloat *v); | 1189 void DoVertexAttrib1fv(GLuint index, const GLfloat *v); |
1187 void DoVertexAttrib2fv(GLuint index, const GLfloat *v); | 1190 void DoVertexAttrib2fv(GLuint index, const GLfloat *v); |
1188 void DoVertexAttrib3fv(GLuint index, const GLfloat *v); | 1191 void DoVertexAttrib3fv(GLuint index, const GLfloat *v); |
1189 void DoVertexAttrib4fv(GLuint index, const GLfloat *v); | 1192 void DoVertexAttrib4fv(GLuint index, const GLfloat *v); |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1452 bool unpack_premultiply_alpha_; | 1455 bool unpack_premultiply_alpha_; |
1453 bool unpack_unpremultiply_alpha_; | 1456 bool unpack_unpremultiply_alpha_; |
1454 | 1457 |
1455 // Default vertex attribs manager, used when no VAOs are bound. | 1458 // Default vertex attribs manager, used when no VAOs are bound. |
1456 VertexAttribManager::Ref default_vertex_attrib_manager_; | 1459 VertexAttribManager::Ref default_vertex_attrib_manager_; |
1457 | 1460 |
1458 // The buffer we bind to attrib 0 since OpenGL requires it (ES does not). | 1461 // The buffer we bind to attrib 0 since OpenGL requires it (ES does not). |
1459 GLuint attrib_0_buffer_id_; | 1462 GLuint attrib_0_buffer_id_; |
1460 | 1463 |
1461 // The value currently in attrib_0. | 1464 // The value currently in attrib_0. |
1462 VertexAttribManager::VertexAttribInfo::Vec4 attrib_0_value_; | 1465 Vec4 attrib_0_value_; |
1463 | 1466 |
1464 // Whether or not the attrib_0 buffer holds the attrib_0_value. | 1467 // Whether or not the attrib_0 buffer holds the attrib_0_value. |
1465 bool attrib_0_buffer_matches_value_; | 1468 bool attrib_0_buffer_matches_value_; |
1466 | 1469 |
1467 // The size of attrib 0. | 1470 // The size of attrib 0. |
1468 GLsizei attrib_0_size_; | 1471 GLsizei attrib_0_size_; |
1469 | 1472 |
1470 // The buffer used to simulate GL_FIXED attribs. | 1473 // The buffer used to simulate GL_FIXED attribs. |
1471 GLuint fixed_attrib_buffer_id_; | 1474 GLuint fixed_attrib_buffer_id_; |
1472 | 1475 |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2032 LOG(ERROR) << "GpuScheduler::InitializeCommon failed because group " | 2035 LOG(ERROR) << "GpuScheduler::InitializeCommon failed because group " |
2033 << "failed to initialize."; | 2036 << "failed to initialize."; |
2034 group_ = NULL; // Must not destroy ContextGroup if it is not initialized. | 2037 group_ = NULL; // Must not destroy ContextGroup if it is not initialized. |
2035 Destroy(true); | 2038 Destroy(true); |
2036 return false; | 2039 return false; |
2037 } | 2040 } |
2038 CHECK_GL_ERROR(); | 2041 CHECK_GL_ERROR(); |
2039 | 2042 |
2040 disallowed_features_ = disallowed_features; | 2043 disallowed_features_ = disallowed_features; |
2041 | 2044 |
| 2045 state_.attrib_values.resize(group_->max_vertex_attribs()); |
2042 default_vertex_attrib_manager_ = new VertexAttribManager(); | 2046 default_vertex_attrib_manager_ = new VertexAttribManager(); |
2043 default_vertex_attrib_manager_->Initialize(group_->max_vertex_attribs()); | 2047 default_vertex_attrib_manager_->Initialize(group_->max_vertex_attribs()); |
2044 | 2048 |
2045 // vertex_attrib_manager is set to default_vertex_attrib_manager_ by this call | 2049 // vertex_attrib_manager is set to default_vertex_attrib_manager_ by this call |
2046 DoBindVertexArrayOES(0); | 2050 DoBindVertexArrayOES(0); |
2047 | 2051 |
2048 query_manager_.reset(new QueryManager(this, feature_info_)); | 2052 query_manager_.reset(new QueryManager(this, feature_info_)); |
2049 vertex_array_manager_.reset(new VertexArrayManager()); | 2053 vertex_array_manager_.reset(new VertexArrayManager()); |
2050 | 2054 |
2051 util_.set_num_compressed_texture_formats( | 2055 util_.set_num_compressed_texture_formats( |
(...skipping 3220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5272 // If it's enabled or it's not used then we don't need to do anything. | 5276 // If it's enabled or it's not used then we don't need to do anything. |
5273 bool attrib_0_used = | 5277 bool attrib_0_used = |
5274 state_.current_program->GetAttribInfoByLocation(0) != NULL; | 5278 state_.current_program->GetAttribInfoByLocation(0) != NULL; |
5275 if (info->enabled() && attrib_0_used) { | 5279 if (info->enabled() && attrib_0_used) { |
5276 return true; | 5280 return true; |
5277 } | 5281 } |
5278 | 5282 |
5279 // Make a buffer with a single repeated vec4 value enough to | 5283 // Make a buffer with a single repeated vec4 value enough to |
5280 // simulate the constant value that is supposed to be here. | 5284 // simulate the constant value that is supposed to be here. |
5281 // This is required to emulate GLES2 on GL. | 5285 // This is required to emulate GLES2 on GL. |
5282 typedef VertexAttribManager::VertexAttribInfo::Vec4 Vec4; | |
5283 | |
5284 GLuint num_vertices = max_vertex_accessed + 1; | 5286 GLuint num_vertices = max_vertex_accessed + 1; |
5285 uint32 size_needed = 0; | 5287 uint32 size_needed = 0; |
5286 | 5288 |
5287 if (num_vertices == 0 || | 5289 if (num_vertices == 0 || |
5288 !SafeMultiplyUint32(num_vertices, sizeof(Vec4), &size_needed) || | 5290 !SafeMultiplyUint32(num_vertices, sizeof(Vec4), &size_needed) || |
5289 size_needed > 0x7FFFFFFFU) { | 5291 size_needed > 0x7FFFFFFFU) { |
5290 SetGLError(GL_OUT_OF_MEMORY, function_name, "Simulating attrib 0"); | 5292 SetGLError(GL_OUT_OF_MEMORY, function_name, "Simulating attrib 0"); |
5291 return false; | 5293 return false; |
5292 } | 5294 } |
5293 | 5295 |
5294 PerformanceWarning( | 5296 PerformanceWarning( |
5295 "Attribute 0 is disabled. This has signficant performance penalty"); | 5297 "Attribute 0 is disabled. This has signficant performance penalty"); |
5296 | 5298 |
5297 CopyRealGLErrorsToWrapper(); | 5299 CopyRealGLErrorsToWrapper(); |
5298 glBindBuffer(GL_ARRAY_BUFFER, attrib_0_buffer_id_); | 5300 glBindBuffer(GL_ARRAY_BUFFER, attrib_0_buffer_id_); |
5299 | 5301 |
5300 bool new_buffer = static_cast<GLsizei>(size_needed) > attrib_0_size_; | 5302 bool new_buffer = static_cast<GLsizei>(size_needed) > attrib_0_size_; |
5301 if (new_buffer) { | 5303 if (new_buffer) { |
5302 glBufferData(GL_ARRAY_BUFFER, size_needed, NULL, GL_DYNAMIC_DRAW); | 5304 glBufferData(GL_ARRAY_BUFFER, size_needed, NULL, GL_DYNAMIC_DRAW); |
5303 GLenum error = glGetError(); | 5305 GLenum error = glGetError(); |
5304 if (error != GL_NO_ERROR) { | 5306 if (error != GL_NO_ERROR) { |
5305 SetGLError(GL_OUT_OF_MEMORY, function_name, "Simulating attrib 0"); | 5307 SetGLError(GL_OUT_OF_MEMORY, function_name, "Simulating attrib 0"); |
5306 return false; | 5308 return false; |
5307 } | 5309 } |
5308 } | 5310 } |
| 5311 |
| 5312 const Vec4& value = state_.attrib_values[0]; |
5309 if (new_buffer || | 5313 if (new_buffer || |
5310 (attrib_0_used && | 5314 (attrib_0_used && |
5311 (!attrib_0_buffer_matches_value_ || | 5315 (!attrib_0_buffer_matches_value_ || |
5312 (info->value().v[0] != attrib_0_value_.v[0] || | 5316 (value.v[0] != attrib_0_value_.v[0] || |
5313 info->value().v[1] != attrib_0_value_.v[1] || | 5317 value.v[1] != attrib_0_value_.v[1] || |
5314 info->value().v[2] != attrib_0_value_.v[2] || | 5318 value.v[2] != attrib_0_value_.v[2] || |
5315 info->value().v[3] != attrib_0_value_.v[3])))) { | 5319 value.v[3] != attrib_0_value_.v[3])))) { |
5316 std::vector<Vec4> temp(num_vertices, info->value()); | 5320 std::vector<Vec4> temp(num_vertices, value); |
5317 glBufferSubData(GL_ARRAY_BUFFER, 0, size_needed, &temp[0].v[0]); | 5321 glBufferSubData(GL_ARRAY_BUFFER, 0, size_needed, &temp[0].v[0]); |
5318 attrib_0_buffer_matches_value_ = true; | 5322 attrib_0_buffer_matches_value_ = true; |
5319 attrib_0_value_ = info->value(); | 5323 attrib_0_value_ = value; |
5320 attrib_0_size_ = size_needed; | 5324 attrib_0_size_ = size_needed; |
5321 } | 5325 } |
5322 | 5326 |
5323 glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, NULL); | 5327 glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, NULL); |
5324 | 5328 |
5325 if (info->divisor()) | 5329 if (info->divisor()) |
5326 glVertexAttribDivisorANGLE(0, 0); | 5330 glVertexAttribDivisorANGLE(0, 0); |
5327 | 5331 |
5328 *simulated = true; | 5332 *simulated = true; |
5329 return true; | 5333 return true; |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5983 break; | 5987 break; |
5984 case GL_VERTEX_ATTRIB_ARRAY_STRIDE: | 5988 case GL_VERTEX_ATTRIB_ARRAY_STRIDE: |
5985 *params = static_cast<GLfloat>(info->gl_stride()); | 5989 *params = static_cast<GLfloat>(info->gl_stride()); |
5986 break; | 5990 break; |
5987 case GL_VERTEX_ATTRIB_ARRAY_TYPE: | 5991 case GL_VERTEX_ATTRIB_ARRAY_TYPE: |
5988 *params = static_cast<GLfloat>(info->type()); | 5992 *params = static_cast<GLfloat>(info->type()); |
5989 break; | 5993 break; |
5990 case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED: | 5994 case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED: |
5991 *params = static_cast<GLfloat>(info->normalized()); | 5995 *params = static_cast<GLfloat>(info->normalized()); |
5992 break; | 5996 break; |
5993 case GL_CURRENT_VERTEX_ATTRIB: | 5997 case GL_CURRENT_VERTEX_ATTRIB: { |
5994 params[0] = info->value().v[0]; | 5998 const Vec4& value = state_.attrib_values[index]; |
5995 params[1] = info->value().v[1]; | 5999 params[0] = value.v[0]; |
5996 params[2] = info->value().v[2]; | 6000 params[1] = value.v[1]; |
5997 params[3] = info->value().v[3]; | 6001 params[2] = value.v[2]; |
| 6002 params[3] = value.v[3]; |
5998 break; | 6003 break; |
| 6004 } |
5999 case GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: | 6005 case GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: |
6000 *params = static_cast<GLfloat>(info->divisor()); | 6006 *params = static_cast<GLfloat>(info->divisor()); |
6001 break; | 6007 break; |
6002 default: | 6008 default: |
6003 NOTREACHED(); | 6009 NOTREACHED(); |
6004 break; | 6010 break; |
6005 } | 6011 } |
6006 } | 6012 } |
6007 | 6013 |
6008 void GLES2DecoderImpl::DoGetVertexAttribiv( | 6014 void GLES2DecoderImpl::DoGetVertexAttribiv( |
(...skipping 25 matching lines...) Expand all Loading... |
6034 break; | 6040 break; |
6035 case GL_VERTEX_ATTRIB_ARRAY_TYPE: | 6041 case GL_VERTEX_ATTRIB_ARRAY_TYPE: |
6036 *params = info->type(); | 6042 *params = info->type(); |
6037 break; | 6043 break; |
6038 case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED: | 6044 case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED: |
6039 *params = static_cast<GLint>(info->normalized()); | 6045 *params = static_cast<GLint>(info->normalized()); |
6040 break; | 6046 break; |
6041 case GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: | 6047 case GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: |
6042 *params = info->divisor(); | 6048 *params = info->divisor(); |
6043 break; | 6049 break; |
6044 case GL_CURRENT_VERTEX_ATTRIB: | 6050 case GL_CURRENT_VERTEX_ATTRIB: { |
6045 params[0] = static_cast<GLint>(info->value().v[0]); | 6051 const Vec4& value = state_.attrib_values[index]; |
6046 params[1] = static_cast<GLint>(info->value().v[1]); | 6052 params[0] = static_cast<GLint>(value.v[0]); |
6047 params[2] = static_cast<GLint>(info->value().v[2]); | 6053 params[1] = static_cast<GLint>(value.v[1]); |
6048 params[3] = static_cast<GLint>(info->value().v[3]); | 6054 params[2] = static_cast<GLint>(value.v[2]); |
| 6055 params[3] = static_cast<GLint>(value.v[3]); |
6049 break; | 6056 break; |
| 6057 } |
6050 default: | 6058 default: |
6051 NOTREACHED(); | 6059 NOTREACHED(); |
6052 break; | 6060 break; |
6053 } | 6061 } |
6054 } | 6062 } |
6055 | 6063 |
| 6064 bool GLES2DecoderImpl::SetVertexAttribValue( |
| 6065 const char* function_name, GLuint index, const GLfloat* value) { |
| 6066 if (index >= state_.attrib_values.size()) { |
| 6067 SetGLError(GL_INVALID_VALUE, function_name, "index out of range"); |
| 6068 return false; |
| 6069 } |
| 6070 Vec4& v = state_.attrib_values[index]; |
| 6071 v.v[0] = value[0]; |
| 6072 v.v[1] = value[1]; |
| 6073 v.v[2] = value[2]; |
| 6074 v.v[3] = value[3]; |
| 6075 return true; |
| 6076 } |
| 6077 |
6056 void GLES2DecoderImpl::DoVertexAttrib1f(GLuint index, GLfloat v0) { | 6078 void GLES2DecoderImpl::DoVertexAttrib1f(GLuint index, GLfloat v0) { |
6057 VertexAttribManager::VertexAttribInfo* info = | 6079 GLfloat v[4] = { v0, 0.0f, 0.0f, 1.0f, }; |
6058 state_.vertex_attrib_manager->GetVertexAttribInfo(index); | 6080 if (SetVertexAttribValue("glVertexAttrib1f", index, v)) { |
6059 if (!info) { | 6081 glVertexAttrib1f(index, v0); |
6060 SetGLError(GL_INVALID_VALUE, "glVertexAttrib1f", "index out of range"); | |
6061 return; | |
6062 } | 6082 } |
6063 VertexAttribManager::VertexAttribInfo::Vec4 value; | |
6064 value.v[0] = v0; | |
6065 value.v[1] = 0.0f; | |
6066 value.v[2] = 0.0f; | |
6067 value.v[3] = 1.0f; | |
6068 info->set_value(value); | |
6069 glVertexAttrib1f(index, v0); | |
6070 } | 6083 } |
6071 | 6084 |
6072 void GLES2DecoderImpl::DoVertexAttrib2f(GLuint index, GLfloat v0, GLfloat v1) { | 6085 void GLES2DecoderImpl::DoVertexAttrib2f(GLuint index, GLfloat v0, GLfloat v1) { |
6073 VertexAttribManager::VertexAttribInfo* info = | 6086 GLfloat v[4] = { v0, v1, 0.0f, 1.0f, }; |
6074 state_.vertex_attrib_manager->GetVertexAttribInfo(index); | 6087 if (SetVertexAttribValue("glVertexAttrib2f", index, v)) { |
6075 if (!info) { | 6088 glVertexAttrib2f(index, v0, v1); |
6076 SetGLError(GL_INVALID_VALUE, "glVertexAttrib2f", "index out of range"); | |
6077 return; | |
6078 } | 6089 } |
6079 VertexAttribManager::VertexAttribInfo::Vec4 value; | |
6080 value.v[0] = v0; | |
6081 value.v[1] = v1; | |
6082 value.v[2] = 0.0f; | |
6083 value.v[3] = 1.0f; | |
6084 info->set_value(value); | |
6085 glVertexAttrib2f(index, v0, v1); | |
6086 } | 6090 } |
6087 | 6091 |
6088 void GLES2DecoderImpl::DoVertexAttrib3f( | 6092 void GLES2DecoderImpl::DoVertexAttrib3f( |
6089 GLuint index, GLfloat v0, GLfloat v1, GLfloat v2) { | 6093 GLuint index, GLfloat v0, GLfloat v1, GLfloat v2) { |
6090 VertexAttribManager::VertexAttribInfo* info = | 6094 GLfloat v[4] = { v0, v1, v2, 1.0f, }; |
6091 state_.vertex_attrib_manager->GetVertexAttribInfo(index); | 6095 if (SetVertexAttribValue("glVertexAttrib3f", index, v)) { |
6092 if (!info) { | 6096 glVertexAttrib3f(index, v0, v1, v2); |
6093 SetGLError(GL_INVALID_VALUE, "glVertexAttrib3f", "index out of range"); | |
6094 return; | |
6095 } | 6097 } |
6096 VertexAttribManager::VertexAttribInfo::Vec4 value; | |
6097 value.v[0] = v0; | |
6098 value.v[1] = v1; | |
6099 value.v[2] = v2; | |
6100 value.v[3] = 1.0f; | |
6101 info->set_value(value); | |
6102 glVertexAttrib3f(index, v0, v1, v2); | |
6103 } | 6098 } |
6104 | 6099 |
6105 void GLES2DecoderImpl::DoVertexAttrib4f( | 6100 void GLES2DecoderImpl::DoVertexAttrib4f( |
6106 GLuint index, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) { | 6101 GLuint index, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) { |
6107 VertexAttribManager::VertexAttribInfo* info = | 6102 GLfloat v[4] = { v0, v1, v2, v3, }; |
6108 state_.vertex_attrib_manager->GetVertexAttribInfo(index); | 6103 if (SetVertexAttribValue("glVertexAttrib4f", index, v)) { |
6109 if (!info) { | 6104 glVertexAttrib4f(index, v0, v1, v2, v3); |
6110 SetGLError(GL_INVALID_VALUE, "glVertexAttrib4f", "index out of range"); | |
6111 return; | |
6112 } | 6105 } |
6113 VertexAttribManager::VertexAttribInfo::Vec4 value; | |
6114 value.v[0] = v0; | |
6115 value.v[1] = v1; | |
6116 value.v[2] = v2; | |
6117 value.v[3] = v3; | |
6118 info->set_value(value); | |
6119 glVertexAttrib4f(index, v0, v1, v2, v3); | |
6120 } | 6106 } |
6121 | 6107 |
6122 void GLES2DecoderImpl::DoVertexAttrib1fv(GLuint index, const GLfloat* v) { | 6108 void GLES2DecoderImpl::DoVertexAttrib1fv(GLuint index, const GLfloat* v) { |
6123 VertexAttribManager::VertexAttribInfo* info = | 6109 GLfloat t[4] = { v[0], 0.0f, 0.0f, 1.0f, }; |
6124 state_.vertex_attrib_manager->GetVertexAttribInfo(index); | 6110 if (SetVertexAttribValue("glVertexAttrib1fv", index, t)) { |
6125 if (!info) { | 6111 glVertexAttrib1fv(index, v); |
6126 SetGLError(GL_INVALID_VALUE, "glVertexAttrib1fv", "index out of range"); | |
6127 return; | |
6128 } | 6112 } |
6129 VertexAttribManager::VertexAttribInfo::Vec4 value; | |
6130 value.v[0] = v[0]; | |
6131 value.v[1] = 0.0f; | |
6132 value.v[2] = 0.0f; | |
6133 value.v[3] = 1.0f; | |
6134 info->set_value(value); | |
6135 glVertexAttrib1fv(index, v); | |
6136 } | 6113 } |
6137 | 6114 |
6138 void GLES2DecoderImpl::DoVertexAttrib2fv(GLuint index, const GLfloat* v) { | 6115 void GLES2DecoderImpl::DoVertexAttrib2fv(GLuint index, const GLfloat* v) { |
6139 VertexAttribManager::VertexAttribInfo* info = | 6116 GLfloat t[4] = { v[0], v[1], 0.0f, 1.0f, }; |
6140 state_.vertex_attrib_manager->GetVertexAttribInfo(index); | 6117 if (SetVertexAttribValue("glVertexAttrib2fv", index, t)) { |
6141 if (!info) { | 6118 glVertexAttrib2fv(index, v); |
6142 SetGLError(GL_INVALID_VALUE, "glVertexAttrib2fv", "index out of range"); | |
6143 return; | |
6144 } | 6119 } |
6145 VertexAttribManager::VertexAttribInfo::Vec4 value; | |
6146 value.v[0] = v[0]; | |
6147 value.v[1] = v[1]; | |
6148 value.v[2] = 0.0f; | |
6149 value.v[3] = 1.0f; | |
6150 info->set_value(value); | |
6151 glVertexAttrib2fv(index, v); | |
6152 } | 6120 } |
6153 | 6121 |
6154 void GLES2DecoderImpl::DoVertexAttrib3fv(GLuint index, const GLfloat* v) { | 6122 void GLES2DecoderImpl::DoVertexAttrib3fv(GLuint index, const GLfloat* v) { |
6155 VertexAttribManager::VertexAttribInfo* info = | 6123 GLfloat t[4] = { v[0], v[1], v[2], 1.0f, }; |
6156 state_.vertex_attrib_manager->GetVertexAttribInfo(index); | 6124 if (SetVertexAttribValue("glVertexAttrib3fv", index, t)) { |
6157 if (!info) { | 6125 glVertexAttrib3fv(index, v); |
6158 SetGLError(GL_INVALID_VALUE, "glVertexAttrib3fv", "index out of range"); | |
6159 return; | |
6160 } | 6126 } |
6161 VertexAttribManager::VertexAttribInfo::Vec4 value; | |
6162 value.v[0] = v[0]; | |
6163 value.v[1] = v[1]; | |
6164 value.v[2] = v[2]; | |
6165 value.v[3] = 1.0f; | |
6166 info->set_value(value); | |
6167 glVertexAttrib3fv(index, v); | |
6168 } | 6127 } |
6169 | 6128 |
6170 void GLES2DecoderImpl::DoVertexAttrib4fv(GLuint index, const GLfloat* v) { | 6129 void GLES2DecoderImpl::DoVertexAttrib4fv(GLuint index, const GLfloat* v) { |
6171 VertexAttribManager::VertexAttribInfo* info = | 6130 if (SetVertexAttribValue("glVertexAttrib4fv", index, v)) { |
6172 state_.vertex_attrib_manager->GetVertexAttribInfo(index); | 6131 glVertexAttrib4fv(index, v); |
6173 if (!info) { | |
6174 SetGLError(GL_INVALID_VALUE, "glVertexAttrib4fv", "index out of range"); | |
6175 return; | |
6176 } | 6132 } |
6177 VertexAttribManager::VertexAttribInfo::Vec4 value; | |
6178 value.v[0] = v[0]; | |
6179 value.v[1] = v[1]; | |
6180 value.v[2] = v[2]; | |
6181 value.v[3] = v[3]; | |
6182 info->set_value(value); | |
6183 glVertexAttrib4fv(index, v); | |
6184 } | 6133 } |
6185 | 6134 |
6186 error::Error GLES2DecoderImpl::HandleVertexAttribPointer( | 6135 error::Error GLES2DecoderImpl::HandleVertexAttribPointer( |
6187 uint32 immediate_data_size, const gles2::VertexAttribPointer& c) { | 6136 uint32 immediate_data_size, const gles2::VertexAttribPointer& c) { |
6188 | 6137 |
6189 if (!state_.bound_array_buffer || state_.bound_array_buffer->IsDeleted()) { | 6138 if (!state_.bound_array_buffer || state_.bound_array_buffer->IsDeleted()) { |
6190 if (state_.vertex_attrib_manager == default_vertex_attrib_manager_) { | 6139 if (state_.vertex_attrib_manager == default_vertex_attrib_manager_) { |
6191 SetGLError(GL_INVALID_VALUE, | 6140 SetGLError(GL_INVALID_VALUE, |
6192 "glVertexAttribPointer", "no array buffer bound"); | 6141 "glVertexAttribPointer", "no array buffer bound"); |
6193 return error::kNoError; | 6142 return error::kNoError; |
(...skipping 3171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9365 gpu_trace_stack_.pop(); | 9314 gpu_trace_stack_.pop(); |
9366 } | 9315 } |
9367 | 9316 |
9368 // Include the auto-generated part of this file. We split this because it means | 9317 // Include the auto-generated part of this file. We split this because it means |
9369 // we can easily edit the non-auto generated parts right here in this file | 9318 // we can easily edit the non-auto generated parts right here in this file |
9370 // instead of having to edit some template or the code generator. | 9319 // instead of having to edit some template or the code generator. |
9371 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 9320 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
9372 | 9321 |
9373 } // namespace gles2 | 9322 } // namespace gles2 |
9374 } // namespace gpu | 9323 } // namespace gpu |
OLD | NEW |