Index: gpu/command_buffer/service/gles2_cmd_decoder.cc |
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
index 97429d8b0c8405d59c03ab5ab403b0d1a9a72728..cce84e2435e0d26c982fc799057d5f86124593b3 100644 |
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
@@ -1472,8 +1472,12 @@ class GLES2DecoderImpl : public GLES2Decoder, |
void InitTextureMaxAnisotropyIfNeeded(GLenum target, GLenum pname); |
// Wrappers for glGetVertexAttrib. |
- void DoGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params); |
- void DoGetVertexAttribiv(GLuint index, GLenum pname, GLint *params); |
+ template <typename T> |
+ void DoGetVertexAttribImpl(GLuint index, GLenum pname, T* params); |
+ void DoGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params); |
+ void DoGetVertexAttribiv(GLuint index, GLenum pname, GLint* params); |
+ void DoGetVertexAttribIiv(GLuint index, GLenum pname, GLint* params); |
+ void DoGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params); |
// Wrappers for glIsXXX functions. |
bool DoIsEnabled(GLenum cap); |
@@ -7592,7 +7596,8 @@ void GLES2DecoderImpl::DoValidateProgram(GLuint program_client_id) { |
void GLES2DecoderImpl::GetVertexAttribHelper( |
const VertexAttrib* attrib, GLenum pname, GLint* params) { |
switch (pname) { |
- case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: { |
+ case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: |
+ { |
Buffer* buffer = attrib->buffer(); |
if (buffer && !buffer->IsDeleted()) { |
GLuint client_id; |
@@ -7616,9 +7621,12 @@ void GLES2DecoderImpl::GetVertexAttribHelper( |
case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED: |
*params = attrib->normalized(); |
break; |
- case GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: |
+ case GL_VERTEX_ATTRIB_ARRAY_DIVISOR: |
*params = attrib->divisor(); |
break; |
+ case GL_VERTEX_ATTRIB_ARRAY_INTEGER: |
+ *params = attrib->integer(); |
+ break; |
default: |
NOTREACHED(); |
break; |
@@ -7658,53 +7666,51 @@ void GLES2DecoderImpl::InitTextureMaxAnisotropyIfNeeded( |
texture->InitTextureMaxAnisotropyIfNeeded(target); |
} |
-void GLES2DecoderImpl::DoGetVertexAttribfv( |
- GLuint index, GLenum pname, GLfloat* params) { |
+template <typename T> |
+void GLES2DecoderImpl::DoGetVertexAttribImpl( |
+ GLuint index, GLenum pname, T* params) { |
VertexAttrib* attrib = state_.vertex_attrib_manager->GetVertexAttrib(index); |
if (!attrib) { |
LOCAL_SET_GL_ERROR( |
- GL_INVALID_VALUE, "glGetVertexAttribfv", "index out of range"); |
+ GL_INVALID_VALUE, "glGetVertexAttrib", "index out of range"); |
return; |
} |
switch (pname) { |
case GL_CURRENT_VERTEX_ATTRIB: { |
const Vec4& value = state_.attrib_values[index]; |
- params[0] = value.v[0]; |
- params[1] = value.v[1]; |
- params[2] = value.v[2]; |
- params[3] = value.v[3]; |
+ params[0] = static_cast<T>(value.v[0]); |
+ params[1] = static_cast<T>(value.v[1]); |
+ params[2] = static_cast<T>(value.v[2]); |
+ params[3] = static_cast<T>(value.v[3]); |
break; |
} |
default: { |
GLint value = 0; |
GetVertexAttribHelper(attrib, pname, &value); |
- *params = static_cast<GLfloat>(value); |
+ *params = static_cast<T>(value); |
break; |
} |
} |
} |
+void GLES2DecoderImpl::DoGetVertexAttribfv( |
+ GLuint index, GLenum pname, GLfloat* params) { |
+ DoGetVertexAttribImpl<GLfloat>(index, pname, params); |
+} |
+ |
void GLES2DecoderImpl::DoGetVertexAttribiv( |
GLuint index, GLenum pname, GLint* params) { |
- VertexAttrib* attrib = state_.vertex_attrib_manager->GetVertexAttrib(index); |
- if (!attrib) { |
- LOCAL_SET_GL_ERROR( |
- GL_INVALID_VALUE, "glGetVertexAttribiv", "index out of range"); |
- return; |
- } |
- switch (pname) { |
- case GL_CURRENT_VERTEX_ATTRIB: { |
- const Vec4& value = state_.attrib_values[index]; |
- params[0] = static_cast<GLint>(value.v[0]); |
- params[1] = static_cast<GLint>(value.v[1]); |
- params[2] = static_cast<GLint>(value.v[2]); |
- params[3] = static_cast<GLint>(value.v[3]); |
- break; |
- } |
- default: |
- GetVertexAttribHelper(attrib, pname, params); |
- break; |
- } |
+ DoGetVertexAttribImpl<GLint>(index, pname, params); |
+} |
+ |
+void GLES2DecoderImpl::DoGetVertexAttribIiv( |
+ GLuint index, GLenum pname, GLint* params) { |
+ DoGetVertexAttribImpl<GLint>(index, pname, params); |
piman
2015/05/11 21:12:50
So, this is not quite right. DoVertexAttribI4i and
Zhenyao Mo
2015/05/12 23:57:45
per our discussion, use double as internal represe
|
+} |
+ |
+void GLES2DecoderImpl::DoGetVertexAttribIuiv( |
+ GLuint index, GLenum pname, GLuint* params) { |
+ DoGetVertexAttribImpl<GLuint>(index, pname, params); |
} |
bool GLES2DecoderImpl::SetVertexAttribValue( |