3 #include "util/u_inlines.h"
4 #include "util/u_memory.h"
5 #include "util/u_transfer.h"
7 static INLINE struct u_resource *
8 u_resource( struct pipe_resource *res )
10 return (struct u_resource *)res;
13 boolean u_resource_get_handle_vtbl(struct pipe_screen *screen,
14 struct pipe_resource *resource,
15 struct winsys_handle *handle)
17 struct u_resource *ur = u_resource(resource);
18 return ur->vtbl->resource_get_handle(screen, resource, handle);
21 void u_resource_destroy_vtbl(struct pipe_screen *screen,
22 struct pipe_resource *resource)
24 struct u_resource *ur = u_resource(resource);
25 ur->vtbl->resource_destroy(screen, resource);
28 unsigned u_is_resource_referenced_vtbl( struct pipe_context *pipe,
29 struct pipe_resource *resource,
30 unsigned face, unsigned level)
32 struct u_resource *ur = u_resource(resource);
33 return ur->vtbl->is_resource_referenced(pipe, resource, face, level);
36 struct pipe_transfer *u_get_transfer_vtbl(struct pipe_context *context,
37 struct pipe_resource *resource,
38 struct pipe_subresource sr,
39 enum pipe_transfer_usage usage,
40 const struct pipe_box *box)
42 struct u_resource *ur = u_resource(resource);
43 return ur->vtbl->get_transfer(context, resource, sr, usage, box);
46 void u_transfer_destroy_vtbl(struct pipe_context *pipe,
47 struct pipe_transfer *transfer)
49 struct u_resource *ur = u_resource(transfer->resource);
50 ur->vtbl->transfer_destroy(pipe, transfer);
53 void *u_transfer_map_vtbl( struct pipe_context *pipe,
54 struct pipe_transfer *transfer )
56 struct u_resource *ur = u_resource(transfer->resource);
57 return ur->vtbl->transfer_map(pipe, transfer);
60 void u_transfer_flush_region_vtbl( struct pipe_context *pipe,
61 struct pipe_transfer *transfer,
62 const struct pipe_box *box)
64 struct u_resource *ur = u_resource(transfer->resource);
65 ur->vtbl->transfer_flush_region(pipe, transfer, box);
68 void u_transfer_unmap_vtbl( struct pipe_context *pipe,
69 struct pipe_transfer *transfer )
71 struct u_resource *ur = u_resource(transfer->resource);
72 ur->vtbl->transfer_unmap(pipe, transfer);
75 void u_transfer_inline_write_vtbl( struct pipe_context *pipe,
76 struct pipe_resource *resource,
77 struct pipe_subresource sr,
79 const struct pipe_box *box,
82 unsigned slice_stride)
84 struct u_resource *ur = u_resource(resource);
85 ur->vtbl->transfer_inline_write(pipe,