diff options
author | Brian Paul <[email protected]> | 2018-01-16 14:28:01 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2018-01-17 11:17:56 -0700 |
commit | 18f4241b89b9f9869c89a291e0ab1d54e6e74fbf (patch) | |
tree | eeb74a1fbc5ee49a6e929cf132ba6db9b04fb2c3 | |
parent | 5e8962b58f0d1791f45c0bd16fe87b457399780d (diff) |
vbo: add assertions, comments in vbo_exec_api.c
Reviewed-by: Ian Romanick <[email protected]>
Reviewed-by: Roland Scheidegger <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
-rw-r--r-- | src/mesa/vbo/vbo_exec_api.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 019f986f0bb..800fac85c45 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -270,6 +270,7 @@ vbo_exec_copy_from_current(struct vbo_exec_context *exec) * to a larger one. Ex: glTexCoord2f -> glTexCoord4f. * We need to go back over the previous 2-component texcoords and insert * zero and one values. + * \param attr VBO_ATTRIB_x vertex attribute value */ static void vbo_exec_wrap_upgrade_vertex(struct vbo_exec_context *exec, @@ -283,6 +284,8 @@ vbo_exec_wrap_upgrade_vertex(struct vbo_exec_context *exec, const GLuint oldSize = exec->vtx.attrsz[attr]; GLuint i; + assert(attr < VBO_ATTRIB_MAX); + /* Run pipeline on current vertices, copy wrapped vertices * to exec->vtx.copied. */ @@ -401,6 +404,7 @@ vbo_exec_wrap_upgrade_vertex(struct vbo_exec_context *exec, * For example, we saw a bunch of glTexCoord2f() calls and now we got a * glTexCoord4f() call. We promote the array from size=2 to size=4. * \param newSize size of new vertex (number of 32-bit words). + * \param attr VBO_ATTRIB_x vertex attribute value */ static void vbo_exec_fixup_vertex(struct gl_context *ctx, GLuint attr, @@ -408,6 +412,8 @@ vbo_exec_fixup_vertex(struct gl_context *ctx, GLuint attr, { struct vbo_exec_context *exec = &vbo_context(ctx)->exec; + assert(attr < VBO_ATTRIB_MAX); + if (newSize > exec->vtx.attrsz[attr] || newType != exec->vtx.attrtype[attr]) { /* New size is larger. Need to flush existing vertices and get @@ -459,7 +465,7 @@ vbo_exec_begin_vertices(struct gl_context *ctx) /** * This macro is used to implement all the glVertex, glColor, glTexCoord, * glVertexAttrib, etc functions. - * \param A attribute index + * \param A VBO_ATTRIB_x attribute index * \param N attribute size (1..4) * \param T type (GL_FLOAT, GL_DOUBLE, GL_INT, GL_UNSIGNED_INT) * \param C cast type (fi_type or double) |