| 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 <cmath> | 10 #include <cmath> |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 return gfx::OVERLAY_TRANSFORM_ROTATE_90; | 166 return gfx::OVERLAY_TRANSFORM_ROTATE_90; |
| 167 case GL_OVERLAY_TRANSFORM_ROTATE_180_CHROMIUM: | 167 case GL_OVERLAY_TRANSFORM_ROTATE_180_CHROMIUM: |
| 168 return gfx::OVERLAY_TRANSFORM_ROTATE_180; | 168 return gfx::OVERLAY_TRANSFORM_ROTATE_180; |
| 169 case GL_OVERLAY_TRANSFORM_ROTATE_270_CHROMIUM: | 169 case GL_OVERLAY_TRANSFORM_ROTATE_270_CHROMIUM: |
| 170 return gfx::OVERLAY_TRANSFORM_ROTATE_270; | 170 return gfx::OVERLAY_TRANSFORM_ROTATE_270; |
| 171 default: | 171 default: |
| 172 return gfx::OVERLAY_TRANSFORM_INVALID; | 172 return gfx::OVERLAY_TRANSFORM_INVALID; |
| 173 } | 173 } |
| 174 } | 174 } |
| 175 | 175 |
| 176 struct Vec4f { |
| 177 explicit Vec4f(const Vec4& data) { |
| 178 data.GetValues(v); |
| 179 } |
| 180 |
| 181 GLfloat v[4]; |
| 182 }; |
| 183 |
| 176 } // namespace | 184 } // namespace |
| 177 | 185 |
| 178 class GLES2DecoderImpl; | 186 class GLES2DecoderImpl; |
| 179 | 187 |
| 180 // Local versions of the SET_GL_ERROR macros | 188 // Local versions of the SET_GL_ERROR macros |
| 181 #define LOCAL_SET_GL_ERROR(error, function_name, msg) \ | 189 #define LOCAL_SET_GL_ERROR(error, function_name, msg) \ |
| 182 ERRORSTATE_SET_GL_ERROR(state_.GetErrorState(), error, function_name, msg) | 190 ERRORSTATE_SET_GL_ERROR(state_.GetErrorState(), error, function_name, msg) |
| 183 #define LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, value, label) \ | 191 #define LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, value, label) \ |
| 184 ERRORSTATE_SET_GL_ERROR_INVALID_ENUM(state_.GetErrorState(), \ | 192 ERRORSTATE_SET_GL_ERROR_INVALID_ENUM(state_.GetErrorState(), \ |
| 185 function_name, value, label) | 193 function_name, value, label) |
| (...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1465 | 1473 |
| 1466 // Wrapper for glGetShaderiv | 1474 // Wrapper for glGetShaderiv |
| 1467 void DoGetShaderiv(GLuint shader, GLenum pname, GLint* params); | 1475 void DoGetShaderiv(GLuint shader, GLenum pname, GLint* params); |
| 1468 | 1476 |
| 1469 // Wrappers for glGetTexParameter. | 1477 // Wrappers for glGetTexParameter. |
| 1470 void DoGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params); | 1478 void DoGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params); |
| 1471 void DoGetTexParameteriv(GLenum target, GLenum pname, GLint* params); | 1479 void DoGetTexParameteriv(GLenum target, GLenum pname, GLint* params); |
| 1472 void InitTextureMaxAnisotropyIfNeeded(GLenum target, GLenum pname); | 1480 void InitTextureMaxAnisotropyIfNeeded(GLenum target, GLenum pname); |
| 1473 | 1481 |
| 1474 // Wrappers for glGetVertexAttrib. | 1482 // Wrappers for glGetVertexAttrib. |
| 1475 void DoGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params); | 1483 template <typename T> |
| 1476 void DoGetVertexAttribiv(GLuint index, GLenum pname, GLint *params); | 1484 void DoGetVertexAttribImpl(GLuint index, GLenum pname, T* params); |
| 1485 void DoGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params); |
| 1486 void DoGetVertexAttribiv(GLuint index, GLenum pname, GLint* params); |
| 1487 void DoGetVertexAttribIiv(GLuint index, GLenum pname, GLint* params); |
| 1488 void DoGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params); |
| 1477 | 1489 |
| 1478 // Wrappers for glIsXXX functions. | 1490 // Wrappers for glIsXXX functions. |
| 1479 bool DoIsEnabled(GLenum cap); | 1491 bool DoIsEnabled(GLenum cap); |
| 1480 bool DoIsBuffer(GLuint client_id); | 1492 bool DoIsBuffer(GLuint client_id); |
| 1481 bool DoIsFramebuffer(GLuint client_id); | 1493 bool DoIsFramebuffer(GLuint client_id); |
| 1482 bool DoIsProgram(GLuint client_id); | 1494 bool DoIsProgram(GLuint client_id); |
| 1483 bool DoIsRenderbuffer(GLuint client_id); | 1495 bool DoIsRenderbuffer(GLuint client_id); |
| 1484 bool DoIsShader(GLuint client_id); | 1496 bool DoIsShader(GLuint client_id); |
| 1485 bool DoIsTexture(GLuint client_id); | 1497 bool DoIsTexture(GLuint client_id); |
| 1486 bool DoIsVertexArrayOES(GLuint client_id); | 1498 bool DoIsVertexArrayOES(GLuint client_id); |
| (...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2459 gpu_decoder_category_(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED( | 2471 gpu_decoder_category_(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED( |
| 2460 TRACE_DISABLED_BY_DEFAULT("gpu_decoder"))), | 2472 TRACE_DISABLED_BY_DEFAULT("gpu_decoder"))), |
| 2461 gpu_trace_level_(2), | 2473 gpu_trace_level_(2), |
| 2462 gpu_trace_commands_(false), | 2474 gpu_trace_commands_(false), |
| 2463 gpu_debug_commands_(false), | 2475 gpu_debug_commands_(false), |
| 2464 validation_texture_(0), | 2476 validation_texture_(0), |
| 2465 validation_fbo_multisample_(0), | 2477 validation_fbo_multisample_(0), |
| 2466 validation_fbo_(0) { | 2478 validation_fbo_(0) { |
| 2467 DCHECK(group); | 2479 DCHECK(group); |
| 2468 | 2480 |
| 2469 attrib_0_value_.v[0] = 0.0f; | |
| 2470 attrib_0_value_.v[1] = 0.0f; | |
| 2471 attrib_0_value_.v[2] = 0.0f; | |
| 2472 attrib_0_value_.v[3] = 1.0f; | |
| 2473 | |
| 2474 // The shader translator is used for WebGL even when running on EGL | 2481 // The shader translator is used for WebGL even when running on EGL |
| 2475 // because additional restrictions are needed (like only enabling | 2482 // because additional restrictions are needed (like only enabling |
| 2476 // GL_OES_standard_derivatives on demand). It is used for the unit | 2483 // GL_OES_standard_derivatives on demand). It is used for the unit |
| 2477 // tests because GLES2DecoderWithShaderTest.GetShaderInfoLogValidArgs passes | 2484 // tests because GLES2DecoderWithShaderTest.GetShaderInfoLogValidArgs passes |
| 2478 // the empty string to CompileShader and this is not a valid shader. | 2485 // the empty string to CompileShader and this is not a valid shader. |
| 2479 if (gfx::GetGLImplementation() == gfx::kGLImplementationMockGL || | 2486 if (gfx::GetGLImplementation() == gfx::kGLImplementationMockGL || |
| 2480 base::CommandLine::ForCurrentProcess()->HasSwitch( | 2487 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 2481 switches::kDisableGLSLTranslator)) { | 2488 switches::kDisableGLSLTranslator)) { |
| 2482 use_shader_translator_ = false; | 2489 use_shader_translator_ = false; |
| 2483 } | 2490 } |
| (...skipping 4361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6845 return true; | 6852 return true; |
| 6846 } | 6853 } |
| 6847 | 6854 |
| 6848 // Make a buffer with a single repeated vec4 value enough to | 6855 // Make a buffer with a single repeated vec4 value enough to |
| 6849 // simulate the constant value that is supposed to be here. | 6856 // simulate the constant value that is supposed to be here. |
| 6850 // This is required to emulate GLES2 on GL. | 6857 // This is required to emulate GLES2 on GL. |
| 6851 GLuint num_vertices = max_vertex_accessed + 1; | 6858 GLuint num_vertices = max_vertex_accessed + 1; |
| 6852 uint32 size_needed = 0; | 6859 uint32 size_needed = 0; |
| 6853 | 6860 |
| 6854 if (num_vertices == 0 || | 6861 if (num_vertices == 0 || |
| 6855 !SafeMultiplyUint32(num_vertices, sizeof(Vec4), &size_needed) || | 6862 !SafeMultiplyUint32(num_vertices, sizeof(Vec4f), &size_needed) || |
| 6856 size_needed > 0x7FFFFFFFU) { | 6863 size_needed > 0x7FFFFFFFU) { |
| 6857 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, function_name, "Simulating attrib 0"); | 6864 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, function_name, "Simulating attrib 0"); |
| 6858 return false; | 6865 return false; |
| 6859 } | 6866 } |
| 6860 | 6867 |
| 6861 LOCAL_PERFORMANCE_WARNING( | 6868 LOCAL_PERFORMANCE_WARNING( |
| 6862 "Attribute 0 is disabled. This has signficant performance penalty"); | 6869 "Attribute 0 is disabled. This has signficant performance penalty"); |
| 6863 | 6870 |
| 6864 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(function_name); | 6871 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(function_name); |
| 6865 glBindBuffer(GL_ARRAY_BUFFER, attrib_0_buffer_id_); | 6872 glBindBuffer(GL_ARRAY_BUFFER, attrib_0_buffer_id_); |
| 6866 | 6873 |
| 6867 bool new_buffer = static_cast<GLsizei>(size_needed) > attrib_0_size_; | 6874 bool new_buffer = static_cast<GLsizei>(size_needed) > attrib_0_size_; |
| 6868 if (new_buffer) { | 6875 if (new_buffer) { |
| 6869 glBufferData(GL_ARRAY_BUFFER, size_needed, NULL, GL_DYNAMIC_DRAW); | 6876 glBufferData(GL_ARRAY_BUFFER, size_needed, NULL, GL_DYNAMIC_DRAW); |
| 6870 GLenum error = glGetError(); | 6877 GLenum error = glGetError(); |
| 6871 if (error != GL_NO_ERROR) { | 6878 if (error != GL_NO_ERROR) { |
| 6872 LOCAL_SET_GL_ERROR( | 6879 LOCAL_SET_GL_ERROR( |
| 6873 GL_OUT_OF_MEMORY, function_name, "Simulating attrib 0"); | 6880 GL_OUT_OF_MEMORY, function_name, "Simulating attrib 0"); |
| 6874 return false; | 6881 return false; |
| 6875 } | 6882 } |
| 6876 } | 6883 } |
| 6877 | 6884 |
| 6878 const Vec4& value = state_.attrib_values[0]; | 6885 const Vec4& value = state_.attrib_values[0]; |
| 6879 if (new_buffer || | 6886 if (new_buffer || |
| 6880 (attrib_0_used && | 6887 (attrib_0_used && |
| 6881 (!attrib_0_buffer_matches_value_ || | 6888 (!attrib_0_buffer_matches_value_ || !value.Equal(attrib_0_value_)))){ |
| 6882 (value.v[0] != attrib_0_value_.v[0] || | 6889 // TODO(zmo): This is not 100% correct because we might lose data when |
| 6883 value.v[1] != attrib_0_value_.v[1] || | 6890 // casting to float type, but it is a corner case and once we migrate to |
| 6884 value.v[2] != attrib_0_value_.v[2] || | 6891 // core profiles on desktop GL, it is no longer relevant. |
| 6885 value.v[3] != attrib_0_value_.v[3])))) { | 6892 Vec4f fvalue(value); |
| 6886 std::vector<Vec4> temp(num_vertices, value); | 6893 std::vector<Vec4f> temp(num_vertices, fvalue); |
| 6887 glBufferSubData(GL_ARRAY_BUFFER, 0, size_needed, &temp[0].v[0]); | 6894 glBufferSubData(GL_ARRAY_BUFFER, 0, size_needed, &temp[0].v[0]); |
| 6888 attrib_0_buffer_matches_value_ = true; | 6895 attrib_0_buffer_matches_value_ = true; |
| 6889 attrib_0_value_ = value; | 6896 attrib_0_value_ = value; |
| 6890 attrib_0_size_ = size_needed; | 6897 attrib_0_size_ = size_needed; |
| 6891 } | 6898 } |
| 6892 | 6899 |
| 6893 glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, NULL); | 6900 glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, NULL); |
| 6894 | 6901 |
| 6895 if (attrib->divisor()) | 6902 if (attrib->divisor()) |
| 6896 glVertexAttribDivisorANGLE(0, 0); | 6903 glVertexAttribDivisorANGLE(0, 0); |
| (...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7589 program_client_id, "glValidateProgram"); | 7596 program_client_id, "glValidateProgram"); |
| 7590 if (!program) { | 7597 if (!program) { |
| 7591 return; | 7598 return; |
| 7592 } | 7599 } |
| 7593 program->Validate(); | 7600 program->Validate(); |
| 7594 } | 7601 } |
| 7595 | 7602 |
| 7596 void GLES2DecoderImpl::GetVertexAttribHelper( | 7603 void GLES2DecoderImpl::GetVertexAttribHelper( |
| 7597 const VertexAttrib* attrib, GLenum pname, GLint* params) { | 7604 const VertexAttrib* attrib, GLenum pname, GLint* params) { |
| 7598 switch (pname) { | 7605 switch (pname) { |
| 7599 case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: { | 7606 case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: |
| 7607 { |
| 7600 Buffer* buffer = attrib->buffer(); | 7608 Buffer* buffer = attrib->buffer(); |
| 7601 if (buffer && !buffer->IsDeleted()) { | 7609 if (buffer && !buffer->IsDeleted()) { |
| 7602 GLuint client_id; | 7610 GLuint client_id; |
| 7603 buffer_manager()->GetClientId(buffer->service_id(), &client_id); | 7611 buffer_manager()->GetClientId(buffer->service_id(), &client_id); |
| 7604 *params = client_id; | 7612 *params = client_id; |
| 7605 } | 7613 } |
| 7606 break; | 7614 break; |
| 7607 } | 7615 } |
| 7608 case GL_VERTEX_ATTRIB_ARRAY_ENABLED: | 7616 case GL_VERTEX_ATTRIB_ARRAY_ENABLED: |
| 7609 *params = attrib->enabled(); | 7617 *params = attrib->enabled(); |
| 7610 break; | 7618 break; |
| 7611 case GL_VERTEX_ATTRIB_ARRAY_SIZE: | 7619 case GL_VERTEX_ATTRIB_ARRAY_SIZE: |
| 7612 *params = attrib->size(); | 7620 *params = attrib->size(); |
| 7613 break; | 7621 break; |
| 7614 case GL_VERTEX_ATTRIB_ARRAY_STRIDE: | 7622 case GL_VERTEX_ATTRIB_ARRAY_STRIDE: |
| 7615 *params = attrib->gl_stride(); | 7623 *params = attrib->gl_stride(); |
| 7616 break; | 7624 break; |
| 7617 case GL_VERTEX_ATTRIB_ARRAY_TYPE: | 7625 case GL_VERTEX_ATTRIB_ARRAY_TYPE: |
| 7618 *params = attrib->type(); | 7626 *params = attrib->type(); |
| 7619 break; | 7627 break; |
| 7620 case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED: | 7628 case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED: |
| 7621 *params = attrib->normalized(); | 7629 *params = attrib->normalized(); |
| 7622 break; | 7630 break; |
| 7623 case GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: | 7631 case GL_VERTEX_ATTRIB_ARRAY_DIVISOR: |
| 7624 *params = attrib->divisor(); | 7632 *params = attrib->divisor(); |
| 7625 break; | 7633 break; |
| 7634 case GL_VERTEX_ATTRIB_ARRAY_INTEGER: |
| 7635 *params = attrib->integer(); |
| 7636 break; |
| 7626 default: | 7637 default: |
| 7627 NOTREACHED(); | 7638 NOTREACHED(); |
| 7628 break; | 7639 break; |
| 7629 } | 7640 } |
| 7630 } | 7641 } |
| 7631 | 7642 |
| 7632 void GLES2DecoderImpl::DoGetTexParameterfv( | 7643 void GLES2DecoderImpl::DoGetTexParameterfv( |
| 7633 GLenum target, GLenum pname, GLfloat* params) { | 7644 GLenum target, GLenum pname, GLfloat* params) { |
| 7634 InitTextureMaxAnisotropyIfNeeded(target, pname); | 7645 InitTextureMaxAnisotropyIfNeeded(target, pname); |
| 7635 glGetTexParameterfv(target, pname, params); | 7646 glGetTexParameterfv(target, pname, params); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 7655 if (!texture_ref) { | 7666 if (!texture_ref) { |
| 7656 LOCAL_SET_GL_ERROR( | 7667 LOCAL_SET_GL_ERROR( |
| 7657 GL_INVALID_OPERATION, | 7668 GL_INVALID_OPERATION, |
| 7658 "glGetTexParamter{fi}v", "unknown texture for target"); | 7669 "glGetTexParamter{fi}v", "unknown texture for target"); |
| 7659 return; | 7670 return; |
| 7660 } | 7671 } |
| 7661 Texture* texture = texture_ref->texture(); | 7672 Texture* texture = texture_ref->texture(); |
| 7662 texture->InitTextureMaxAnisotropyIfNeeded(target); | 7673 texture->InitTextureMaxAnisotropyIfNeeded(target); |
| 7663 } | 7674 } |
| 7664 | 7675 |
| 7665 void GLES2DecoderImpl::DoGetVertexAttribfv( | 7676 template <typename T> |
| 7666 GLuint index, GLenum pname, GLfloat* params) { | 7677 void GLES2DecoderImpl::DoGetVertexAttribImpl( |
| 7678 GLuint index, GLenum pname, T* params) { |
| 7667 VertexAttrib* attrib = state_.vertex_attrib_manager->GetVertexAttrib(index); | 7679 VertexAttrib* attrib = state_.vertex_attrib_manager->GetVertexAttrib(index); |
| 7668 if (!attrib) { | 7680 if (!attrib) { |
| 7669 LOCAL_SET_GL_ERROR( | 7681 LOCAL_SET_GL_ERROR( |
| 7670 GL_INVALID_VALUE, "glGetVertexAttribfv", "index out of range"); | 7682 GL_INVALID_VALUE, "glGetVertexAttrib", "index out of range"); |
| 7671 return; | 7683 return; |
| 7672 } | 7684 } |
| 7673 switch (pname) { | 7685 switch (pname) { |
| 7674 case GL_CURRENT_VERTEX_ATTRIB: { | 7686 case GL_CURRENT_VERTEX_ATTRIB: |
| 7675 const Vec4& value = state_.attrib_values[index]; | 7687 state_.attrib_values[index].GetValues(params); |
| 7676 params[0] = value.v[0]; | |
| 7677 params[1] = value.v[1]; | |
| 7678 params[2] = value.v[2]; | |
| 7679 params[3] = value.v[3]; | |
| 7680 break; | 7688 break; |
| 7681 } | |
| 7682 default: { | 7689 default: { |
| 7683 GLint value = 0; | 7690 GLint value = 0; |
| 7684 GetVertexAttribHelper(attrib, pname, &value); | 7691 GetVertexAttribHelper(attrib, pname, &value); |
| 7685 *params = static_cast<GLfloat>(value); | 7692 *params = static_cast<T>(value); |
| 7686 break; | 7693 break; |
| 7687 } | 7694 } |
| 7688 } | 7695 } |
| 7689 } | 7696 } |
| 7690 | 7697 |
| 7698 void GLES2DecoderImpl::DoGetVertexAttribfv( |
| 7699 GLuint index, GLenum pname, GLfloat* params) { |
| 7700 DoGetVertexAttribImpl<GLfloat>(index, pname, params); |
| 7701 } |
| 7702 |
| 7691 void GLES2DecoderImpl::DoGetVertexAttribiv( | 7703 void GLES2DecoderImpl::DoGetVertexAttribiv( |
| 7692 GLuint index, GLenum pname, GLint* params) { | 7704 GLuint index, GLenum pname, GLint* params) { |
| 7693 VertexAttrib* attrib = state_.vertex_attrib_manager->GetVertexAttrib(index); | 7705 DoGetVertexAttribImpl<GLint>(index, pname, params); |
| 7694 if (!attrib) { | 7706 } |
| 7695 LOCAL_SET_GL_ERROR( | 7707 |
| 7696 GL_INVALID_VALUE, "glGetVertexAttribiv", "index out of range"); | 7708 void GLES2DecoderImpl::DoGetVertexAttribIiv( |
| 7697 return; | 7709 GLuint index, GLenum pname, GLint* params) { |
| 7698 } | 7710 DoGetVertexAttribImpl<GLint>(index, pname, params); |
| 7699 switch (pname) { | 7711 } |
| 7700 case GL_CURRENT_VERTEX_ATTRIB: { | 7712 |
| 7701 const Vec4& value = state_.attrib_values[index]; | 7713 void GLES2DecoderImpl::DoGetVertexAttribIuiv( |
| 7702 params[0] = static_cast<GLint>(value.v[0]); | 7714 GLuint index, GLenum pname, GLuint* params) { |
| 7703 params[1] = static_cast<GLint>(value.v[1]); | 7715 DoGetVertexAttribImpl<GLuint>(index, pname, params); |
| 7704 params[2] = static_cast<GLint>(value.v[2]); | |
| 7705 params[3] = static_cast<GLint>(value.v[3]); | |
| 7706 break; | |
| 7707 } | |
| 7708 default: | |
| 7709 GetVertexAttribHelper(attrib, pname, params); | |
| 7710 break; | |
| 7711 } | |
| 7712 } | 7716 } |
| 7713 | 7717 |
| 7714 bool GLES2DecoderImpl::SetVertexAttribValue( | 7718 bool GLES2DecoderImpl::SetVertexAttribValue( |
| 7715 const char* function_name, GLuint index, const GLfloat* value) { | 7719 const char* function_name, GLuint index, const GLfloat* value) { |
| 7716 if (index >= state_.attrib_values.size()) { | 7720 if (index >= state_.attrib_values.size()) { |
| 7717 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "index out of range"); | 7721 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "index out of range"); |
| 7718 return false; | 7722 return false; |
| 7719 } | 7723 } |
| 7720 Vec4& v = state_.attrib_values[index]; | 7724 state_.attrib_values[index].SetValues(value); |
| 7721 v.v[0] = value[0]; | |
| 7722 v.v[1] = value[1]; | |
| 7723 v.v[2] = value[2]; | |
| 7724 v.v[3] = value[3]; | |
| 7725 return true; | 7725 return true; |
| 7726 } | 7726 } |
| 7727 | 7727 |
| 7728 void GLES2DecoderImpl::DoVertexAttrib1f(GLuint index, GLfloat v0) { | 7728 void GLES2DecoderImpl::DoVertexAttrib1f(GLuint index, GLfloat v0) { |
| 7729 GLfloat v[4] = { v0, 0.0f, 0.0f, 1.0f, }; | 7729 GLfloat v[4] = { v0, 0.0f, 0.0f, 1.0f, }; |
| 7730 if (SetVertexAttribValue("glVertexAttrib1f", index, v)) { | 7730 if (SetVertexAttribValue("glVertexAttrib1f", index, v)) { |
| 7731 glVertexAttrib1f(index, v0); | 7731 glVertexAttrib1f(index, v0); |
| 7732 } | 7732 } |
| 7733 } | 7733 } |
| 7734 | 7734 |
| (...skipping 5408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13143 } | 13143 } |
| 13144 } | 13144 } |
| 13145 | 13145 |
| 13146 // Include the auto-generated part of this file. We split this because it means | 13146 // Include the auto-generated part of this file. We split this because it means |
| 13147 // we can easily edit the non-auto generated parts right here in this file | 13147 // we can easily edit the non-auto generated parts right here in this file |
| 13148 // instead of having to edit some template or the code generator. | 13148 // instead of having to edit some template or the code generator. |
| 13149 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 13149 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 13150 | 13150 |
| 13151 } // namespace gles2 | 13151 } // namespace gles2 |
| 13152 } // namespace gpu | 13152 } // namespace gpu |
| OLD | NEW |