zink: track the "real" buffer range from replacement buffers

when tc replaces a buffer in subdata, it may subsequently perform subdata calls
on the replacement if it is forced to sync during map, e.g.,
* bind_vbo(dst)
* draw
* subdata(src)
  * buffer replacement
  * map
  * tc sync
  * replace_buffer(dst, src)
  * memcpy <- broken
* draw

in this scenario, src may not have data at the time of replacement,
but it will get data soon after, and this buffer range is the real one

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30107>
This commit is contained in:
Mike Blumenkrantz 2024-06-25 11:50:13 -04:00 committed by Marge Bot
parent fa210726b6
commit 76da22bfc2
2 changed files with 2 additions and 0 deletions

View file

@ -5002,6 +5002,7 @@ zink_context_replace_buffer_storage(struct pipe_context *pctx, struct pipe_resou
/* don't be too creative */
zink_resource_object_reference(screen, &d->obj, s->obj);
d->valid_buffer_range = s->valid_buffer_range;
s->real_buffer_range = &d->valid_buffer_range;
zink_resource_copies_reset(d);
/* force counter buffer reset */
d->so_valid = false;

View file

@ -1292,6 +1292,7 @@ struct zink_resource {
union {
struct {
struct util_range valid_buffer_range;
struct util_range *real_buffer_range; //only set on tc replace_buffer src
uint32_t vbo_bind_mask : PIPE_MAX_ATTRIBS;
uint8_t ubo_bind_count[2];
uint8_t ssbo_bind_count[2];