1 /++
2 + Machine generated D bindings for Sokol library.
3 + 
4 +     Source header: sokol_cmdbuf.h
5 +     Module: sokol.cmdbuf
6 + 
7 +     Do not edit manually; regenerate using gen_d.py.
8 +/
9 module sokol.cmdbuf;
10 import sg = sokol.gfx;
11 
12 /++
13 + public constants
14 +/
15 enum invalid_id = 0;
16 /++
17 + scb_cmdbuf
18 + 
19 +     A command buffer handle created with scb_make_cmdbuf().
20 +/
21 extern(C) struct Cmdbuf {
22     uint id = 0;
23 }
24 /++
25 + scb_resource_state
26 + 
27 +     The state of a command buffer object, obtainable via scb_query_cmdbuf_state().
28 +     Publicly visible values are only SCB_RESOURCESTATE_VALID,
29 +     SCB_RESOURCESTATE_FAILED and SCB_RESOURCESTATE_INVALID.
30 +/
31 enum ResourceState {
32     Initial,
33     Alloc,
34     Valid,
35     Failed,
36     Invalid,
37 }
38 /++
39 + scb_cmdbuf_desc
40 + 
41 +     Creation parameters of a command buffer object. Used
42 +     in scb_make_cmdbuf().
43 + 
44 +     See doc section ESTIMATING COMMAND BUFFER SIZES about
45 +     how command buffer size can be estimated.
46 + 
47 +     When a label is set, sokol_cmdbuf.h will wrap
48 +     submitted commands with `sg_push/pop_debug_group()`.
49 +/
50 extern(C) struct CmdbufDesc {
51     size_t size = 0;
52     const(char)* label = null;
53 }
54 /++
55 + scb_cmdbuf_info
56 + 
57 +     Result of scb_query_cmdbuf_info.
58 +/
59 extern(C) struct CmdbufInfo {
60     size_t size = 0;
61     size_t remaining = 0;
62     bool overflown = false;
63 }
64 enum LogItem {
65     Ok,
66     Malloc_failed,
67     Cmdbuf_pool_exhausted,
68     Cmdbuf_overflow,
69     Cmdbuf_not_valid,
70     Submit_cmdbuf_overflown,
71     Submit_invalid_command,
72 }
73 /++
74 + scb_logger
75 + 
76 +     Used in scb_desc to provide a custom logging and error reporting
77 +     callback to sokol_cmdbuf.h
78 +/
79 extern(C) struct Logger {
80     extern(C) void function(const(char)*, uint, uint, const(char)*, uint, const(char)*, void*) func = null;
81     void* user_data = null;
82 }
83 /++
84 + scb_allocator
85 + 
86 +     Used in scb_desc to provide custom memory-alloc and -free functions
87 +     to sokol_cmdbuf.h. If memory management should be overridden, both the
88 +     alloc_fn and free_fn function must be provided (e.g. it's not valid to
89 +     override one function but not the other).
90 +/
91 extern(C) struct Allocator {
92     extern(C) void* function(size_t, void*) alloc_fn = null;
93     extern(C) void function(void*, void*) free_fn = null;
94     void* user_data = null;
95 }
96 /++
97 + scb_desc
98 + 
99 +     Initialization options passed into scb_setup.
100 +/
101 extern(C) struct Desc {
102     int cmdbuf_pool_size = 0;
103     Allocator allocator = {};
104     Logger logger = {};
105 }
106 /++
107 + setup sokol-cmdbuf
108 +/
109 extern(C) void scb_setup(const Desc* desc) @system @nogc nothrow pure;
110 void setup(scope ref Desc desc) @trusted @nogc nothrow pure {
111     scb_setup(&desc);
112 }
113 /++
114 + shutdown sokol-cmdbuf
115 +/
116 extern(C) void scb_shutdown() @system @nogc nothrow pure;
117 void shutdown() @trusted @nogc nothrow pure {
118     scb_shutdown();
119 }
120 /++
121 + create a cmdbuf object
122 +/
123 extern(C) Cmdbuf scb_make_cmdbuf(const CmdbufDesc* desc) @system @nogc nothrow pure;
124 Cmdbuf makeCmdbuf(scope ref CmdbufDesc desc) @trusted @nogc nothrow pure {
125     return scb_make_cmdbuf(&desc);
126 }
127 /++
128 + destroy cmdbuf object
129 +/
130 extern(C) void scb_destroy_cmdbuf(Cmdbuf cb) @system @nogc nothrow pure;
131 void destroyCmdbuf(Cmdbuf cb) @trusted @nogc nothrow pure {
132     scb_destroy_cmdbuf(cb);
133 }
134 /++
135 + submit command buffer to sokol-gfx and rewind the command buffer (call inside a sokol-gfx pass)
136 +/
137 extern(C) void scb_submit(Cmdbuf cb) @system @nogc nothrow pure;
138 void submit(Cmdbuf cb) @trusted @nogc nothrow pure {
139     scb_submit(cb);
140 }
141 /++
142 + reset a recorded command buffer, discarding its content
143 +/
144 extern(C) void scb_reset(Cmdbuf cb) @system @nogc nothrow pure;
145 void reset(Cmdbuf cb) @trusted @nogc nothrow pure {
146     scb_reset(cb);
147 }
148 /++
149 + record apply-viewport command (integer variant)
150 +/
151 extern(C) void scb_apply_viewport(Cmdbuf cb, int x, int y, int width, int height, bool origin_top_left) @system @nogc nothrow pure;
152 void applyViewport(Cmdbuf cb, int x, int y, int width, int height, bool origin_top_left) @trusted @nogc nothrow pure {
153     scb_apply_viewport(cb, x, y, width, height, origin_top_left);
154 }
155 /++
156 + record apply-viewport command (float variant)
157 +/
158 extern(C) void scb_apply_viewportf(Cmdbuf cb, float x, float y, float width, float height, bool origin_top_left) @system @nogc nothrow pure;
159 void applyViewportf(Cmdbuf cb, float x, float y, float width, float height, bool origin_top_left) @trusted @nogc nothrow pure {
160     scb_apply_viewportf(cb, x, y, width, height, origin_top_left);
161 }
162 /++
163 + record apply-scissor-rect command (integer variant)
164 +/
165 extern(C) void scb_apply_scissor_rect(Cmdbuf cb, int x, int y, int width, int height, bool origin_top_left) @system @nogc nothrow pure;
166 void applyScissorRect(Cmdbuf cb, int x, int y, int width, int height, bool origin_top_left) @trusted @nogc nothrow pure {
167     scb_apply_scissor_rect(cb, x, y, width, height, origin_top_left);
168 }
169 /++
170 + record apply-scissor-rect command (float variant)
171 +/
172 extern(C) void scb_apply_scissor_rectf(Cmdbuf cb, float x, float y, float width, float height, bool origin_top_left) @system @nogc nothrow pure;
173 void applyScissorRectf(Cmdbuf cb, float x, float y, float width, float height, bool origin_top_left) @trusted @nogc nothrow pure {
174     scb_apply_scissor_rectf(cb, x, y, width, height, origin_top_left);
175 }
176 /++
177 + record apply pipeline command
178 +/
179 extern(C) void scb_apply_pipeline(Cmdbuf cb, sg.Pipeline pip) @system @nogc nothrow pure;
180 void applyPipeline(Cmdbuf cb, sg.Pipeline pip) @trusted @nogc nothrow pure {
181     scb_apply_pipeline(cb, pip);
182 }
183 /++
184 + record apply bindings command
185 +/
186 extern(C) void scb_apply_bindings(Cmdbuf cb, const sg.Bindings* bindings) @system @nogc nothrow pure;
187 void applyBindings(Cmdbuf cb, scope ref sg.Bindings bindings) @trusted @nogc nothrow pure {
188     scb_apply_bindings(cb, &bindings);
189 }
190 /++
191 + record apply uniforms command
192 +/
193 extern(C) void scb_apply_uniforms(Cmdbuf cb, int ub_slot, const sg.Range* data) @system @nogc nothrow pure;
194 void applyUniforms(Cmdbuf cb, int ub_slot, scope ref sg.Range data) @trusted @nogc nothrow pure {
195     scb_apply_uniforms(cb, ub_slot, &data);
196 }
197 /++
198 + record draw command
199 +/
200 extern(C) void scb_draw(Cmdbuf cb, int base_element, int num_elements, int num_instances) @system @nogc nothrow pure;
201 void draw(Cmdbuf cb, int base_element, int num_elements, int num_instances) @trusted @nogc nothrow pure {
202     scb_draw(cb, base_element, num_elements, num_instances);
203 }
204 /++
205 + record draw-ex command
206 +/
207 extern(C) void scb_draw_ex(Cmdbuf cb, int base_element, int num_elements, int num_instances, int base_vertex, int base_instance) @system @nogc nothrow pure;
208 void drawEx(Cmdbuf cb, int base_element, int num_elements, int num_instances, int base_vertex, int base_instance) @trusted @nogc nothrow pure {
209     scb_draw_ex(cb, base_element, num_elements, num_instances, base_vertex, base_instance);
210 }
211 /++
212 + record draw-indirect command
213 +/
214 extern(C) void scb_draw_indirect(Cmdbuf cb, sg.Buffer buf, int offset) @system @nogc nothrow pure;
215 void drawIndirect(Cmdbuf cb, sg.Buffer buf, int offset) @trusted @nogc nothrow pure {
216     scb_draw_indirect(cb, buf, offset);
217 }
218 /++
219 + record dispatch command
220 +/
221 extern(C) void scb_dispatch(Cmdbuf cb, int num_groups_x, int num_groups_y, int num_groups_z) @system @nogc nothrow pure;
222 void dispatch(Cmdbuf cb, int num_groups_x, int num_groups_y, int num_groups_z) @trusted @nogc nothrow pure {
223     scb_dispatch(cb, num_groups_x, num_groups_y, num_groups_z);
224 }
225 /++
226 + record dispatch-indirect command
227 +/
228 extern(C) void scb_dispatch_indirect(Cmdbuf cb, sg.Buffer buf, int offset) @system @nogc nothrow pure;
229 void dispatchIndirect(Cmdbuf cb, sg.Buffer buf, int offset) @trusted @nogc nothrow pure {
230     scb_dispatch_indirect(cb, buf, offset);
231 }
232 /++
233 + query command buffer resource state (valid, failed, invalid)
234 +/
235 extern(C) ResourceState scb_query_cmdbuf_state(Cmdbuf cb) @system @nogc nothrow pure;
236 ResourceState queryCmdbufState(Cmdbuf cb) @trusted @nogc nothrow pure {
237     return scb_query_cmdbuf_state(cb);
238 }
239 /++
240 + query current command buffer properties
241 +/
242 extern(C) CmdbufInfo scb_query_cmdbuf_info(Cmdbuf cb) @system @nogc nothrow pure;
243 CmdbufInfo queryCmdbufInfo(Cmdbuf cb) @trusted @nogc nothrow pure {
244     return scb_query_cmdbuf_info(cb);
245 }