1 #include "pipe/p_context.h"
2 #include "util/u_rect.h"
3 #include "util/u_inlines.h"
4 #include "util/u_transfer.h"
5 #include "util/u_memory.h"
7 /* One-shot transfer operation with data supplied in a user
8 * pointer. XXX: strides??
10 void u_default_transfer_inline_write( struct pipe_context *pipe,
11 struct pipe_resource *resource,
14 const struct pipe_box *box,
17 unsigned layer_stride)
19 struct pipe_transfer *transfer = NULL;
21 const uint8_t *src_data = data;
24 transfer = pipe->get_transfer(pipe,
32 map = pipe_transfer_map(pipe, transfer);
36 for (i = 0; i < box->depth; i++) {
39 transfer->stride, /* bytes */
46 map += transfer->layer_stride;
47 src_data += layer_stride;
52 pipe_transfer_unmap(pipe, transfer);
55 pipe_transfer_destroy(pipe, transfer);
59 boolean u_default_resource_get_handle(struct pipe_screen *screen,
60 struct pipe_resource *resource,
61 struct winsys_handle *handle)
68 void u_default_transfer_flush_region( struct pipe_context *pipe,
69 struct pipe_transfer *transfer,
70 const struct pipe_box *box)
72 /* This is a no-op implementation, nothing to do.
76 struct pipe_transfer * u_default_get_transfer(struct pipe_context *context,
77 struct pipe_resource *resource,
80 const struct pipe_box *box)
82 struct pipe_transfer *transfer = CALLOC_STRUCT(pipe_transfer);
86 transfer->resource = resource;
87 transfer->level = level;
88 transfer->usage = usage;
91 /* Note strides are zero, this is ok for buffers, but not for
92 * textures 2d & higher at least.
97 void u_default_transfer_unmap( struct pipe_context *pipe,
98 struct pipe_transfer *transfer )
102 void u_default_transfer_destroy(struct pipe_context *pipe,
103 struct pipe_transfer *transfer)
108 void u_default_redefine_user_buffer(struct pipe_context *ctx,
109 struct pipe_resource *resource,
113 resource->width0 = MAX2(resource->width0, offset + size);