summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4/vc4_resource.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_resource.c')
-rw-r--r--src/gallium/drivers/vc4/vc4_resource.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/gallium/drivers/vc4/vc4_resource.c b/src/gallium/drivers/vc4/vc4_resource.c
index 5d5166fd818..122bda0bac6 100644
--- a/src/gallium/drivers/vc4/vc4_resource.c
+++ b/src/gallium/drivers/vc4/vc4_resource.c
@@ -667,11 +667,16 @@ vc4_get_shadow_index_buffer(struct pipe_context *pctx,
shadow_offset, &shadow_rsc, &data);
uint16_t *dst = data;
- struct pipe_transfer *src_transfer;
- uint32_t *src = pipe_buffer_map_range(pctx, &orig->base.b,
- ib->offset,
- count * 4,
- PIPE_TRANSFER_READ, &src_transfer);
+ struct pipe_transfer *src_transfer = NULL;
+ uint32_t *src;
+ if (ib->user_buffer) {
+ src = ib->user_buffer;
+ } else {
+ src = pipe_buffer_map_range(pctx, &orig->base.b,
+ ib->offset,
+ count * 4,
+ PIPE_TRANSFER_READ, &src_transfer);
+ }
for (int i = 0; i < count; i++) {
uint32_t src_index = src[i];
@@ -679,7 +684,8 @@ vc4_get_shadow_index_buffer(struct pipe_context *pctx,
dst[i] = src_index;
}
- pctx->transfer_unmap(pctx, src_transfer);
+ if (src_transfer)
+ pctx->transfer_unmap(pctx, src_transfer);
return shadow_rsc;
}