summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2015-11-03 16:16:00 -0800
committerIan Romanick <[email protected]>2015-11-24 11:31:29 -0800
commit4a644f1caadc6b3e26b5f0ac60ac855152e38e59 (patch)
treef4455159cc1455ac263de73da039e10bd7e298d2 /src/mesa
parenta336fcd36a4743c1ea6f8549cb31b48277359717 (diff)
mesa: Refactor enable_vertex_array_attrib to make _mesa_enable_vertex_array_attrib
Pulls the parts of enable_vertex_array_attrib that aren't just parameter validation out into a function that can be called from other parts of Mesa (e.g., meta). _mesa_enable_vertex_array_attrib can also be used to enable fixed-function arrays. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/varray.c26
-rw-r--r--src/mesa/main/varray.h5
2 files changed, 22 insertions, 9 deletions
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index e9f78e9bfe0..8836c182a41 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -770,6 +770,22 @@ _mesa_VertexAttribLPointer(GLuint index, GLint size, GLenum type,
}
+void
+_mesa_enable_vertex_array_attrib(struct gl_context *ctx,
+ struct gl_vertex_array_object *vao,
+ unsigned attrib)
+{
+ assert(attrib < ARRAY_SIZE(vao->VertexAttrib));
+
+ if (!vao->VertexAttrib[attrib].Enabled) {
+ /* was disabled, now being enabled */
+ FLUSH_VERTICES(ctx, _NEW_ARRAY);
+ vao->VertexAttrib[attrib].Enabled = GL_TRUE;
+ vao->_Enabled |= VERT_BIT(attrib);
+ vao->NewArrays |= VERT_BIT(attrib);
+ }
+}
+
static void
enable_vertex_array_attrib(struct gl_context *ctx,
struct gl_vertex_array_object *vao,
@@ -781,15 +797,7 @@ enable_vertex_array_attrib(struct gl_context *ctx,
return;
}
- assert(VERT_ATTRIB_GENERIC(index) < ARRAY_SIZE(vao->VertexAttrib));
-
- if (!vao->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled) {
- /* was disabled, now being enabled */
- FLUSH_VERTICES(ctx, _NEW_ARRAY);
- vao->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled = GL_TRUE;
- vao->_Enabled |= VERT_BIT_GENERIC(index);
- vao->NewArrays |= VERT_BIT_GENERIC(index);
- }
+ _mesa_enable_vertex_array_attrib(ctx, vao, VERT_ATTRIB_GENERIC(index));
}
diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h
index 744b3365127..a766afad5bc 100644
--- a/src/mesa/main/varray.h
+++ b/src/mesa/main/varray.h
@@ -99,6 +99,11 @@ _mesa_update_array_format(struct gl_context *ctx,
GLuint relativeOffset, bool flush_vertices);
extern void
+_mesa_enable_vertex_array_attrib(struct gl_context *ctx,
+ struct gl_vertex_array_object *vao,
+ unsigned attrib);
+
+extern void
_mesa_bind_vertex_buffer(struct gl_context *ctx,
struct gl_vertex_array_object *vao,
GLuint index,