vbo: fold code from vbo_exec_fixup_vertex to vbo_exec_wrap_upgrade_vertex

Reviewed-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4052>
This commit is contained in:
Marek Olšák 2020-02-27 15:43:55 -05:00
parent 8205042be6
commit 9c9c314e41
1 changed files with 6 additions and 5 deletions

View File

@ -240,7 +240,7 @@ vbo_exec_copy_to_current(struct vbo_exec_context *exec)
*/
static void
vbo_exec_wrap_upgrade_vertex(struct vbo_exec_context *exec,
GLuint attr, GLuint newSize)
GLuint attr, GLuint newSize, GLenum newType)
{
struct gl_context *ctx = exec->ctx;
struct vbo_context *vbo = vbo_context(ctx);
@ -278,6 +278,8 @@ vbo_exec_wrap_upgrade_vertex(struct vbo_exec_context *exec,
/* Fix up sizes:
*/
exec->vtx.attr[attr].size = newSize;
exec->vtx.attr[attr].active_size = newSize;
exec->vtx.attr[attr].type = newType;
exec->vtx.vertex_size += newSize - oldSize;
exec->vtx.vertex_size_no_pos = exec->vtx.vertex_size - exec->vtx.attr[0].size;
exec->vtx.max_vert = vbo_compute_max_verts(exec);
@ -411,7 +413,7 @@ vbo_exec_fixup_vertex(struct gl_context *ctx, GLuint attr,
/* New size is larger. Need to flush existing vertices and get
* an enlarged vertex format.
*/
vbo_exec_wrap_upgrade_vertex(exec, attr, newSize);
vbo_exec_wrap_upgrade_vertex(exec, attr, newSize, newType);
}
else if (newSize < exec->vtx.attr[attr].active_size) {
GLuint i;
@ -423,10 +425,9 @@ vbo_exec_fixup_vertex(struct gl_context *ctx, GLuint attr,
*/
for (i = newSize; i <= exec->vtx.attr[attr].size; i++)
exec->vtx.attrptr[attr][i-1] = id[i-1];
}
exec->vtx.attr[attr].active_size = newSize;
exec->vtx.attr[attr].type = newType;
exec->vtx.attr[attr].active_size = newSize;
}
}