Merge commit 'origin/7.8'
[mesa.git] / src / gallium / auxiliary / util / u_transfer.h
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
10 struct pipe_context;
11
12 boolean u_default_resource_get_handle(struct pipe_screen *screen,
13 struct pipe_resource *resource,
14 struct winsys_handle *handle);
15
16 void u_default_transfer_inline_write( struct pipe_context *pipe,
17 struct pipe_resource *resource,
18 struct pipe_subresource sr,
19 unsigned usage,
20 const struct pipe_box *box,
21 const void *data,
22 unsigned stride,
23 unsigned slice_stride);
24
25 void u_default_transfer_flush_region( struct pipe_context *pipe,
26 struct pipe_transfer *transfer,
27 const struct pipe_box *box);
28
29 unsigned u_default_is_resource_referenced( struct pipe_context *pipe,
30 struct pipe_resource *resource,
31 unsigned face, unsigned level);
32
33 struct pipe_transfer * u_default_get_transfer(struct pipe_context *context,
34 struct pipe_resource *resource,
35 struct pipe_subresource sr,
36 unsigned usage,
37 const struct pipe_box *box);
38
39 void u_default_transfer_unmap( struct pipe_context *pipe,
40 struct pipe_transfer *transfer );
41
42 void u_default_transfer_destroy(struct pipe_context *pipe,
43 struct pipe_transfer *transfer);
44
45
46
47 /* Useful helper to allow >1 implementation of resource functionality
48 * to exist in a single driver. This is intended to be transitionary!
49 */
50 struct u_resource_vtbl {
51
52 boolean (*resource_get_handle)(struct pipe_screen *,
53 struct pipe_resource *tex,
54 struct winsys_handle *handle);
55
56 void (*resource_destroy)(struct pipe_screen *,
57 struct pipe_resource *pt);
58
59 unsigned (*is_resource_referenced)(struct pipe_context *pipe,
60 struct pipe_resource *texture,
61 unsigned face, unsigned level);
62
63 struct pipe_transfer *(*get_transfer)(struct pipe_context *,
64 struct pipe_resource *resource,
65 struct pipe_subresource,
66 unsigned usage,
67 const struct pipe_box *);
68
69 void (*transfer_destroy)(struct pipe_context *,
70 struct pipe_transfer *);
71
72 void *(*transfer_map)( struct pipe_context *,
73 struct pipe_transfer *transfer );
74
75 void (*transfer_flush_region)( struct pipe_context *,
76 struct pipe_transfer *transfer,
77 const struct pipe_box *);
78
79 void (*transfer_unmap)( struct pipe_context *,
80 struct pipe_transfer *transfer );
81
82 void (*transfer_inline_write)( struct pipe_context *pipe,
83 struct pipe_resource *resource,
84 struct pipe_subresource sr,
85 unsigned usage,
86 const struct pipe_box *box,
87 const void *data,
88 unsigned stride,
89 unsigned slice_stride);
90 };
91
92
93 struct u_resource {
94 struct pipe_resource b;
95 struct u_resource_vtbl *vtbl;
96 };
97
98
99 boolean u_resource_get_handle_vtbl(struct pipe_screen *screen,
100 struct pipe_resource *resource,
101 struct winsys_handle *handle);
102
103 void u_resource_destroy_vtbl(struct pipe_screen *screen,
104 struct pipe_resource *resource);
105
106 unsigned u_is_resource_referenced_vtbl( struct pipe_context *pipe,
107 struct pipe_resource *resource,
108 unsigned face, unsigned level);
109
110 struct pipe_transfer *u_get_transfer_vtbl(struct pipe_context *context,
111 struct pipe_resource *resource,
112 struct pipe_subresource sr,
113 unsigned usage,
114 const struct pipe_box *box);
115
116 void u_transfer_destroy_vtbl(struct pipe_context *pipe,
117 struct pipe_transfer *transfer);
118
119 void *u_transfer_map_vtbl( struct pipe_context *pipe,
120 struct pipe_transfer *transfer );
121
122 void u_transfer_flush_region_vtbl( struct pipe_context *pipe,
123 struct pipe_transfer *transfer,
124 const struct pipe_box *box);
125
126 void u_transfer_unmap_vtbl( struct pipe_context *rm_ctx,
127 struct pipe_transfer *transfer );
128
129 void u_transfer_inline_write_vtbl( struct pipe_context *rm_ctx,
130 struct pipe_resource *resource,
131 struct pipe_subresource sr,
132 unsigned usage,
133 const struct pipe_box *box,
134 const void *data,
135 unsigned stride,
136 unsigned slice_stride);
137
138
139
140
141
142
143
144
145 #endif