mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 15:38:09 +02: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> (cherry picked from commit456b57802e)
This commit is contained in:
parent
5534e540a4
commit
76870cfae2
2 changed files with 7 additions and 4 deletions
|
|
@ -301,7 +301,7 @@
|
|||
"description": "zink: fix direct image mapping offset",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"master_sha": null,
|
||||
"because_sha": "8d46e35d16e3936968958bcab86d61967a673305"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -523,9 +523,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