From 55419eba6c1682bcf5315630548cd31376106780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20Fr=C3=B6hlich?= Date: Sat, 16 Jul 2016 08:35:05 +0200 Subject: [PATCH] Asserts that should bring us closer to the root cause. --- src/mesa/vbo/vbo_exec_api.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 32f15db..42dbd76 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -307,6 +307,9 @@ vbo_exec_wrap_upgrade_vertex(struct vbo_exec_context *exec, reset_attrfv( exec ); } + /* Downgrading should only happen with reset_attrfv() right? */ + assert(oldSize <= newSize); + assert(0 < newSize); /* Fix up sizes: */ exec->vtx.attrsz[attr] = newSize; @@ -402,6 +405,11 @@ vbo_exec_fixup_vertex(struct gl_context *ctx, GLuint attr, { struct vbo_exec_context *exec = &vbo_context(ctx)->exec; + /* Question: Also call vbo_exec_wrap_upgrade_vertex on changed types? + * Since newType is not even handed over to vbo_exec_wrap_upgrade_vertex, + * how would a changed type affect the new vertex? + * May be we need to handle the newType case differently. + */ if (newSize > exec->vtx.attrsz[attr] || newType != exec->vtx.attrtype[attr]) { /* New size is larger. Need to flush existing vertices and get @@ -422,6 +430,7 @@ vbo_exec_fixup_vertex(struct gl_context *ctx, GLuint attr, } exec->vtx.active_sz[attr] = newSize; + assert(exec->vtx.active_sz[attr] <= exec->vtx.attrsz[attr]); /* Does setting NeedFlush belong here? Necessitates resetting * vtxfmt on each flush (otherwise flags won't get reset -- 2.5.5