diff options
Diffstat (limited to 'src/gallium/drivers/zink/zink_resource.c')
-rw-r--r-- | src/gallium/drivers/zink/zink_resource.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c index ee38909eab8..5eb1012da48 100644 --- a/src/gallium/drivers/zink/zink_resource.c +++ b/src/gallium/drivers/zink/zink_resource.c @@ -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; } } |