mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 04:20:08 +01:00
zink: fix direct image mapping offset
the x and y offsets here were improperly calculated without taking into account:
* layer/level offset
* x/y coord bpp
Fixes: 8d46e35d16 ("zink: introduce opengl over vulkan")
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8058>
This commit is contained in:
parent
84c8a35aa2
commit
456b57802e
1 changed files with 6 additions and 3 deletions
|
|
@ -613,9 +613,12 @@ zink_transfer_map(struct pipe_context *pctx,
|
|||
vkGetImageSubresourceLayout(screen->dev, res->image, &isr, &srl);
|
||||
trans->base.stride = srl.rowPitch;
|
||||
trans->base.layer_stride = srl.arrayPitch;
|
||||
ptr = ((uint8_t *)ptr) + box->z * srl.depthPitch +
|
||||
box->y * srl.rowPitch +
|
||||
box->x;
|
||||
const struct util_format_description *desc = util_format_description(res->format);
|
||||
unsigned offset = srl.offset +
|
||||
box->z * srl.depthPitch +
|
||||
(box->y / desc->block.height) * srl.rowPitch +
|
||||
(box->x / desc->block.width) * (util_format_get_blocksize(res->format) / desc->nr_channels);
|
||||
ptr = ((uint8_t *)ptr) + offset;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue