1 #include "pipe/p_context.h"
2 #include "util/u_surface.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
;
22 assert(!(usage
& PIPE_TRANSFER_READ
));
24 /* the write flag is implicit by the nature of transfer_inline_write */
25 usage
|= PIPE_TRANSFER_WRITE
;
27 /* transfer_inline_write implicitly discards the rewritten buffer range */
28 if (box
->x
== 0 && box
->width
== resource
->width0
) {
29 usage
|= PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE
;
31 usage
|= PIPE_TRANSFER_DISCARD_RANGE
;
34 map
= pipe
->transfer_map(pipe
,
42 if (resource
->target
== PIPE_BUFFER
) {
43 assert(box
->height
== 1);
44 assert(box
->depth
== 1);
46 memcpy(map
, data
, box
->width
);
49 const uint8_t *src_data
= data
;
53 transfer
->stride
, /* bytes */
54 transfer
->layer_stride
, /* bytes */
61 layer_stride
, /* bytes */
65 pipe_transfer_unmap(pipe
, transfer
);
69 boolean
u_default_resource_get_handle(struct pipe_screen
*screen
,
70 struct pipe_resource
*resource
,
71 struct winsys_handle
*handle
)
78 void u_default_transfer_flush_region( struct pipe_context
*pipe
,
79 struct pipe_transfer
*transfer
,
80 const struct pipe_box
*box
)
82 /* This is a no-op implementation, nothing to do.
86 void u_default_transfer_unmap( struct pipe_context
*pipe
,
87 struct pipe_transfer
*transfer
)