5 /* Fallback implementations for inline read/writes which just go back
6 * to the regular transfer behaviour.
8 #include "pipe/p_state.h"
13 boolean
u_default_resource_get_handle(struct pipe_screen
*screen
,
14 struct pipe_resource
*resource
,
15 struct winsys_handle
*handle
);
17 void u_default_transfer_inline_write( struct pipe_context
*pipe
,
18 struct pipe_resource
*resource
,
19 struct pipe_subresource sr
,
21 const struct pipe_box
*box
,
24 unsigned slice_stride
);
26 void u_default_transfer_flush_region( struct pipe_context
*pipe
,
27 struct pipe_transfer
*transfer
,
28 const struct pipe_box
*box
);
30 unsigned u_default_is_resource_referenced( struct pipe_context
*pipe
,
31 struct pipe_resource
*resource
,
32 unsigned face
, unsigned level
);
34 struct pipe_transfer
* u_default_get_transfer(struct pipe_context
*context
,
35 struct pipe_resource
*resource
,
36 struct pipe_subresource sr
,
38 const struct pipe_box
*box
);
40 void u_default_transfer_unmap( struct pipe_context
*pipe
,
41 struct pipe_transfer
*transfer
);
43 void u_default_transfer_destroy(struct pipe_context
*pipe
,
44 struct pipe_transfer
*transfer
);
48 /* Useful helper to allow >1 implementation of resource functionality
49 * to exist in a single driver. This is intended to be transitionary!
51 struct u_resource_vtbl
{
53 boolean (*resource_get_handle
)(struct pipe_screen
*,
54 struct pipe_resource
*tex
,
55 struct winsys_handle
*handle
);
57 void (*resource_destroy
)(struct pipe_screen
*,
58 struct pipe_resource
*pt
);
60 unsigned (*is_resource_referenced
)(struct pipe_context
*pipe
,
61 struct pipe_resource
*texture
,
62 unsigned face
, unsigned level
);
64 struct pipe_transfer
*(*get_transfer
)(struct pipe_context
*,
65 struct pipe_resource
*resource
,
66 struct pipe_subresource
,
68 const struct pipe_box
*);
70 void (*transfer_destroy
)(struct pipe_context
*,
71 struct pipe_transfer
*);
73 void *(*transfer_map
)( struct pipe_context
*,
74 struct pipe_transfer
*transfer
);
76 void (*transfer_flush_region
)( struct pipe_context
*,
77 struct pipe_transfer
*transfer
,
78 const struct pipe_box
*);
80 void (*transfer_unmap
)( struct pipe_context
*,
81 struct pipe_transfer
*transfer
);
83 void (*transfer_inline_write
)( struct pipe_context
*pipe
,
84 struct pipe_resource
*resource
,
85 struct pipe_subresource sr
,
87 const struct pipe_box
*box
,
90 unsigned slice_stride
);
95 struct pipe_resource b
;
96 struct u_resource_vtbl
*vtbl
;
100 boolean
u_resource_get_handle_vtbl(struct pipe_screen
*screen
,
101 struct pipe_resource
*resource
,
102 struct winsys_handle
*handle
);
104 void u_resource_destroy_vtbl(struct pipe_screen
*screen
,
105 struct pipe_resource
*resource
);
107 unsigned u_is_resource_referenced_vtbl( struct pipe_context
*pipe
,
108 struct pipe_resource
*resource
,
109 unsigned face
, unsigned level
);
111 struct pipe_transfer
*u_get_transfer_vtbl(struct pipe_context
*context
,
112 struct pipe_resource
*resource
,
113 struct pipe_subresource sr
,
115 const struct pipe_box
*box
);
117 void u_transfer_destroy_vtbl(struct pipe_context
*pipe
,
118 struct pipe_transfer
*transfer
);
120 void *u_transfer_map_vtbl( struct pipe_context
*pipe
,
121 struct pipe_transfer
*transfer
);
123 void u_transfer_flush_region_vtbl( struct pipe_context
*pipe
,
124 struct pipe_transfer
*transfer
,
125 const struct pipe_box
*box
);
127 void u_transfer_unmap_vtbl( struct pipe_context
*rm_ctx
,
128 struct pipe_transfer
*transfer
);
130 void u_transfer_inline_write_vtbl( struct pipe_context
*rm_ctx
,
131 struct pipe_resource
*resource
,
132 struct pipe_subresource sr
,
134 const struct pipe_box
*box
,
137 unsigned slice_stride
);