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 13#ifdef __cplusplus 14extern "C" { 15#endif 16 17boolean u_default_resource_get_handle(struct pipe_screen *screen, 18 struct pipe_resource *resource, 19 struct winsys_handle *handle); 20 21void u_default_buffer_subdata(struct pipe_context *pipe, 22 struct pipe_resource *resource, 23 unsigned usage, unsigned offset, 24 unsigned size, const void *data); 25 26void u_default_texture_subdata(struct pipe_context *pipe, 27 struct pipe_resource *resource, 28 unsigned level, 29 unsigned usage, 30 const struct pipe_box *box, 31 const void *data, 32 unsigned stride, 33 unsigned layer_stride); 34 35void u_default_transfer_flush_region( struct pipe_context *pipe, 36 struct pipe_transfer *transfer, 37 const struct pipe_box *box); 38 39void u_default_transfer_unmap( struct pipe_context *pipe, 40 struct pipe_transfer *transfer ); 41 42 43 44/* Useful helper to allow >1 implementation of resource functionality 45 * to exist in a single driver. This is intended to be transitionary! 46 */ 47struct u_resource_vtbl { 48 49 boolean (*resource_get_handle)(struct pipe_screen *, 50 struct pipe_resource *tex, 51 struct winsys_handle *handle); 52 53 void (*resource_destroy)(struct pipe_screen *, 54 struct pipe_resource *pt); 55 56 void *(*transfer_map)(struct pipe_context *, 57 struct pipe_resource *resource, 58 unsigned level, 59 unsigned usage, 60 const struct pipe_box *, 61 struct pipe_transfer **); 62 63 64 void (*transfer_flush_region)( struct pipe_context *, 65 struct pipe_transfer *transfer, 66 const struct pipe_box *); 67 68 void (*transfer_unmap)( struct pipe_context *, 69 struct pipe_transfer *transfer ); 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_context *ctx, 81 struct pipe_resource *resource, 82 struct winsys_handle *handle, 83 unsigned usage); 84 85void u_resource_destroy_vtbl(struct pipe_screen *screen, 86 struct pipe_resource *resource); 87 88void *u_transfer_map_vtbl(struct pipe_context *context, 89 struct pipe_resource *resource, 90 unsigned level, 91 unsigned usage, 92 const struct pipe_box *box, 93 struct pipe_transfer **transfer); 94 95void u_transfer_flush_region_vtbl( struct pipe_context *pipe, 96 struct pipe_transfer *transfer, 97 const struct pipe_box *box); 98 99void u_transfer_unmap_vtbl( struct pipe_context *rm_ctx, 100 struct pipe_transfer *transfer ); 101 102#ifdef __cplusplus 103} // extern "C" { 104#endif 105 106#endif 107