Module: Mesa Branch: staging/23.0 Commit: 45c7e3b416e66d04c27f10a0f45b1aa71dd2ee91 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=45c7e3b416e66d04c27f10a0f45b1aa71dd2ee91
Author: Marek Olšák <[email protected]> Date: Wed Mar 8 21:59:35 2023 -0500 vbo: fix current attribs not updating gallium vertex elements An initial workaround that helped discover this was written by: Illia Polishchuk [email protected] Closes: #8440 Fixes: a18b9d07 ("st/mesa: optimize uploading zero-stride vertex attribs") Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21805> (cherry picked from commit 3bc374ca93458d8e793ad37970f9b9ff62ddf1e6) --- .pick_status.json | 2 +- src/mesa/vbo/vbo_exec_api.c | 5 +++++ src/mesa/vbo/vbo_save_draw.c | 6 +++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index ea88c7cf0ec..f747b5ab823 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -5548,7 +5548,7 @@ "description": "vbo: fix current attribs not updating gallium vertex elements", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "a18b9d071df60d5335b69fca793a743dd0a9d8cc" }, diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 537b423c7b4..b6c21c584fc 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 9bc21be0fb7..29e7f3ac3ab 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; }
