u_transfer.h revision 848b8605
1 2#ifndef U_TRANSFER_H 3#define U_TRANSFER_H 4 5/* Fallback implementations for inline read/writes which just go back 6 * to the regular transfer behaviour. 7 */ 8#include "pipe/p_state.h" 9 10struct pipe_context; 11struct winsys_handle; 12 13boolean u_default_resource_get_handle(struct pipe_screen *screen, 14 struct pipe_resource *resource, 15 struct winsys_handle *handle); 16 17void u_default_transfer_inline_write( struct pipe_context *pipe, 18 struct pipe_resource *resource, 19 unsigned level, 20 unsigned usage, 21 const struct pipe_box *box, 22 const void *data, 23 unsigned stride, 24 unsigned layer_stride); 25 26void u_default_transfer_flush_region( struct pipe_context *pipe, 27 struct pipe_transfer *transfer, 28 const struct pipe_box *box); 29 30void u_default_transfer_unmap( struct pipe_context *pipe, 31 struct pipe_transfer *transfer ); 32 33 34 35/* Useful helper to allow >1 implementation of resource functionality 36 * to exist in a single driver. This is intended to be transitionary! 37 */ 38struct u_resource_vtbl { 39 40 boolean (*resource_get_handle)(struct pipe_screen *, 41 struct pipe_resource *tex, 42 struct winsys_handle *handle); 43 44 void (*resource_destroy)(struct pipe_screen *, 45 struct pipe_resource *pt); 46 47 void *(*transfer_map)(struct pipe_context *, 48 struct pipe_resource *resource, 49 unsigned level, 50 unsigned usage, 51 const struct pipe_box *, 52 struct pipe_transfer **); 53 54 55 void (*transfer_flush_region)( struct pipe_context *, 56 struct pipe_transfer *transfer, 57 const struct pipe_box *); 58 59 void (*transfer_unmap)( struct pipe_context *, 60 struct pipe_transfer *transfer ); 61 62 void (*transfer_inline_write)( struct pipe_context *pipe, 63 struct pipe_resource *resource, 64 unsigned level, 65 unsigned usage, 66 const struct pipe_box *box, 67 const void *data, 68 unsigned stride, 69 unsigned layer_stride); 70}; 71 72 73struct u_resource { 74 struct pipe_resource b; 75 const struct u_resource_vtbl *vtbl; 76}; 77 78 79boolean u_resource_get_handle_vtbl(struct pipe_screen *screen, 80 struct pipe_resource *resource, 81 struct winsys_handle *handle); 82 83void u_resource_destroy_vtbl(struct pipe_screen *screen, 84 struct pipe_resource *resource); 85 86void *u_transfer_map_vtbl(struct pipe_context *context, 87 struct pipe_resource *resource, 88 unsigned level, 89 unsigned usage, 90 const struct pipe_box *box, 91 struct pipe_transfer **transfer); 92 93void u_transfer_flush_region_vtbl( struct pipe_context *pipe, 94 struct pipe_transfer *transfer, 95 const struct pipe_box *box); 96 97void u_transfer_unmap_vtbl( struct pipe_context *rm_ctx, 98 struct pipe_transfer *transfer ); 99 100void u_transfer_inline_write_vtbl( struct pipe_context *rm_ctx, 101 struct pipe_resource *resource, 102 unsigned level, 103 unsigned usage, 104 const struct pipe_box *box, 105 const void *data, 106 unsigned stride, 107 unsigned layer_stride); 108 109#endif 110