1#![allow(clippy::missing_safety_doc)]
8
9#[cfg(target_arch = "wasm32")]
10mod imports {
11 #[link(wasm_import_module = "gasm")]
12 unsafe extern "C" {
13 pub fn log(msg: *const u8, msg_len: u32);
15 pub fn has(name: *const u8, name_len: u32) -> i32;
17 pub fn time_ms() -> f64;
19 pub fn set_frame_rate(hz: f64);
21 pub fn video_present(rgba: *const u8, width: u32, height: u32, stride: u32);
23 pub fn video_set_aspect(num: u32, den: u32);
25 pub fn audio_config(sample_rate: u32, channels: u32);
27 pub fn audio_push(samples: *const f32, frames: u32);
29 pub fn input_pad(player: u32) -> u32;
31 pub fn text_input(dst: *mut u8, cap: u32) -> i32;
33 pub fn input_mode(flags: u32);
35 pub fn key_state(dst: *mut u8, len: u32) -> i32;
37 pub fn key_events(dst: *mut u8, cap: u32) -> i32;
39 pub fn pointer(dst: *mut u8, cap: u32) -> i32;
41 pub fn gamepad(slot: u32, dst: *mut u8, cap: u32) -> i32;
43 pub fn gamepad_name(slot: u32, dst: *mut u8, cap: u32) -> i32;
45 pub fn asset_size(name: *const u8, name_len: u32) -> i32;
47 pub fn asset_size64(name: *const u8, name_len: u32) -> i64;
49 pub fn asset_read(name: *const u8, name_len: u32, dst: *mut u8, cap: u32) -> i32;
51 pub fn asset_read_at(name: *const u8, name_len: u32, offset: u32, dst: *mut u8, len: u32) -> i32;
53 pub fn asset_read_at64(name: *const u8, name_len: u32, offset: u64, dst: *mut u8, len: u32) -> i32;
55 pub fn asset_count() -> u32;
57 pub fn asset_name(index: u32, dst: *mut u8, cap: u32) -> i32;
59 pub fn param(name: *const u8, name_len: u32, dst: *mut u8, cap: u32) -> i32;
61 pub fn set_title(title: *const u8, title_len: u32);
63 pub fn yield_frame();
65 }
66
67 #[link(wasm_import_module = "gasm:gfx")]
68 unsafe extern "C" {
69 #[link_name = "width"]
71 pub fn gfx_width() -> u32;
72 #[link_name = "height"]
74 pub fn gfx_height() -> u32;
75 #[link_name = "create_shader"]
77 pub fn gfx_create_shader(wgsl: *const u8, wgsl_len: u32) -> u32;
78 #[link_name = "create_buffer"]
80 pub fn gfx_create_buffer(size: u32, usage: u32) -> u32;
81 #[link_name = "create_pipeline"]
83 pub fn gfx_create_pipeline(json: *const u8, json_len: u32) -> u32;
84 #[link_name = "create_bind_group"]
86 pub fn gfx_create_bind_group(json: *const u8, json_len: u32) -> u32;
87 #[link_name = "create_bind_group_layout"]
89 pub fn gfx_create_bind_group_layout(json: *const u8, json_len: u32) -> u32;
90 #[link_name = "create_texture"]
92 pub fn gfx_create_texture(json: *const u8, json_len: u32) -> u32;
93 #[link_name = "write_texture"]
95 pub fn gfx_write_texture(texture: u32, mip: u32, x: u32, y: u32, width: u32, height: u32, data: *const u8, len: u32);
96 #[link_name = "create_sampler"]
98 pub fn gfx_create_sampler(json: *const u8, json_len: u32) -> u32;
99 #[link_name = "write_buffer"]
101 pub fn gfx_write_buffer(buffer: u32, offset: u32, data: *const u8, len: u32);
102 #[link_name = "begin_frame"]
104 pub fn gfx_begin_frame(r: f32, g: f32, b: f32, a: f32) -> u32;
105 #[link_name = "set_pipeline"]
106 pub fn gfx_set_pipeline(pipeline: u32);
107 #[link_name = "set_bind_group"]
108 pub fn gfx_set_bind_group(index: u32, bind_group: u32);
109 #[link_name = "set_bind_group_offsets"]
111 pub fn gfx_set_bind_group_offsets(index: u32, bind_group: u32, offsets: *const u32, count: u32);
112 #[link_name = "set_viewport"]
114 pub fn gfx_set_viewport(x: f32, y: f32, width: f32, height: f32, min_depth: f32, max_depth: f32);
115 #[link_name = "set_scissor_rect"]
117 pub fn gfx_set_scissor_rect(x: u32, y: u32, width: u32, height: u32);
118 #[link_name = "set_vertex_buffer"]
120 pub fn gfx_set_vertex_buffer(slot: u32, buffer: u32, offset: u32);
121 #[link_name = "set_index_buffer"]
123 pub fn gfx_set_index_buffer(buffer: u32, format: u32, offset: u32);
124 #[link_name = "draw"]
126 pub fn gfx_draw(vertex_count: u32, instance_count: u32, first_vertex: u32, first_instance: u32);
127 #[link_name = "draw_indexed"]
129 pub fn gfx_draw_indexed(index_count: u32, instance_count: u32, first_index: u32, base_vertex: i32, first_instance: u32);
130 #[link_name = "end_frame"]
132 pub fn gfx_end_frame();
133 #[link_name = "destroy"]
135 pub fn gfx_destroy(handle: u32);
136 }
137
138 #[link(wasm_import_module = "gasm:gl")]
139 unsafe extern "C" {
140 #[link_name = "width"]
142 pub fn gl_width() -> u32;
143 #[link_name = "height"]
145 pub fn gl_height() -> u32;
146 #[link_name = "frame_shown"]
148 pub fn gl_frame_shown() -> u32;
149 #[link_name = "present"]
151 pub fn gl_present();
152 #[link_name = "get_error"]
154 pub fn gl_get_error() -> u32;
155 #[link_name = "get_string"]
157 pub fn gl_get_string(name: u32, dst: *mut u8, cap: u32) -> i32;
158 #[link_name = "enable_extension"]
160 pub fn gl_enable_extension(name: *const u8, name_len: u32) -> u32;
161 #[link_name = "get_integerv"]
163 pub fn gl_get_integerv(pname: u32, dst: *mut u8, count: u32) -> i32;
164 #[link_name = "get_floatv"]
166 pub fn gl_get_floatv(pname: u32, dst: *mut u8, count: u32) -> i32;
167 #[link_name = "get_integer64v"]
169 pub fn gl_get_integer64v(pname: u32, dst: *mut u8, count: u32) -> i32;
170 #[link_name = "get_integeri_v"]
172 pub fn gl_get_integeri_v(target: u32, index: u32, dst: *mut u8, count: u32) -> i32;
173 #[link_name = "get_internalformativ"]
175 pub fn gl_get_internalformativ(target: u32, internalformat: u32, pname: u32, dst: *mut u8, count: u32) -> i32;
176 #[link_name = "get_shader_precision_format"]
178 pub fn gl_get_shader_precision_format(shadertype: u32, precisiontype: u32, dst: *mut u8);
179 #[link_name = "active_texture"]
180 pub fn gl_active_texture(texture: u32);
181 #[link_name = "blend_color"]
182 pub fn gl_blend_color(red: f32, green: f32, blue: f32, alpha: f32);
183 #[link_name = "blend_equation"]
184 pub fn gl_blend_equation(mode: u32);
185 #[link_name = "blend_equation_separate"]
186 pub fn gl_blend_equation_separate(mode_rgb: u32, mode_alpha: u32);
187 #[link_name = "blend_func"]
188 pub fn gl_blend_func(sfactor: u32, dfactor: u32);
189 #[link_name = "blend_func_separate"]
190 pub fn gl_blend_func_separate(src_rgb: u32, dst_rgb: u32, src_alpha: u32, dst_alpha: u32);
191 #[link_name = "clear"]
192 pub fn gl_clear(mask: u32);
193 #[link_name = "clear_color"]
194 pub fn gl_clear_color(red: f32, green: f32, blue: f32, alpha: f32);
195 #[link_name = "clear_depthf"]
196 pub fn gl_clear_depthf(depth: f32);
197 #[link_name = "clear_stencil"]
198 pub fn gl_clear_stencil(s: i32);
199 #[link_name = "color_mask"]
200 pub fn gl_color_mask(red: u32, green: u32, blue: u32, alpha: u32);
201 #[link_name = "cull_face"]
202 pub fn gl_cull_face(mode: u32);
203 #[link_name = "depth_func"]
204 pub fn gl_depth_func(func: u32);
205 #[link_name = "depth_mask"]
206 pub fn gl_depth_mask(flag: u32);
207 #[link_name = "depth_rangef"]
208 pub fn gl_depth_rangef(near: f32, far: f32);
209 #[link_name = "disable"]
210 pub fn gl_disable(cap: u32);
211 #[link_name = "enable"]
212 pub fn gl_enable(cap: u32);
213 #[link_name = "is_enabled"]
214 pub fn gl_is_enabled(cap: u32) -> u32;
215 #[link_name = "front_face"]
216 pub fn gl_front_face(mode: u32);
217 #[link_name = "hint"]
218 pub fn gl_hint(target: u32, mode: u32);
219 #[link_name = "line_width"]
220 pub fn gl_line_width(width: f32);
221 #[link_name = "pixel_storei"]
222 pub fn gl_pixel_storei(pname: u32, param: i32);
223 #[link_name = "polygon_offset"]
224 pub fn gl_polygon_offset(factor: f32, units: f32);
225 #[link_name = "sample_coverage"]
226 pub fn gl_sample_coverage(value: f32, invert: u32);
227 #[link_name = "scissor"]
228 pub fn gl_scissor(x: i32, y: i32, width: i32, height: i32);
229 #[link_name = "viewport"]
230 pub fn gl_viewport(x: i32, y: i32, width: i32, height: i32);
231 #[link_name = "stencil_func"]
232 pub fn gl_stencil_func(func: u32, r#ref: i32, mask: u32);
233 #[link_name = "stencil_func_separate"]
234 pub fn gl_stencil_func_separate(face: u32, func: u32, r#ref: i32, mask: u32);
235 #[link_name = "stencil_mask"]
236 pub fn gl_stencil_mask(mask: u32);
237 #[link_name = "stencil_mask_separate"]
238 pub fn gl_stencil_mask_separate(face: u32, mask: u32);
239 #[link_name = "stencil_op"]
240 pub fn gl_stencil_op(fail: u32, zfail: u32, zpass: u32);
241 #[link_name = "stencil_op_separate"]
242 pub fn gl_stencil_op_separate(face: u32, sfail: u32, dpfail: u32, dppass: u32);
243 #[link_name = "finish"]
244 pub fn gl_finish();
245 #[link_name = "flush"]
246 pub fn gl_flush();
247 #[link_name = "create_buffer"]
249 pub fn gl_create_buffer() -> u32;
250 #[link_name = "delete_buffer"]
251 pub fn gl_delete_buffer(buffer: u32);
252 #[link_name = "is_buffer"]
253 pub fn gl_is_buffer(buffer: u32) -> u32;
254 #[link_name = "bind_buffer"]
255 pub fn gl_bind_buffer(target: u32, buffer: u32);
256 #[link_name = "bind_buffer_base"]
257 pub fn gl_bind_buffer_base(target: u32, index: u32, buffer: u32);
258 #[link_name = "bind_buffer_range"]
259 pub fn gl_bind_buffer_range(target: u32, index: u32, buffer: u32, offset: u32, size: u32);
260 #[link_name = "buffer_data"]
262 pub fn gl_buffer_data(target: u32, data: *const u8, len: u32, usage: u32);
263 #[link_name = "buffer_sub_data"]
264 pub fn gl_buffer_sub_data(target: u32, offset: u32, data: *const u8, len: u32);
265 #[link_name = "copy_buffer_sub_data"]
266 pub fn gl_copy_buffer_sub_data(read_target: u32, write_target: u32, read_offset: u32, write_offset: u32, size: u32);
267 #[link_name = "get_buffer_sub_data"]
269 pub fn gl_get_buffer_sub_data(target: u32, offset: u32, dst: *mut u8, len: u32);
270 #[link_name = "get_buffer_parameteriv"]
271 pub fn gl_get_buffer_parameteriv(target: u32, pname: u32) -> i32;
272 #[link_name = "create_vertex_array"]
273 pub fn gl_create_vertex_array() -> u32;
274 #[link_name = "delete_vertex_array"]
275 pub fn gl_delete_vertex_array(array: u32);
276 #[link_name = "is_vertex_array"]
277 pub fn gl_is_vertex_array(array: u32) -> u32;
278 #[link_name = "bind_vertex_array"]
279 pub fn gl_bind_vertex_array(array: u32);
280 #[link_name = "enable_vertex_attrib_array"]
281 pub fn gl_enable_vertex_attrib_array(index: u32);
282 #[link_name = "disable_vertex_attrib_array"]
283 pub fn gl_disable_vertex_attrib_array(index: u32);
284 #[link_name = "vertex_attrib_pointer"]
286 pub fn gl_vertex_attrib_pointer(index: u32, size: i32, r#type: u32, normalized: u32, stride: i32, offset: u32);
287 #[link_name = "vertex_attrib_ipointer"]
288 pub fn gl_vertex_attrib_ipointer(index: u32, size: i32, r#type: u32, stride: i32, offset: u32);
289 #[link_name = "vertex_attrib_divisor"]
290 pub fn gl_vertex_attrib_divisor(index: u32, divisor: u32);
291 #[link_name = "vertex_attrib4f"]
292 pub fn gl_vertex_attrib4f(index: u32, x: f32, y: f32, z: f32, w: f32);
293 #[link_name = "vertex_attribi4i"]
294 pub fn gl_vertex_attribi4i(index: u32, x: i32, y: i32, z: i32, w: i32);
295 #[link_name = "vertex_attribi4ui"]
296 pub fn gl_vertex_attribi4ui(index: u32, x: u32, y: u32, z: u32, w: u32);
297 #[link_name = "get_vertex_attribiv"]
298 pub fn gl_get_vertex_attribiv(index: u32, pname: u32) -> i32;
299 #[link_name = "get_vertex_attribfv"]
301 pub fn gl_get_vertex_attribfv(index: u32, pname: u32, dst: *mut u8, count: u32) -> i32;
302 #[link_name = "get_vertex_attrib_offset"]
303 pub fn gl_get_vertex_attrib_offset(index: u32, pname: u32) -> u32;
304 #[link_name = "draw_arrays"]
305 pub fn gl_draw_arrays(mode: u32, first: i32, count: i32);
306 #[link_name = "draw_elements"]
308 pub fn gl_draw_elements(mode: u32, count: i32, r#type: u32, offset: u32);
309 #[link_name = "draw_arrays_instanced"]
310 pub fn gl_draw_arrays_instanced(mode: u32, first: i32, count: i32, instances: i32);
311 #[link_name = "draw_elements_instanced"]
312 pub fn gl_draw_elements_instanced(mode: u32, count: i32, r#type: u32, offset: u32, instances: i32);
313 #[link_name = "draw_range_elements"]
314 pub fn gl_draw_range_elements(mode: u32, start: u32, end: u32, count: i32, r#type: u32, offset: u32);
315 #[link_name = "draw_buffers"]
317 pub fn gl_draw_buffers(bufs: *const u8, count: u32);
318 #[link_name = "clear_bufferiv"]
320 pub fn gl_clear_bufferiv(buffer: u32, drawbuffer: i32, value: *const u8, count: u32);
321 #[link_name = "clear_bufferuiv"]
322 pub fn gl_clear_bufferuiv(buffer: u32, drawbuffer: i32, value: *const u8, count: u32);
323 #[link_name = "clear_bufferfv"]
324 pub fn gl_clear_bufferfv(buffer: u32, drawbuffer: i32, value: *const u8, count: u32);
325 #[link_name = "clear_bufferfi"]
326 pub fn gl_clear_bufferfi(buffer: u32, drawbuffer: i32, depth: f32, stencil: i32);
327 #[link_name = "create_texture"]
328 pub fn gl_create_texture() -> u32;
329 #[link_name = "delete_texture"]
330 pub fn gl_delete_texture(texture: u32);
331 #[link_name = "is_texture"]
332 pub fn gl_is_texture(texture: u32) -> u32;
333 #[link_name = "bind_texture"]
334 pub fn gl_bind_texture(target: u32, texture: u32);
335 #[link_name = "tex_parameteri"]
336 pub fn gl_tex_parameteri(target: u32, pname: u32, param: i32);
337 #[link_name = "tex_parameterf"]
338 pub fn gl_tex_parameterf(target: u32, pname: u32, param: f32);
339 #[link_name = "get_tex_parameteriv"]
340 pub fn gl_get_tex_parameteriv(target: u32, pname: u32) -> i32;
341 #[link_name = "get_tex_parameterfv"]
342 pub fn gl_get_tex_parameterfv(target: u32, pname: u32) -> f32;
343 #[link_name = "tex_image_2d"]
345 pub fn gl_tex_image_2d(target: u32, level: i32, internalformat: i32, width: i32, height: i32, border: i32, format: u32, r#type: u32, pixels: *const u8, len: u32);
346 #[link_name = "tex_image_3d"]
347 pub fn gl_tex_image_3d(target: u32, level: i32, internalformat: i32, width: i32, height: i32, depth: i32, border: i32, format: u32, r#type: u32, pixels: *const u8, len: u32);
348 #[link_name = "tex_sub_image_2d"]
349 pub fn gl_tex_sub_image_2d(target: u32, level: i32, x: i32, y: i32, width: i32, height: i32, format: u32, r#type: u32, pixels: *const u8, len: u32);
350 #[link_name = "tex_sub_image_3d"]
351 pub fn gl_tex_sub_image_3d(target: u32, level: i32, x: i32, y: i32, z: i32, width: i32, height: i32, depth: i32, format: u32, r#type: u32, pixels: *const u8, len: u32);
352 #[link_name = "tex_storage_2d"]
353 pub fn gl_tex_storage_2d(target: u32, levels: i32, internalformat: u32, width: i32, height: i32);
354 #[link_name = "tex_storage_3d"]
355 pub fn gl_tex_storage_3d(target: u32, levels: i32, internalformat: u32, width: i32, height: i32, depth: i32);
356 #[link_name = "compressed_tex_image_2d"]
357 pub fn gl_compressed_tex_image_2d(target: u32, level: i32, internalformat: u32, width: i32, height: i32, border: i32, data: *const u8, len: u32);
358 #[link_name = "compressed_tex_image_3d"]
359 pub fn gl_compressed_tex_image_3d(target: u32, level: i32, internalformat: u32, width: i32, height: i32, depth: i32, border: i32, data: *const u8, len: u32);
360 #[link_name = "compressed_tex_sub_image_2d"]
361 pub fn gl_compressed_tex_sub_image_2d(target: u32, level: i32, x: i32, y: i32, width: i32, height: i32, format: u32, data: *const u8, len: u32);
362 #[link_name = "compressed_tex_sub_image_3d"]
363 pub fn gl_compressed_tex_sub_image_3d(target: u32, level: i32, x: i32, y: i32, z: i32, width: i32, height: i32, depth: i32, format: u32, data: *const u8, len: u32);
364 #[link_name = "copy_tex_image_2d"]
365 pub fn gl_copy_tex_image_2d(target: u32, level: i32, internalformat: u32, x: i32, y: i32, width: i32, height: i32, border: i32);
366 #[link_name = "copy_tex_sub_image_2d"]
367 pub fn gl_copy_tex_sub_image_2d(target: u32, level: i32, xoffset: i32, yoffset: i32, x: i32, y: i32, width: i32, height: i32);
368 #[link_name = "copy_tex_sub_image_3d"]
369 pub fn gl_copy_tex_sub_image_3d(target: u32, level: i32, xoffset: i32, yoffset: i32, zoffset: i32, x: i32, y: i32, width: i32, height: i32);
370 #[link_name = "generate_mipmap"]
372 pub fn gl_generate_mipmap(target: u32);
373 #[link_name = "create_sampler"]
374 pub fn gl_create_sampler() -> u32;
375 #[link_name = "delete_sampler"]
376 pub fn gl_delete_sampler(sampler: u32);
377 #[link_name = "is_sampler"]
378 pub fn gl_is_sampler(sampler: u32) -> u32;
379 #[link_name = "bind_sampler"]
380 pub fn gl_bind_sampler(unit: u32, sampler: u32);
381 #[link_name = "sampler_parameteri"]
382 pub fn gl_sampler_parameteri(sampler: u32, pname: u32, param: i32);
383 #[link_name = "sampler_parameterf"]
384 pub fn gl_sampler_parameterf(sampler: u32, pname: u32, param: f32);
385 #[link_name = "get_sampler_parameteriv"]
386 pub fn gl_get_sampler_parameteriv(sampler: u32, pname: u32) -> i32;
387 #[link_name = "get_sampler_parameterfv"]
388 pub fn gl_get_sampler_parameterfv(sampler: u32, pname: u32) -> f32;
389 #[link_name = "create_framebuffer"]
390 pub fn gl_create_framebuffer() -> u32;
391 #[link_name = "delete_framebuffer"]
392 pub fn gl_delete_framebuffer(framebuffer: u32);
393 #[link_name = "is_framebuffer"]
394 pub fn gl_is_framebuffer(framebuffer: u32) -> u32;
395 #[link_name = "bind_framebuffer"]
397 pub fn gl_bind_framebuffer(target: u32, framebuffer: u32);
398 #[link_name = "check_framebuffer_status"]
399 pub fn gl_check_framebuffer_status(target: u32) -> u32;
400 #[link_name = "framebuffer_texture_2d"]
401 pub fn gl_framebuffer_texture_2d(target: u32, attachment: u32, textarget: u32, texture: u32, level: i32);
402 #[link_name = "framebuffer_texture_layer"]
403 pub fn gl_framebuffer_texture_layer(target: u32, attachment: u32, texture: u32, level: i32, layer: i32);
404 #[link_name = "framebuffer_renderbuffer"]
405 pub fn gl_framebuffer_renderbuffer(target: u32, attachment: u32, renderbuffertarget: u32, renderbuffer: u32);
406 #[link_name = "get_framebuffer_attachment_parameteriv"]
407 pub fn gl_get_framebuffer_attachment_parameteriv(target: u32, attachment: u32, pname: u32) -> i32;
408 #[link_name = "blit_framebuffer"]
409 pub fn gl_blit_framebuffer(src_x0: i32, src_y0: i32, src_x1: i32, src_y1: i32, dst_x0: i32, dst_y0: i32, dst_x1: i32, dst_y1: i32, mask: u32, filter: u32);
410 #[link_name = "invalidate_framebuffer"]
411 pub fn gl_invalidate_framebuffer(target: u32, attachments: *const u8, count: u32);
412 #[link_name = "invalidate_sub_framebuffer"]
413 pub fn gl_invalidate_sub_framebuffer(target: u32, attachments: *const u8, count: u32, x: i32, y: i32, width: i32, height: i32);
414 #[link_name = "read_buffer"]
415 pub fn gl_read_buffer(src: u32);
416 #[link_name = "read_pixels"]
418 pub fn gl_read_pixels(x: i32, y: i32, width: i32, height: i32, format: u32, r#type: u32, dst: *mut u8, len: u32);
419 #[link_name = "create_renderbuffer"]
420 pub fn gl_create_renderbuffer() -> u32;
421 #[link_name = "delete_renderbuffer"]
422 pub fn gl_delete_renderbuffer(renderbuffer: u32);
423 #[link_name = "is_renderbuffer"]
424 pub fn gl_is_renderbuffer(renderbuffer: u32) -> u32;
425 #[link_name = "bind_renderbuffer"]
426 pub fn gl_bind_renderbuffer(target: u32, renderbuffer: u32);
427 #[link_name = "renderbuffer_storage"]
428 pub fn gl_renderbuffer_storage(target: u32, internalformat: u32, width: i32, height: i32);
429 #[link_name = "renderbuffer_storage_multisample"]
430 pub fn gl_renderbuffer_storage_multisample(target: u32, samples: i32, internalformat: u32, width: i32, height: i32);
431 #[link_name = "get_renderbuffer_parameteriv"]
432 pub fn gl_get_renderbuffer_parameteriv(target: u32, pname: u32) -> i32;
433 #[link_name = "create_shader"]
434 pub fn gl_create_shader(r#type: u32) -> u32;
435 #[link_name = "delete_shader"]
436 pub fn gl_delete_shader(shader: u32);
437 #[link_name = "is_shader"]
438 pub fn gl_is_shader(shader: u32) -> u32;
439 #[link_name = "shader_source"]
441 pub fn gl_shader_source(shader: u32, source: *const u8, source_len: u32);
442 #[link_name = "compile_shader"]
443 pub fn gl_compile_shader(shader: u32);
444 #[link_name = "get_shaderiv"]
445 pub fn gl_get_shaderiv(shader: u32, pname: u32) -> i32;
446 #[link_name = "get_shader_info_log"]
447 pub fn gl_get_shader_info_log(shader: u32, dst: *mut u8, cap: u32) -> i32;
448 #[link_name = "get_shader_source"]
449 pub fn gl_get_shader_source(shader: u32, dst: *mut u8, cap: u32) -> i32;
450 #[link_name = "create_program"]
451 pub fn gl_create_program() -> u32;
452 #[link_name = "delete_program"]
453 pub fn gl_delete_program(program: u32);
454 #[link_name = "is_program"]
455 pub fn gl_is_program(program: u32) -> u32;
456 #[link_name = "attach_shader"]
457 pub fn gl_attach_shader(program: u32, shader: u32);
458 #[link_name = "detach_shader"]
459 pub fn gl_detach_shader(program: u32, shader: u32);
460 #[link_name = "link_program"]
461 pub fn gl_link_program(program: u32);
462 #[link_name = "use_program"]
463 pub fn gl_use_program(program: u32);
464 #[link_name = "validate_program"]
465 pub fn gl_validate_program(program: u32);
466 #[link_name = "get_programiv"]
467 pub fn gl_get_programiv(program: u32, pname: u32) -> i32;
468 #[link_name = "get_program_info_log"]
469 pub fn gl_get_program_info_log(program: u32, dst: *mut u8, cap: u32) -> i32;
470 #[link_name = "get_attached_shaders"]
472 pub fn gl_get_attached_shaders(program: u32, dst: *mut u8, count: u32) -> i32;
473 #[link_name = "bind_attrib_location"]
474 pub fn gl_bind_attrib_location(program: u32, index: u32, name: *const u8, name_len: u32);
475 #[link_name = "get_attrib_location"]
476 pub fn gl_get_attrib_location(program: u32, name: *const u8, name_len: u32) -> i32;
477 #[link_name = "get_frag_data_location"]
478 pub fn gl_get_frag_data_location(program: u32, name: *const u8, name_len: u32) -> i32;
479 #[link_name = "get_active_attrib"]
481 pub fn gl_get_active_attrib(program: u32, index: u32, name: *mut u8, cap: u32, info: *mut u8) -> i32;
482 #[link_name = "get_active_uniform"]
483 pub fn gl_get_active_uniform(program: u32, index: u32, name: *mut u8, cap: u32, info: *mut u8) -> i32;
484 #[link_name = "get_uniform_location"]
486 pub fn gl_get_uniform_location(program: u32, name: *const u8, name_len: u32) -> i32;
487 #[link_name = "get_uniform_index"]
489 pub fn gl_get_uniform_index(program: u32, name: *const u8, name_len: u32) -> u32;
490 #[link_name = "get_active_uniformsiv"]
492 pub fn gl_get_active_uniformsiv(program: u32, indices: *const u8, count: u32, pname: u32, dst: *mut u8);
493 #[link_name = "get_uniform_block_index"]
494 pub fn gl_get_uniform_block_index(program: u32, name: *const u8, name_len: u32) -> u32;
495 #[link_name = "get_active_uniform_block_name"]
496 pub fn gl_get_active_uniform_block_name(program: u32, index: u32, dst: *mut u8, cap: u32) -> i32;
497 #[link_name = "get_active_uniform_blockiv"]
498 pub fn gl_get_active_uniform_blockiv(program: u32, index: u32, pname: u32, dst: *mut u8, count: u32) -> i32;
499 #[link_name = "uniform_block_binding"]
500 pub fn gl_uniform_block_binding(program: u32, index: u32, binding: u32);
501 #[link_name = "get_uniformfv"]
502 pub fn gl_get_uniformfv(program: u32, location: i32, dst: *mut u8, count: u32) -> i32;
503 #[link_name = "get_uniformiv"]
504 pub fn gl_get_uniformiv(program: u32, location: i32, dst: *mut u8, count: u32) -> i32;
505 #[link_name = "get_uniformuiv"]
506 pub fn gl_get_uniformuiv(program: u32, location: i32, dst: *mut u8, count: u32) -> i32;
507 #[link_name = "transform_feedback_varyings"]
509 pub fn gl_transform_feedback_varyings(program: u32, names: *const u8, len: u32, count: u32, buffer_mode: u32);
510 #[link_name = "get_transform_feedback_varying"]
511 pub fn gl_get_transform_feedback_varying(program: u32, index: u32, name: *mut u8, cap: u32, info: *mut u8) -> i32;
512 #[link_name = "uniform1f"]
513 pub fn gl_uniform1f(location: i32, x: f32);
514 #[link_name = "uniform2f"]
515 pub fn gl_uniform2f(location: i32, x: f32, y: f32);
516 #[link_name = "uniform3f"]
517 pub fn gl_uniform3f(location: i32, x: f32, y: f32, z: f32);
518 #[link_name = "uniform4f"]
519 pub fn gl_uniform4f(location: i32, x: f32, y: f32, z: f32, w: f32);
520 #[link_name = "uniform1i"]
521 pub fn gl_uniform1i(location: i32, x: i32);
522 #[link_name = "uniform2i"]
523 pub fn gl_uniform2i(location: i32, x: i32, y: i32);
524 #[link_name = "uniform3i"]
525 pub fn gl_uniform3i(location: i32, x: i32, y: i32, z: i32);
526 #[link_name = "uniform4i"]
527 pub fn gl_uniform4i(location: i32, x: i32, y: i32, z: i32, w: i32);
528 #[link_name = "uniform1ui"]
529 pub fn gl_uniform1ui(location: i32, x: u32);
530 #[link_name = "uniform2ui"]
531 pub fn gl_uniform2ui(location: i32, x: u32, y: u32);
532 #[link_name = "uniform3ui"]
533 pub fn gl_uniform3ui(location: i32, x: u32, y: u32, z: u32);
534 #[link_name = "uniform4ui"]
535 pub fn gl_uniform4ui(location: i32, x: u32, y: u32, z: u32, w: u32);
536 #[link_name = "uniform1fv"]
538 pub fn gl_uniform1fv(location: i32, count: i32, value: *const u8);
539 #[link_name = "uniform2fv"]
540 pub fn gl_uniform2fv(location: i32, count: i32, value: *const u8);
541 #[link_name = "uniform3fv"]
542 pub fn gl_uniform3fv(location: i32, count: i32, value: *const u8);
543 #[link_name = "uniform4fv"]
544 pub fn gl_uniform4fv(location: i32, count: i32, value: *const u8);
545 #[link_name = "uniform1iv"]
546 pub fn gl_uniform1iv(location: i32, count: i32, value: *const u8);
547 #[link_name = "uniform2iv"]
548 pub fn gl_uniform2iv(location: i32, count: i32, value: *const u8);
549 #[link_name = "uniform3iv"]
550 pub fn gl_uniform3iv(location: i32, count: i32, value: *const u8);
551 #[link_name = "uniform4iv"]
552 pub fn gl_uniform4iv(location: i32, count: i32, value: *const u8);
553 #[link_name = "uniform1uiv"]
554 pub fn gl_uniform1uiv(location: i32, count: i32, value: *const u8);
555 #[link_name = "uniform2uiv"]
556 pub fn gl_uniform2uiv(location: i32, count: i32, value: *const u8);
557 #[link_name = "uniform3uiv"]
558 pub fn gl_uniform3uiv(location: i32, count: i32, value: *const u8);
559 #[link_name = "uniform4uiv"]
560 pub fn gl_uniform4uiv(location: i32, count: i32, value: *const u8);
561 #[link_name = "uniform_matrix2fv"]
562 pub fn gl_uniform_matrix2fv(location: i32, count: i32, transpose: u32, value: *const u8);
563 #[link_name = "uniform_matrix3fv"]
564 pub fn gl_uniform_matrix3fv(location: i32, count: i32, transpose: u32, value: *const u8);
565 #[link_name = "uniform_matrix4fv"]
566 pub fn gl_uniform_matrix4fv(location: i32, count: i32, transpose: u32, value: *const u8);
567 #[link_name = "uniform_matrix2x3fv"]
568 pub fn gl_uniform_matrix2x3fv(location: i32, count: i32, transpose: u32, value: *const u8);
569 #[link_name = "uniform_matrix3x2fv"]
570 pub fn gl_uniform_matrix3x2fv(location: i32, count: i32, transpose: u32, value: *const u8);
571 #[link_name = "uniform_matrix2x4fv"]
572 pub fn gl_uniform_matrix2x4fv(location: i32, count: i32, transpose: u32, value: *const u8);
573 #[link_name = "uniform_matrix4x2fv"]
574 pub fn gl_uniform_matrix4x2fv(location: i32, count: i32, transpose: u32, value: *const u8);
575 #[link_name = "uniform_matrix3x4fv"]
576 pub fn gl_uniform_matrix3x4fv(location: i32, count: i32, transpose: u32, value: *const u8);
577 #[link_name = "uniform_matrix4x3fv"]
578 pub fn gl_uniform_matrix4x3fv(location: i32, count: i32, transpose: u32, value: *const u8);
579 #[link_name = "create_query"]
580 pub fn gl_create_query() -> u32;
581 #[link_name = "delete_query"]
582 pub fn gl_delete_query(query: u32);
583 #[link_name = "is_query"]
584 pub fn gl_is_query(query: u32) -> u32;
585 #[link_name = "begin_query"]
586 pub fn gl_begin_query(target: u32, query: u32);
587 #[link_name = "end_query"]
588 pub fn gl_end_query(target: u32);
589 #[link_name = "get_queryiv"]
591 pub fn gl_get_queryiv(target: u32, pname: u32) -> u32;
592 #[link_name = "get_query_objectuiv"]
594 pub fn gl_get_query_objectuiv(query: u32, pname: u32) -> u32;
595 #[link_name = "fence_sync"]
597 pub fn gl_fence_sync(condition: u32, flags: u32) -> u32;
598 #[link_name = "is_sync"]
599 pub fn gl_is_sync(sync: u32) -> u32;
600 #[link_name = "delete_sync"]
601 pub fn gl_delete_sync(sync: u32);
602 #[link_name = "client_wait_sync"]
604 pub fn gl_client_wait_sync(sync: u32, flags: u32, timeout: u64) -> u32;
605 #[link_name = "wait_sync"]
606 pub fn gl_wait_sync(sync: u32, flags: u32, timeout: u64);
607 #[link_name = "get_synciv"]
608 pub fn gl_get_synciv(sync: u32, pname: u32) -> i32;
609 #[link_name = "create_transform_feedback"]
610 pub fn gl_create_transform_feedback() -> u32;
611 #[link_name = "delete_transform_feedback"]
612 pub fn gl_delete_transform_feedback(tf: u32);
613 #[link_name = "is_transform_feedback"]
614 pub fn gl_is_transform_feedback(tf: u32) -> u32;
615 #[link_name = "bind_transform_feedback"]
616 pub fn gl_bind_transform_feedback(target: u32, tf: u32);
617 #[link_name = "begin_transform_feedback"]
618 pub fn gl_begin_transform_feedback(primitive_mode: u32);
619 #[link_name = "end_transform_feedback"]
620 pub fn gl_end_transform_feedback();
621 #[link_name = "pause_transform_feedback"]
622 pub fn gl_pause_transform_feedback();
623 #[link_name = "resume_transform_feedback"]
624 pub fn gl_resume_transform_feedback();
625 }
626
627 #[link(wasm_import_module = "gasm:net")]
628 unsafe extern "C" {
629 #[link_name = "open"]
631 pub fn net_open(url: *const u8, url_len: u32) -> i32;
632 #[link_name = "state"]
634 pub fn net_state(conn: i32) -> u32;
635 #[link_name = "send"]
637 pub fn net_send(conn: i32, data: *const u8, len: u32) -> i32;
638 #[link_name = "recv"]
640 pub fn net_recv(conn: i32, dst: *mut u8, cap: u32) -> i32;
641 #[link_name = "close"]
643 pub fn net_close(conn: i32);
644 }
645
646 #[link(wasm_import_module = "gasm:storage")]
647 unsafe extern "C" {
648 #[link_name = "get"]
650 pub fn storage_get(key: *const u8, key_len: u32, dst: *mut u8, cap: u32) -> i32;
651 #[link_name = "set"]
653 pub fn storage_set(key: *const u8, key_len: u32, data: *const u8, len: u32) -> i32;
654 #[link_name = "delete"]
656 pub fn storage_delete(key: *const u8, key_len: u32) -> i32;
657 #[link_name = "count"]
659 pub fn storage_count() -> u32;
660 #[link_name = "key"]
662 pub fn storage_key(index: u32, dst: *mut u8, cap: u32) -> i32;
663 }
664
665 #[link(wasm_import_module = "wasi_snapshot_preview1")]
666 unsafe extern "C" {
667 pub fn proc_exit(code: i32) -> !;
669 }
670}
671
672#[cfg(target_arch = "wasm32")]
673pub use imports::*;
674
675#[cfg(not(target_arch = "wasm32"))]
676pub use crate::native::abi::*;
677
678pub const IMPORTS: [&str; 290] = [
680 "gasm", "gasm.log", "gasm.has", "gasm.time_ms",
681 "gasm.set_frame_rate", "gasm.video_present", "gasm.video_set_aspect", "gasm.audio_config",
682 "gasm.audio_push", "gasm.input_pad", "gasm.text_input", "gasm.input_mode",
683 "gasm.key_state", "gasm.key_events", "gasm.pointer", "gasm.gamepad",
684 "gasm.gamepad_name", "gasm.asset_size", "gasm.asset_size64", "gasm.asset_read",
685 "gasm.asset_read_at", "gasm.asset_read_at64", "gasm.asset_count", "gasm.asset_name",
686 "gasm.param", "gasm.set_title", "gasm.yield_frame", "gasm:gfx",
687 "gasm:gfx.width", "gasm:gfx.height", "gasm:gfx.create_shader", "gasm:gfx.create_buffer",
688 "gasm:gfx.create_pipeline", "gasm:gfx.create_bind_group", "gasm:gfx.create_bind_group_layout", "gasm:gfx.create_texture",
689 "gasm:gfx.write_texture", "gasm:gfx.create_sampler", "gasm:gfx.write_buffer", "gasm:gfx.begin_frame",
690 "gasm:gfx.set_pipeline", "gasm:gfx.set_bind_group", "gasm:gfx.set_bind_group_offsets", "gasm:gfx.set_viewport",
691 "gasm:gfx.set_scissor_rect", "gasm:gfx.set_vertex_buffer", "gasm:gfx.set_index_buffer", "gasm:gfx.draw",
692 "gasm:gfx.draw_indexed", "gasm:gfx.end_frame", "gasm:gfx.destroy", "gasm:gl",
693 "gasm:gl.width", "gasm:gl.height", "gasm:gl.frame_shown", "gasm:gl.present",
694 "gasm:gl.get_error", "gasm:gl.get_string", "gasm:gl.enable_extension", "gasm:gl.get_integerv",
695 "gasm:gl.get_floatv", "gasm:gl.get_integer64v", "gasm:gl.get_integeri_v", "gasm:gl.get_internalformativ",
696 "gasm:gl.get_shader_precision_format", "gasm:gl.active_texture", "gasm:gl.blend_color", "gasm:gl.blend_equation",
697 "gasm:gl.blend_equation_separate", "gasm:gl.blend_func", "gasm:gl.blend_func_separate", "gasm:gl.clear",
698 "gasm:gl.clear_color", "gasm:gl.clear_depthf", "gasm:gl.clear_stencil", "gasm:gl.color_mask",
699 "gasm:gl.cull_face", "gasm:gl.depth_func", "gasm:gl.depth_mask", "gasm:gl.depth_rangef",
700 "gasm:gl.disable", "gasm:gl.enable", "gasm:gl.is_enabled", "gasm:gl.front_face",
701 "gasm:gl.hint", "gasm:gl.line_width", "gasm:gl.pixel_storei", "gasm:gl.polygon_offset",
702 "gasm:gl.sample_coverage", "gasm:gl.scissor", "gasm:gl.viewport", "gasm:gl.stencil_func",
703 "gasm:gl.stencil_func_separate", "gasm:gl.stencil_mask", "gasm:gl.stencil_mask_separate", "gasm:gl.stencil_op",
704 "gasm:gl.stencil_op_separate", "gasm:gl.finish", "gasm:gl.flush", "gasm:gl.create_buffer",
705 "gasm:gl.delete_buffer", "gasm:gl.is_buffer", "gasm:gl.bind_buffer", "gasm:gl.bind_buffer_base",
706 "gasm:gl.bind_buffer_range", "gasm:gl.buffer_data", "gasm:gl.buffer_sub_data", "gasm:gl.copy_buffer_sub_data",
707 "gasm:gl.get_buffer_sub_data", "gasm:gl.get_buffer_parameteriv", "gasm:gl.create_vertex_array", "gasm:gl.delete_vertex_array",
708 "gasm:gl.is_vertex_array", "gasm:gl.bind_vertex_array", "gasm:gl.enable_vertex_attrib_array", "gasm:gl.disable_vertex_attrib_array",
709 "gasm:gl.vertex_attrib_pointer", "gasm:gl.vertex_attrib_ipointer", "gasm:gl.vertex_attrib_divisor", "gasm:gl.vertex_attrib4f",
710 "gasm:gl.vertex_attribi4i", "gasm:gl.vertex_attribi4ui", "gasm:gl.get_vertex_attribiv", "gasm:gl.get_vertex_attribfv",
711 "gasm:gl.get_vertex_attrib_offset", "gasm:gl.draw_arrays", "gasm:gl.draw_elements", "gasm:gl.draw_arrays_instanced",
712 "gasm:gl.draw_elements_instanced", "gasm:gl.draw_range_elements", "gasm:gl.draw_buffers", "gasm:gl.clear_bufferiv",
713 "gasm:gl.clear_bufferuiv", "gasm:gl.clear_bufferfv", "gasm:gl.clear_bufferfi", "gasm:gl.create_texture",
714 "gasm:gl.delete_texture", "gasm:gl.is_texture", "gasm:gl.bind_texture", "gasm:gl.tex_parameteri",
715 "gasm:gl.tex_parameterf", "gasm:gl.get_tex_parameteriv", "gasm:gl.get_tex_parameterfv", "gasm:gl.tex_image_2d",
716 "gasm:gl.tex_image_3d", "gasm:gl.tex_sub_image_2d", "gasm:gl.tex_sub_image_3d", "gasm:gl.tex_storage_2d",
717 "gasm:gl.tex_storage_3d", "gasm:gl.compressed_tex_image_2d", "gasm:gl.compressed_tex_image_3d", "gasm:gl.compressed_tex_sub_image_2d",
718 "gasm:gl.compressed_tex_sub_image_3d", "gasm:gl.copy_tex_image_2d", "gasm:gl.copy_tex_sub_image_2d", "gasm:gl.copy_tex_sub_image_3d",
719 "gasm:gl.generate_mipmap", "gasm:gl.create_sampler", "gasm:gl.delete_sampler", "gasm:gl.is_sampler",
720 "gasm:gl.bind_sampler", "gasm:gl.sampler_parameteri", "gasm:gl.sampler_parameterf", "gasm:gl.get_sampler_parameteriv",
721 "gasm:gl.get_sampler_parameterfv", "gasm:gl.create_framebuffer", "gasm:gl.delete_framebuffer", "gasm:gl.is_framebuffer",
722 "gasm:gl.bind_framebuffer", "gasm:gl.check_framebuffer_status", "gasm:gl.framebuffer_texture_2d", "gasm:gl.framebuffer_texture_layer",
723 "gasm:gl.framebuffer_renderbuffer", "gasm:gl.get_framebuffer_attachment_parameteriv", "gasm:gl.blit_framebuffer", "gasm:gl.invalidate_framebuffer",
724 "gasm:gl.invalidate_sub_framebuffer", "gasm:gl.read_buffer", "gasm:gl.read_pixels", "gasm:gl.create_renderbuffer",
725 "gasm:gl.delete_renderbuffer", "gasm:gl.is_renderbuffer", "gasm:gl.bind_renderbuffer", "gasm:gl.renderbuffer_storage",
726 "gasm:gl.renderbuffer_storage_multisample", "gasm:gl.get_renderbuffer_parameteriv", "gasm:gl.create_shader", "gasm:gl.delete_shader",
727 "gasm:gl.is_shader", "gasm:gl.shader_source", "gasm:gl.compile_shader", "gasm:gl.get_shaderiv",
728 "gasm:gl.get_shader_info_log", "gasm:gl.get_shader_source", "gasm:gl.create_program", "gasm:gl.delete_program",
729 "gasm:gl.is_program", "gasm:gl.attach_shader", "gasm:gl.detach_shader", "gasm:gl.link_program",
730 "gasm:gl.use_program", "gasm:gl.validate_program", "gasm:gl.get_programiv", "gasm:gl.get_program_info_log",
731 "gasm:gl.get_attached_shaders", "gasm:gl.bind_attrib_location", "gasm:gl.get_attrib_location", "gasm:gl.get_frag_data_location",
732 "gasm:gl.get_active_attrib", "gasm:gl.get_active_uniform", "gasm:gl.get_uniform_location", "gasm:gl.get_uniform_index",
733 "gasm:gl.get_active_uniformsiv", "gasm:gl.get_uniform_block_index", "gasm:gl.get_active_uniform_block_name", "gasm:gl.get_active_uniform_blockiv",
734 "gasm:gl.uniform_block_binding", "gasm:gl.get_uniformfv", "gasm:gl.get_uniformiv", "gasm:gl.get_uniformuiv",
735 "gasm:gl.transform_feedback_varyings", "gasm:gl.get_transform_feedback_varying", "gasm:gl.uniform1f", "gasm:gl.uniform2f",
736 "gasm:gl.uniform3f", "gasm:gl.uniform4f", "gasm:gl.uniform1i", "gasm:gl.uniform2i",
737 "gasm:gl.uniform3i", "gasm:gl.uniform4i", "gasm:gl.uniform1ui", "gasm:gl.uniform2ui",
738 "gasm:gl.uniform3ui", "gasm:gl.uniform4ui", "gasm:gl.uniform1fv", "gasm:gl.uniform2fv",
739 "gasm:gl.uniform3fv", "gasm:gl.uniform4fv", "gasm:gl.uniform1iv", "gasm:gl.uniform2iv",
740 "gasm:gl.uniform3iv", "gasm:gl.uniform4iv", "gasm:gl.uniform1uiv", "gasm:gl.uniform2uiv",
741 "gasm:gl.uniform3uiv", "gasm:gl.uniform4uiv", "gasm:gl.uniform_matrix2fv", "gasm:gl.uniform_matrix3fv",
742 "gasm:gl.uniform_matrix4fv", "gasm:gl.uniform_matrix2x3fv", "gasm:gl.uniform_matrix3x2fv", "gasm:gl.uniform_matrix2x4fv",
743 "gasm:gl.uniform_matrix4x2fv", "gasm:gl.uniform_matrix3x4fv", "gasm:gl.uniform_matrix4x3fv", "gasm:gl.create_query",
744 "gasm:gl.delete_query", "gasm:gl.is_query", "gasm:gl.begin_query", "gasm:gl.end_query",
745 "gasm:gl.get_queryiv", "gasm:gl.get_query_objectuiv", "gasm:gl.fence_sync", "gasm:gl.is_sync",
746 "gasm:gl.delete_sync", "gasm:gl.client_wait_sync", "gasm:gl.wait_sync", "gasm:gl.get_synciv",
747 "gasm:gl.create_transform_feedback", "gasm:gl.delete_transform_feedback", "gasm:gl.is_transform_feedback", "gasm:gl.bind_transform_feedback",
748 "gasm:gl.begin_transform_feedback", "gasm:gl.end_transform_feedback", "gasm:gl.pause_transform_feedback", "gasm:gl.resume_transform_feedback",
749 "gasm:net", "gasm:net.open", "gasm:net.state", "gasm:net.send",
750 "gasm:net.recv", "gasm:net.close", "gasm:storage", "gasm:storage.get",
751 "gasm:storage.set", "gasm:storage.delete", "gasm:storage.count", "gasm:storage.key",
752 "wasi_snapshot_preview1", "wasi_snapshot_preview1.proc_exit",
753];
754
755pub const GASM_BTN_A: u32 = 1 << 0;
758pub const GASM_BTN_B: u32 = 1 << 1;
759pub const GASM_BTN_X: u32 = 1 << 2;
760pub const GASM_BTN_Y: u32 = 1 << 3;
761pub const GASM_BTN_L: u32 = 1 << 4;
762pub const GASM_BTN_R: u32 = 1 << 5;
763pub const GASM_BTN_SELECT: u32 = 1 << 6;
764pub const GASM_BTN_START: u32 = 1 << 7;
765pub const GASM_BTN_UP: u32 = 1 << 8;
766pub const GASM_BTN_DOWN: u32 = 1 << 9;
767pub const GASM_BTN_LEFT: u32 = 1 << 10;
768pub const GASM_BTN_RIGHT: u32 = 1 << 11;
769
770pub const GASM_BUF_COPY_DST: u32 = 0x08;
772pub const GASM_BUF_INDEX: u32 = 0x10;
773pub const GASM_BUF_VERTEX: u32 = 0x20;
774pub const GASM_BUF_UNIFORM: u32 = 0x40;
775pub const GASM_BUF_STORAGE: u32 = 0x80;
776
777pub const GASM_STAGE_VERTEX: u32 = 0x1;
780pub const GASM_STAGE_FRAGMENT: u32 = 0x2;
781
782pub const GASM_INDEX_U16: u32 = 0;
784pub const GASM_INDEX_U32: u32 = 1;
785
786pub const GASM_NET_CONNECTING: u32 = 0;
788pub const GASM_NET_OPEN: u32 = 1;
789pub const GASM_NET_CLOSED: u32 = 2;
790pub const GASM_NET_ERROR: u32 = 3;
791
792pub const GASM_INPUT_KEYS_RAW: u32 = 1 << 0;
795pub const GASM_INPUT_POINTER_HIDDEN: u32 = 1 << 1;
796pub const GASM_INPUT_POINTER_LOCKED: u32 = 1 << 2;
797
798pub const GASM_STORAGE_OK: i32 = 0;
801pub const GASM_STORAGE_ERR_KEY: i32 = -1;
802pub const GASM_STORAGE_ERR_SIZE: i32 = -2;
803pub const GASM_STORAGE_ERR_QUOTA: i32 = -3;
804pub const GASM_STORAGE_ERR_IO: i32 = -4;
805
806pub const GASM_POINTER_BYTES: u32 = 48;
809pub const GASM_POINTER_OFF_X: u32 = 0;
810pub const GASM_POINTER_OFF_Y: u32 = 4;
811pub const GASM_POINTER_OFF_FX: u32 = 8;
812pub const GASM_POINTER_OFF_FY: u32 = 12;
813pub const GASM_POINTER_OFF_DX: u32 = 16;
814pub const GASM_POINTER_OFF_DY: u32 = 20;
815pub const GASM_POINTER_OFF_WHEEL_X: u32 = 24;
816pub const GASM_POINTER_OFF_WHEEL_Y: u32 = 28;
817pub const GASM_POINTER_OFF_BUTTONS: u32 = 32;
818pub const GASM_POINTER_OFF_PRESSED: u32 = 36;
819pub const GASM_POINTER_OFF_RELEASED: u32 = 40;
820pub const GASM_POINTER_OFF_FLAGS: u32 = 44;
821pub const GASM_MOUSE_LEFT: u32 = 1 << 0;
822pub const GASM_MOUSE_RIGHT: u32 = 1 << 1;
823pub const GASM_MOUSE_MIDDLE: u32 = 1 << 2;
824pub const GASM_MOUSE_BACK: u32 = 1 << 3;
825pub const GASM_MOUSE_FORWARD: u32 = 1 << 4;
826pub const GASM_POINTER_INSIDE: u32 = 1 << 0;
827pub const GASM_POINTER_IS_HIDDEN: u32 = 1 << 1;
828pub const GASM_POINTER_IS_LOCKED: u32 = 1 << 2;
829
830pub const GASM_GAMEPAD_BYTES: u32 = 204;
833pub const GASM_GAMEPAD_BUTTONS: u32 = 32;
834pub const GASM_GAMEPAD_AXES: u32 = 16;
835pub const GASM_GAMEPAD_OFF_FLAGS: u32 = 0;
836pub const GASM_GAMEPAD_OFF_BUTTON_COUNT: u32 = 4;
837pub const GASM_GAMEPAD_OFF_AXIS_COUNT: u32 = 8;
838pub const GASM_GAMEPAD_OFF_BUTTONS: u32 = 12;
839pub const GASM_GAMEPAD_OFF_AXES: u32 = 140;
840pub const GASM_GAMEPAD_CONNECTED: u32 = 1 << 0;
841pub const GASM_GAMEPAD_STANDARD: u32 = 1 << 1;
842
843pub const GASM_KEY_STATE_BYTES: u32 = 32;
846pub const GASM_KEY_EVENT_BYTES: u32 = 4;
847
848pub mod keys {
850 pub const ESCAPE: u32 = 1;
851 pub const F1: u32 = 2;
852 pub const F2: u32 = 3;
853 pub const F3: u32 = 4;
854 pub const F4: u32 = 5;
855 pub const F5: u32 = 6;
856 pub const F6: u32 = 7;
857 pub const F7: u32 = 8;
858 pub const F8: u32 = 9;
859 pub const F9: u32 = 10;
860 pub const F10: u32 = 11;
861 pub const F11: u32 = 12;
862 pub const F12: u32 = 13;
863 pub const BACKQUOTE: u32 = 14;
864 pub const DIGIT0: u32 = 15;
865 pub const DIGIT1: u32 = 16;
866 pub const DIGIT2: u32 = 17;
867 pub const DIGIT3: u32 = 18;
868 pub const DIGIT4: u32 = 19;
869 pub const DIGIT5: u32 = 20;
870 pub const DIGIT6: u32 = 21;
871 pub const DIGIT7: u32 = 22;
872 pub const DIGIT8: u32 = 23;
873 pub const DIGIT9: u32 = 24;
874 pub const MINUS: u32 = 25;
875 pub const EQUAL: u32 = 26;
876 pub const BACKSPACE: u32 = 27;
877 pub const TAB: u32 = 28;
878 pub const KEY_A: u32 = 29;
879 pub const KEY_B: u32 = 30;
880 pub const KEY_C: u32 = 31;
881 pub const KEY_D: u32 = 32;
882 pub const KEY_E: u32 = 33;
883 pub const KEY_F: u32 = 34;
884 pub const KEY_G: u32 = 35;
885 pub const KEY_H: u32 = 36;
886 pub const KEY_I: u32 = 37;
887 pub const KEY_J: u32 = 38;
888 pub const KEY_K: u32 = 39;
889 pub const KEY_L: u32 = 40;
890 pub const KEY_M: u32 = 41;
891 pub const KEY_N: u32 = 42;
892 pub const KEY_O: u32 = 43;
893 pub const KEY_P: u32 = 44;
894 pub const KEY_Q: u32 = 45;
895 pub const KEY_R: u32 = 46;
896 pub const KEY_S: u32 = 47;
897 pub const KEY_T: u32 = 48;
898 pub const KEY_U: u32 = 49;
899 pub const KEY_V: u32 = 50;
900 pub const KEY_W: u32 = 51;
901 pub const KEY_X: u32 = 52;
902 pub const KEY_Y: u32 = 53;
903 pub const KEY_Z: u32 = 54;
904 pub const BRACKET_LEFT: u32 = 55;
905 pub const BRACKET_RIGHT: u32 = 56;
906 pub const BACKSLASH: u32 = 57;
907 pub const CAPS_LOCK: u32 = 58;
908 pub const SEMICOLON: u32 = 59;
909 pub const QUOTE: u32 = 60;
910 pub const ENTER: u32 = 61;
911 pub const SHIFT_LEFT: u32 = 62;
912 pub const INTL_BACKSLASH: u32 = 63;
913 pub const COMMA: u32 = 64;
914 pub const PERIOD: u32 = 65;
915 pub const SLASH: u32 = 66;
916 pub const SHIFT_RIGHT: u32 = 67;
917 pub const CONTROL_LEFT: u32 = 68;
918 pub const META_LEFT: u32 = 69;
919 pub const ALT_LEFT: u32 = 70;
920 pub const SPACE: u32 = 71;
921 pub const ALT_RIGHT: u32 = 72;
922 pub const META_RIGHT: u32 = 73;
923 pub const CONTEXT_MENU: u32 = 74;
924 pub const CONTROL_RIGHT: u32 = 75;
925 pub const PRINT_SCREEN: u32 = 76;
926 pub const SCROLL_LOCK: u32 = 77;
927 pub const PAUSE: u32 = 78;
928 pub const INSERT: u32 = 79;
929 pub const HOME: u32 = 80;
930 pub const PAGE_UP: u32 = 81;
931 pub const DELETE: u32 = 82;
932 pub const END: u32 = 83;
933 pub const PAGE_DOWN: u32 = 84;
934 pub const ARROW_UP: u32 = 85;
935 pub const ARROW_LEFT: u32 = 86;
936 pub const ARROW_DOWN: u32 = 87;
937 pub const ARROW_RIGHT: u32 = 88;
938 pub const NUM_LOCK: u32 = 89;
939 pub const NUMPAD_DIVIDE: u32 = 90;
940 pub const NUMPAD_MULTIPLY: u32 = 91;
941 pub const NUMPAD_SUBTRACT: u32 = 92;
942 pub const NUMPAD_ADD: u32 = 93;
943 pub const NUMPAD_ENTER: u32 = 94;
944 pub const NUMPAD_DECIMAL: u32 = 95;
945 pub const NUMPAD0: u32 = 96;
946 pub const NUMPAD1: u32 = 97;
947 pub const NUMPAD2: u32 = 98;
948 pub const NUMPAD3: u32 = 99;
949 pub const NUMPAD4: u32 = 100;
950 pub const NUMPAD5: u32 = 101;
951 pub const NUMPAD6: u32 = 102;
952 pub const NUMPAD7: u32 = 103;
953 pub const NUMPAD8: u32 = 104;
954 pub const NUMPAD9: u32 = 105;
955 pub const NUMPAD_EQUAL: u32 = 106;
956 pub const NUMPAD_COMMA: u32 = 107;
957 pub const INTL_RO: u32 = 108;
958 pub const INTL_YEN: u32 = 109;
959 pub const F13: u32 = 110;
960 pub const F14: u32 = 111;
961 pub const F15: u32 = 112;
962 pub const F16: u32 = 113;
963 pub const F17: u32 = 114;
964 pub const F18: u32 = 115;
965 pub const F19: u32 = 116;
966 pub const F20: u32 = 117;
967 pub const F21: u32 = 118;
968 pub const F22: u32 = 119;
969 pub const F23: u32 = 120;
970 pub const F24: u32 = 121;
971 pub const NAMES: [&str; 122] = [
973 "", "Escape", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "Backquote", "Digit0", "Digit1", "Digit2", "Digit3", "Digit4", "Digit5", "Digit6", "Digit7", "Digit8", "Digit9", "Minus", "Equal", "Backspace", "Tab", "KeyA", "KeyB", "KeyC", "KeyD", "KeyE", "KeyF", "KeyG", "KeyH", "KeyI", "KeyJ", "KeyK", "KeyL", "KeyM", "KeyN", "KeyO", "KeyP", "KeyQ", "KeyR", "KeyS", "KeyT", "KeyU", "KeyV", "KeyW", "KeyX", "KeyY", "KeyZ", "BracketLeft", "BracketRight", "Backslash", "CapsLock", "Semicolon", "Quote", "Enter", "ShiftLeft", "IntlBackslash", "Comma", "Period", "Slash", "ShiftRight", "ControlLeft", "MetaLeft", "AltLeft", "Space", "AltRight", "MetaRight", "ContextMenu", "ControlRight", "PrintScreen", "ScrollLock", "Pause", "Insert", "Home", "PageUp", "Delete", "End", "PageDown", "ArrowUp", "ArrowLeft", "ArrowDown", "ArrowRight", "NumLock", "NumpadDivide", "NumpadMultiply", "NumpadSubtract", "NumpadAdd", "NumpadEnter", "NumpadDecimal", "Numpad0", "Numpad1", "Numpad2", "Numpad3", "Numpad4", "Numpad5", "Numpad6", "Numpad7", "Numpad8", "Numpad9", "NumpadEqual", "NumpadComma", "IntlRo", "IntlYen", "F13", "F14", "F15", "F16", "F17", "F18", "F19", "F20", "F21", "F22", "F23", "F24",
974 ];
975}