5 /* Fallback implementations for inline read/writes which just go back
6 * to the regular transfer behaviour.
8 #include "pipe/p_state.h"
12 boolean
u_default_resource_get_handle(struct pipe_screen
*screen
,
13 struct pipe_resource
*resource
,
14 struct winsys_handle
*handle
);
16 void u_default_transfer_inline_write( struct pipe_context
*pipe
,
17 struct pipe_resource
*resource
,
18 struct pipe_subresource sr
,
20 const struct pipe_box
*box
,
23 unsigned slice_stride
);
25 void u_default_transfer_flush_region( struct pipe_context
*pipe
,
26 struct pipe_transfer
*transfer
,
27 const struct pipe_box
*box
);
29 unsigned u_default_is_resource_referenced( struct pipe_context
*pipe
,
30 struct pipe_resource
*resource
,
31 unsigned face
, unsigned level
);
33 struct pipe_transfer
* u_default_get_transfer(struct pipe_context
*context
,
34 struct pipe_resource
*resource
,
35 struct pipe_subresource sr
,
37 const struct pipe_box
*box
);
39 void u_default_transfer_unmap( struct pipe_context
*pipe
,
40 struct pipe_transfer
*transfer
);
42 void u_default_transfer_destroy(struct pipe_context
*pipe
,
43 struct pipe_transfer
*transfer
);
47 /* Useful helper to allow >1 implementation of resource functionality
48 * to exist in a single driver. This is intended to be transitionary!
50 struct u_resource_vtbl
{
52 boolean (*resource_get_handle
)(struct pipe_screen
*,
53 struct pipe_resource
*tex
,
54 struct winsys_handle
*handle
);
56 void (*resource_destroy
)(struct pipe_screen
*,
57 struct pipe_resource
*pt
);
59 unsigned (*is_resource_referenced
)(struct pipe_context
*pipe
,
60 struct pipe_resource
*texture
,
61 unsigned face
, unsigned level
);
63 struct pipe_transfer
*(*get_transfer
)(struct pipe_context
*,
64 struct pipe_resource
*resource
,
65 struct pipe_subresource
,
67 const struct pipe_box
*);
69 void (*transfer_destroy
)(struct pipe_context
*,
70 struct pipe_transfer
*);
72 void *(*transfer_map
)( struct pipe_context
*,
73 struct pipe_transfer
*transfer
);
75 void (*transfer_flush_region
)( struct pipe_context
*,
76 struct pipe_transfer
*transfer
,
77 const struct pipe_box
*);
79 void (*transfer_unmap
)( struct pipe_context
*,
80 struct pipe_transfer
*transfer
);
82 void (*transfer_inline_write
)( struct pipe_context
*pipe
,
83 struct pipe_resource
*resource
,
84 struct pipe_subresource sr
,
86 const struct pipe_box
*box
,
89 unsigned slice_stride
);
94 struct pipe_resource b
;
95 struct u_resource_vtbl
*vtbl
;
99 boolean
u_resource_get_handle_vtbl(struct pipe_screen
*screen
,
100 struct pipe_resource
*resource
,
101 struct winsys_handle
*handle
);
103 void u_resource_destroy_vtbl(struct pipe_screen
*screen
,
104 struct pipe_resource
*resource
);
106 unsigned u_is_resource_referenced_vtbl( struct pipe_context
*pipe
,
107 struct pipe_resource
*resource
,
108 unsigned face
, unsigned level
);
110 struct pipe_transfer
*u_get_transfer_vtbl(struct pipe_context
*context
,
111 struct pipe_resource
*resource
,
112 struct pipe_subresource sr
,
114 const struct pipe_box
*box
);
116 void u_transfer_destroy_vtbl(struct pipe_context
*pipe
,
117 struct pipe_transfer
*transfer
);
119 void *u_transfer_map_vtbl( struct pipe_context
*pipe
,
120 struct pipe_transfer
*transfer
);
122 void u_transfer_flush_region_vtbl( struct pipe_context
*pipe
,
123 struct pipe_transfer
*transfer
,
124 const struct pipe_box
*box
);
126 void u_transfer_unmap_vtbl( struct pipe_context
*rm_ctx
,
127 struct pipe_transfer
*transfer
);
129 void u_transfer_inline_write_vtbl( struct pipe_context
*rm_ctx
,
130 struct pipe_resource
*resource
,
131 struct pipe_subresource sr
,
133 const struct pipe_box
*box
,
136 unsigned slice_stride
);