summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util/u_transfer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/auxiliary/util/u_transfer.c')
-rw-r--r--src/gallium/auxiliary/util/u_transfer.c78
1 files changed, 41 insertions, 37 deletions
diff --git a/src/gallium/auxiliary/util/u_transfer.c b/src/gallium/auxiliary/util/u_transfer.c
index 69f6fab9504..e2828cfd99e 100644
--- a/src/gallium/auxiliary/util/u_transfer.c
+++ b/src/gallium/auxiliary/util/u_transfer.c
@@ -8,22 +8,24 @@
* pointer. XXX: strides??
*/
void u_default_transfer_inline_write( struct pipe_context *pipe,
- struct pipe_resource *resource,
- struct pipe_subresource sr,
- unsigned usage,
- const struct pipe_box *box,
- const void *data,
- unsigned stride,
- unsigned slice_stride)
+ struct pipe_resource *resource,
+ unsigned level,
+ unsigned usage,
+ const struct pipe_box *box,
+ const void *data,
+ unsigned stride,
+ unsigned layer_stride)
{
struct pipe_transfer *transfer = NULL;
uint8_t *map = NULL;
-
- transfer = pipe->get_transfer(pipe,
- resource,
- sr,
- usage,
- box );
+ const uint8_t *src_data = data;
+ unsigned i;
+
+ transfer = pipe->get_transfer(pipe,
+ resource,
+ level,
+ usage,
+ box );
if (transfer == NULL)
goto out;
@@ -31,17 +33,19 @@ void u_default_transfer_inline_write( struct pipe_context *pipe,
if (map == NULL)
goto out;
- assert(box->depth == 1); /* XXX: fix me */
-
- util_copy_rect(map,
- resource->format,
- transfer->stride, /* bytes */
- 0, 0,
- box->width,
- box->height,
- data,
- stride, /* bytes */
- 0, 0);
+ for (i = 0; i < box->depth; i++) {
+ util_copy_rect(map,
+ resource->format,
+ transfer->stride, /* bytes */
+ 0, 0,
+ box->width,
+ box->height,
+ src_data,
+ stride, /* bytes */
+ 0, 0);
+ map += transfer->layer_stride;
+ src_data += layer_stride;
+ }
out:
if (map)
@@ -53,8 +57,8 @@ out:
boolean u_default_resource_get_handle(struct pipe_screen *screen,
- struct pipe_resource *resource,
- struct winsys_handle *handle)
+ struct pipe_resource *resource,
+ struct winsys_handle *handle)
{
return FALSE;
}
@@ -62,32 +66,32 @@ boolean u_default_resource_get_handle(struct pipe_screen *screen,
void u_default_transfer_flush_region( struct pipe_context *pipe,
- struct pipe_transfer *transfer,
- const struct pipe_box *box)
+ struct pipe_transfer *transfer,
+ const struct pipe_box *box)
{
/* This is a no-op implementation, nothing to do.
*/
}
unsigned u_default_is_resource_referenced( struct pipe_context *pipe,
- struct pipe_resource *resource,
- unsigned face, unsigned level)
+ struct pipe_resource *resource,
+ unsigned level, int layer)
{
return 0;
}
struct pipe_transfer * u_default_get_transfer(struct pipe_context *context,
- struct pipe_resource *resource,
- struct pipe_subresource sr,
- unsigned usage,
- const struct pipe_box *box)
+ struct pipe_resource *resource,
+ unsigned level,
+ unsigned usage,
+ const struct pipe_box *box)
{
struct pipe_transfer *transfer = CALLOC_STRUCT(pipe_transfer);
if (transfer == NULL)
return NULL;
transfer->resource = resource;
- transfer->sr = sr;
+ transfer->level = level;
transfer->usage = usage;
transfer->box = *box;
@@ -98,12 +102,12 @@ struct pipe_transfer * u_default_get_transfer(struct pipe_context *context,
}
void u_default_transfer_unmap( struct pipe_context *pipe,
- struct pipe_transfer *transfer )
+ struct pipe_transfer *transfer )
{
}
void u_default_transfer_destroy(struct pipe_context *pipe,
- struct pipe_transfer *transfer)
+ struct pipe_transfer *transfer)
{
FREE(transfer);
}