zink: force max buffer alignment on return ptrs for mapped staging buffers

this guarantees the alignment matches what the API expects

fixes KHR-GL4*.map_buffer_alignment.functional on nvk

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27827>
This commit is contained in:
Mike Blumenkrantz
2024-02-28 09:28:04 -05:00
committed by Marge Bot
parent f7d6a75d6b
commit 2b1d12b104

View File

@@ -2363,7 +2363,7 @@ zink_buffer_map(struct pipe_context *pctx,
/* any read, non-HV write, or unmappable that reaches this point needs staging */
if ((usage & PIPE_MAP_READ) || !res->obj->host_visible || res->base.b.flags & PIPE_RESOURCE_FLAG_DONT_MAP_DIRECTLY) {
overwrite:
trans->offset = box->x % screen->info.props.limits.minMemoryMapAlignment;
trans->offset = box->x % MAX2(screen->info.props.limits.minMemoryMapAlignment, 1 << MIN_SLAB_ORDER);
trans->staging_res = pipe_buffer_create(&screen->base, PIPE_BIND_LINEAR, PIPE_USAGE_STAGING, box->width + trans->offset);
if (!trans->staging_res)
goto fail;