1 2 3 #include "util/u_inlines.h" 4 #include "util/u_transfer.h" 5 6 static INLINE struct u_resource * 7 u_resource( struct pipe_resource *res ) 8 { 9 return (struct u_resource *)res; 10 } 11 12 boolean u_resource_get_handle_vtbl(struct pipe_screen *screen, 13 struct pipe_resource *resource, 14 struct winsys_handle *handle) 15 { 16 struct u_resource *ur = u_resource(resource); 17 return ur->vtbl->resource_get_handle(screen, resource, handle); 18 } 19 20 void u_resource_destroy_vtbl(struct pipe_screen *screen, 21 struct pipe_resource *resource) 22 { 23 struct u_resource *ur = u_resource(resource); 24 ur->vtbl->resource_destroy(screen, resource); 25 } 26 27 struct pipe_transfer *u_get_transfer_vtbl(struct pipe_context *context, 28 struct pipe_resource *resource, 29 unsigned level, 30 unsigned usage, 31 const struct pipe_box *box) 32 { 33 struct u_resource *ur = u_resource(resource); 34 return ur->vtbl->get_transfer(context, resource, level, usage, box); 35 } 36 37 void u_transfer_destroy_vtbl(struct pipe_context *pipe, 38 struct pipe_transfer *transfer) 39 { 40 struct u_resource *ur = u_resource(transfer->resource); 41 ur->vtbl->transfer_destroy(pipe, transfer); 42 } 43 44 void *u_transfer_map_vtbl( struct pipe_context *pipe, 45 struct pipe_transfer *transfer ) 46 { 47 struct u_resource *ur = u_resource(transfer->resource); 48 return ur->vtbl->transfer_map(pipe, transfer); 49 } 50 51 void u_transfer_flush_region_vtbl( struct pipe_context *pipe, 52 struct pipe_transfer *transfer, 53 const struct pipe_box *box) 54 { 55 struct u_resource *ur = u_resource(transfer->resource); 56 ur->vtbl->transfer_flush_region(pipe, transfer, box); 57 } 58 59 void u_transfer_unmap_vtbl( struct pipe_context *pipe, 60 struct pipe_transfer *transfer ) 61 { 62 struct u_resource *ur = u_resource(transfer->resource); 63 ur->vtbl->transfer_unmap(pipe, transfer); 64 } 65 66 void u_transfer_inline_write_vtbl( struct pipe_context *pipe, 67 struct pipe_resource *resource, 68 unsigned level, 69 unsigned usage, 70 const struct pipe_box *box, 71 const void *data, 72 unsigned stride, 73 unsigned layer_stride) 74 { 75 struct u_resource *ur = u_resource(resource); 76 ur->vtbl->transfer_inline_write(pipe, 77 resource, 78 level, 79 usage, 80 box, 81 data, 82 stride, 83 layer_stride); 84 } 85 86 87 88 89