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