vbo/save: avoid dangling_attr_ref situation
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Fri, 16 Dec 2022 15:16:45 +0000 (16:16 +0100)
committerMarge Bot <emma+marge@anholt.net>
Thu, 5 Jan 2023 09:10:59 +0000 (09:10 +0000)
commitaa1a752979b430aeeb1b2fcdc9bc738ce9de8cc3
treec3c1dd7dc43a67d07ba4cb5f858caccb954dbe80
parenta9ab06668f9c6649ac5ea34e7707d50363be43a7
vbo/save: avoid dangling_attr_ref situation

dangling_attr_ref=true can be set when the following happens:

  glBegin(GL_TRIANGLES)
  glVertex(...)
  glVertex(...)
  glColor4(...)
  glVertex(...)

When glColor4 is hit, the first 2 vertices are copied to the vertex_store
by upgrade_vertex, but since this is done before glColor4 new values are
copied, we make a note to fixup these attribute laters using dangling_attr_ref.

This causes very slow rendering. What this commit does instead, is in this
situation, the new attribute value are backported to the vertex store for the
copied vertices after upgrade_vertex is done updating the layout.

This avoids the slow corner case.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7912

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20495>
src/mesa/vbo/vbo_save_api.c