mesa: Add a vao parameter to get_vertex_array_attrib

This is needed to implement glGetVertexArrayIndexediv and
glGetVertexArrayIndexed64iv.

v2: Make the vao parameter const.

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
This commit is contained in:
Fredrik Höglund 2015-03-02 18:58:36 +01:00
parent 1085c01121
commit 4f5160300d

View file

@ -851,10 +851,11 @@ _mesa_DisableVertexArrayAttrib(GLuint vaobj, GLuint index)
* not handle the 4-element GL_CURRENT_VERTEX_ATTRIB_ARB query.
*/
static GLuint
get_vertex_array_attrib(struct gl_context *ctx, GLuint index, GLenum pname,
const char *caller)
get_vertex_array_attrib(struct gl_context *ctx,
const struct gl_vertex_array_object *vao,
GLuint index, GLenum pname,
const char *caller)
{
const struct gl_vertex_array_object *vao = ctx->Array.VAO;
const struct gl_vertex_attrib_array *array;
if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) {
@ -945,7 +946,8 @@ _mesa_GetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
}
}
else {
params[0] = (GLfloat) get_vertex_array_attrib(ctx, index, pname,
params[0] = (GLfloat) get_vertex_array_attrib(ctx, ctx->Array.VAO,
index, pname,
"glGetVertexAttribfv");
}
}
@ -966,7 +968,8 @@ _mesa_GetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params)
}
}
else {
params[0] = (GLdouble) get_vertex_array_attrib(ctx, index, pname,
params[0] = (GLdouble) get_vertex_array_attrib(ctx, ctx->Array.VAO,
index, pname,
"glGetVertexAttribdv");
}
}
@ -986,7 +989,8 @@ _mesa_GetVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params)
}
}
else {
params[0] = (GLdouble) get_vertex_array_attrib(ctx, index, pname,
params[0] = (GLdouble) get_vertex_array_attrib(ctx, ctx->Array.VAO,
index, pname,
"glGetVertexAttribLdv");
}
}
@ -1007,7 +1011,8 @@ _mesa_GetVertexAttribiv(GLuint index, GLenum pname, GLint *params)
}
}
else {
params[0] = (GLint) get_vertex_array_attrib(ctx, index, pname,
params[0] = (GLint) get_vertex_array_attrib(ctx, ctx->Array.VAO,
index, pname,
"glGetVertexAttribiv");
}
}
@ -1027,7 +1032,8 @@ _mesa_GetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
}
}
else {
params[0] = (GLint) get_vertex_array_attrib(ctx, index, pname,
params[0] = (GLint) get_vertex_array_attrib(ctx, ctx->Array.VAO,
index, pname,
"glGetVertexAttribIiv");
}
}
@ -1047,7 +1053,8 @@ _mesa_GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
}
}
else {
params[0] = get_vertex_array_attrib(ctx, index, pname,
params[0] = get_vertex_array_attrib(ctx, ctx->Array.VAO,
index, pname,
"glGetVertexAttribIuiv");
}
}