summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/varray.c
diff options
context:
space:
mode:
authorFredrik Höglund <fredrik@kde.org>2015-03-02 18:27:58 +0100
committerFredrik Höglund <fredrik@kde.org>2015-05-08 15:31:02 +0200
commitc99efbd3c2d496dc7e62adf11ab56b7eb006bbc3 (patch)
treea74b8dd83abbb4464a1f0cba56c51b2caa42ef03 /src/mesa/main/varray.c
parent96b646346372ec0e2b9336ef26e0d2a084b69400 (diff)
downloadexternal_mesa3d-c99efbd3c2d496dc7e62adf11ab56b7eb006bbc3.zip
external_mesa3d-c99efbd3c2d496dc7e62adf11ab56b7eb006bbc3.tar.gz
external_mesa3d-c99efbd3c2d496dc7e62adf11ab56b7eb006bbc3.tar.bz2
mesa: Implement EnableVertexArrayAttrib
Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
Diffstat (limited to 'src/mesa/main/varray.c')
-rw-r--r--src/mesa/main/varray.c46
1 files changed, 37 insertions, 9 deletions
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index b5370a8..06b1cbb 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -718,20 +718,18 @@ _mesa_VertexAttribLPointer(GLuint index, GLint size, GLenum type,
size, type, stride, GL_TRUE, GL_FALSE, GL_TRUE, ptr);
}
-void GLAPIENTRY
-_mesa_EnableVertexAttribArray(GLuint index)
-{
- struct gl_vertex_array_object *vao;
- GET_CURRENT_CONTEXT(ctx);
+static void
+enable_vertex_array_attrib(struct gl_context *ctx,
+ struct gl_vertex_array_object *vao,
+ GLuint index,
+ const char *func)
+{
if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glEnableVertexAttribArrayARB(index)");
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s(index)", func);
return;
}
- vao = ctx->Array.VAO;
-
assert(VERT_ATTRIB_GENERIC(index) < ARRAY_SIZE(vao->VertexAttrib));
if (!vao->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled) {
@@ -744,6 +742,36 @@ _mesa_EnableVertexAttribArray(GLuint index)
}
+void GLAPIENTRY
+_mesa_EnableVertexAttribArray(GLuint index)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ enable_vertex_array_attrib(ctx, ctx->Array.VAO, index,
+ "glEnableVertexAttribArray");
+}
+
+
+void GLAPIENTRY
+_mesa_EnableVertexArrayAttrib(GLuint vaobj, GLuint index)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_vertex_array_object *vao;
+
+ /* The ARB_direct_state_access specification says:
+ *
+ * "An INVALID_OPERATION error is generated by EnableVertexArrayAttrib
+ * and DisableVertexArrayAttrib if <vaobj> is not
+ * [compatibility profile: zero or] the name of an existing vertex
+ * array object."
+ */
+ vao = _mesa_lookup_vao_err(ctx, vaobj, "glEnableVertexArrayAttrib");
+ if (!vao)
+ return;
+
+ enable_vertex_array_attrib(ctx, vao, index, "glEnableVertexArrayAttrib");
+}
+
+
static void
disable_vertex_array_attrib(struct gl_context *ctx,
struct gl_vertex_array_object *vao,