aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2020-02-03 19:43:42 -0500
committerMarge Bot <[email protected]>2020-02-11 00:34:57 +0000
commit7575a0a25120b9637d50fcf2b55a4859b505f781 (patch)
tree483470653384f621ad7df6ab2fc703308945e39e /src/mesa
parentee5bd8638bd123ab3ea49d513f8bba9e7cd4ae28 (diff)
vbo: clean up resetting vertex attribs
Reviewed-by: Mathias Fröhlich <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3766>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/vbo/vbo_exec_api.c52
1 files changed, 19 insertions, 33 deletions
diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c
index 1d59f38bb28..9d048363782 100644
--- a/src/mesa/vbo/vbo_exec_api.c
+++ b/src/mesa/vbo/vbo_exec_api.c
@@ -1011,11 +1011,27 @@ vbo_use_buffer_objects(struct gl_context *ctx)
}
+static void
+vbo_reset_all_attr(struct vbo_exec_context *exec)
+{
+ while (exec->vtx.enabled) {
+ const int i = u_bit_scan64(&exec->vtx.enabled);
+
+ /* Reset the vertex attribute by setting its size to zero. */
+ exec->vtx.attr[i].size = 0;
+ exec->vtx.attr[i].type = GL_FLOAT;
+ exec->vtx.attr[i].active_size = 0;
+ exec->vtx.attrptr[i] = NULL;
+ }
+
+ exec->vtx.vertex_size = 0;
+}
+
+
void
vbo_exec_vtx_init(struct vbo_exec_context *exec)
{
struct gl_context *ctx = exec->ctx;
- GLuint i;
/* Allocate a buffer object. Will just reuse this object
* continuously, unless vbo_use_buffer_objects() is called to enable
@@ -1032,14 +1048,8 @@ vbo_exec_vtx_init(struct vbo_exec_context *exec)
vbo_exec_vtxfmt_init(exec);
_mesa_noop_vtxfmt_init(ctx, &exec->vtxfmt_noop);
- exec->vtx.enabled = 0;
- for (i = 0 ; i < ARRAY_SIZE(exec->vtx.attr); i++) {
- exec->vtx.attr[i].size = 0;
- exec->vtx.attr[i].type = GL_FLOAT;
- exec->vtx.attr[i].active_size = 0;
- }
-
- exec->vtx.vertex_size = 0;
+ exec->vtx.enabled = u_bit_consecutive64(0, VBO_ATTRIB_MAX); /* reset all */
+ vbo_reset_all_attr(exec);
}
@@ -1111,30 +1121,6 @@ vbo_exec_FlushVertices(struct gl_context *ctx, GLuint flags)
}
-/**
- * Reset the vertex attribute by setting its size to zero.
- */
-static void
-vbo_reset_attr(struct vbo_exec_context *exec, GLuint attr)
-{
- exec->vtx.attr[attr].size = 0;
- exec->vtx.attr[attr].type = GL_FLOAT;
- exec->vtx.attr[attr].active_size = 0;
-}
-
-
-static void
-vbo_reset_all_attr(struct vbo_exec_context *exec)
-{
- while (exec->vtx.enabled) {
- const int i = u_bit_scan64(&exec->vtx.enabled);
- vbo_reset_attr(exec, i);
- }
-
- exec->vtx.vertex_size = 0;
-}
-
-
void GLAPIENTRY
_es_Color4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
{