diff options
author | Kenneth Graunke <[email protected]> | 2018-11-10 02:25:24 -0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2019-02-21 10:26:10 -0800 |
commit | c06f6d12a59c4a2374188e03f21377e593c80354 (patch) | |
tree | 488e318f4096016330b911b4e4ea3b14e8c03f50 /src/gallium/drivers/iris/iris_resource.c | |
parent | b2c04aa3a05442233ad0bab140a06357c5b920b7 (diff) |
iris: "Fix" transfer maps of buffers
x should be in bytes, not cpp units
This generally worked out because PIPE_BUFFER is supposedly required
to be R8_UINT or R8_UNORM. I hear some state trackers pass
PIPE_FORMAT_NONE instead, however, which would make this break.
Just do the right thing directly, to be defensive and clear.
Diffstat (limited to 'src/gallium/drivers/iris/iris_resource.c')
-rw-r--r-- | src/gallium/drivers/iris/iris_resource.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index e4850dd86ae..7fe13e2ed76 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -779,14 +779,21 @@ iris_map_direct(struct iris_transfer *map) const unsigned cpp = fmtl->bpb / 8; unsigned x0_el, y0_el; - get_image_offset_el(surf, xfer->level, box->z, &x0_el, &y0_el); + void *ptr = iris_bo_map(map->dbg, res->bo, xfer->usage); - xfer->stride = isl_surf_get_row_pitch_B(surf); - xfer->layer_stride = isl_surf_get_array_pitch(surf); + if (res->base.target == PIPE_BUFFER) { + xfer->stride = 0; + xfer->layer_stride = 0; - void *ptr = iris_bo_map(map->dbg, res->bo, xfer->usage); + map->ptr = ptr + box->x; + } else { + get_image_offset_el(surf, xfer->level, box->z, &x0_el, &y0_el); - map->ptr = ptr + (y0_el + box->y) * xfer->stride + (x0_el + box->x) * cpp; + xfer->stride = isl_surf_get_row_pitch_B(surf); + xfer->layer_stride = isl_surf_get_array_pitch(surf); + + map->ptr = ptr + (y0_el + box->y) * xfer->stride + (x0_el + box->x) * cpp; + } } static void * |