Commit 0d2ec80d authored by Erik Faye-Lund's avatar Erik Faye-Lund Committed by Marge Bot
Browse files

zink: hammer in an explicit wait when retrieving buffer contents for reading

this ensures that the buffer returned is synchronized as expected, though
it incurs a significant performance hit and will hopefully be improved in future
Reviewed-by: Erik Faye-Lund's avatarErik Faye-Lund <>
Part-of: <mesa/mesa!5120>
parent af2d9935
......@@ -434,6 +434,21 @@ zink_transfer_map(struct pipe_context *pctx,
void *ptr;
if (pres->target == PIPE_BUFFER) {
if (usage & PIPE_TRANSFER_READ) {
/* need to wait for rendering to finish
* TODO: optimize/fix this to be much less obtrusive
* mesa/mesa#2966
struct pipe_fence_handle *fence = NULL;
pctx->flush(pctx, &fence, PIPE_FLUSH_HINT_FINISH);
if (fence) {
pctx->screen->fence_finish(pctx->screen, NULL, fence,
pctx->screen->fence_reference(pctx->screen, &fence, NULL);
VkResult result = vkMapMemory(screen->dev, res->mem, res->offset, res->size, 0, &ptr);
if (result != VK_SUCCESS)
return NULL;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment