From 517484ea899d6a13be9a85f608434e1b487c3184 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 19 May 2021 12:39:48 -0400 Subject: [PATCH] zink: force streamout rebind when mapping a streamout buffer for writing if the contents of the buffer change between uses, trigger the rebind path next time a draw happens for synchronization Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/zink_resource.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c index 686ad27..8d3abdc 100644 --- a/src/gallium/drivers/zink/zink_resource.c +++ b/src/gallium/drivers/zink/zink_resource.c @@ -943,6 +943,12 @@ buffer_transfer_map(struct zink_context *ctx, struct zink_resource *res, unsigne } if (!ptr) { + /* if writing to a streamout buffer, ensure synchronization next time it's used */ + if (usage & PIPE_MAP_WRITE && res->bind_history & ZINK_RESOURCE_USAGE_STREAMOUT) { + ctx->dirty_so_targets = true; + /* force counter buffer reset */ + res->bind_history &= ~ZINK_RESOURCE_USAGE_STREAMOUT; + } ptr = map_resource(screen, res); if (!ptr) return NULL; -- 2.7.4