From: Marek Olšák Date: Thu, 9 Mar 2023 02:59:35 +0000 (-0500) Subject: vbo: fix current attribs not updating gallium vertex elements X-Git-Tag: upstream/23.3.3~11625 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3bc374ca93458d8e793ad37970f9b9ff62ddf1e6;p=platform%2Fupstream%2Fmesa.git vbo: fix current attribs not updating gallium vertex elements An initial workaround that helped discover this was written by: Illia Polishchuk illia.a.polishchuk@globallogic.com Closes: #8440 Fixes: a18b9d07 ("st/mesa: optimize uploading zero-stride vertex attribs") Acked-by: Pierre-Eric Pelloux-Prayer Part-of: --- diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 1173157..11972a6 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -230,6 +230,11 @@ vbo_exec_copy_to_current(struct vbo_exec_context *exec) vbo_set_vertex_format(&vbo->current[i].Format, exec->vtx.attr[i].size >> dmul_shift, exec->vtx.attr[i].type); + /* The format changed. We need to update gallium vertex elements. + * Material attributes don't need this because they don't have formats. + */ + if (i <= VBO_ATTRIB_EDGEFLAG) + ctx->NewState |= _NEW_CURRENT_ATTRIB; } } diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c index 9bc21be..29e7f3a 100644 --- a/src/mesa/vbo/vbo_save_draw.c +++ b/src/mesa/vbo/vbo_save_draw.c @@ -86,8 +86,12 @@ copy_vao(struct gl_context *ctx, const struct gl_vertex_array_object *vao, } if (type != currval->Format.User.Type || - (size >> dmul_shift) != currval->Format.User.Size) + (size >> dmul_shift) != currval->Format.User.Size) { vbo_set_vertex_format(&currval->Format, size >> dmul_shift, type); + /* The format changed. We need to update gallium vertex elements. */ + if (state == _NEW_CURRENT_ATTRIB) + ctx->NewState |= state; + } *data += size; }