| 1 | module gfx |
| 2 | |
| 3 | // setup and misc functions |
| 4 | fn C.sg_setup(const_desc &C.sg_desc) |
| 5 | fn C.sg_shutdown() |
| 6 | fn C.sg_isvalid() bool |
| 7 | fn C.sg_reset_state_cache() |
| 8 | fn C.sg_install_trace_hooks(const_trace_hooks &C.sg_trace_hooks) C.sg_trace_hooks |
| 9 | fn C.sg_push_debug_group(const_name &char) |
| 10 | fn C.sg_pop_debug_group() |
| 11 | fn C.sg_add_commit_listener(listener C.sg_commit_listener) bool |
| 12 | fn C.sg_remove_commit_listener(listener C.sg_commit_listener) bool |
| 13 | |
| 14 | // resource creation, destruction and updating |
| 15 | fn C.sg_make_buffer(const_desc &C.sg_buffer_desc) C.sg_buffer |
| 16 | fn C.sg_make_image(const_desc &C.sg_image_desc) C.sg_image |
| 17 | fn C.sg_make_sampler(const_desc &C.sg_sampler_desc) C.sg_sampler |
| 18 | fn C.sg_make_shader(const_desc &C.sg_shader_desc) C.sg_shader |
| 19 | fn C.sg_make_pipeline(const_desc &C.sg_pipeline_desc) C.sg_pipeline |
| 20 | fn C.sg_make_attachments(const_desc &C.sg_attachments_desc) C.sg_attachments |
| 21 | fn C.sg_destroy_buffer(buf C.sg_buffer) |
| 22 | fn C.sg_destroy_image(img C.sg_image) |
| 23 | fn C.sg_destroy_sampler(smp C.sg_sampler) |
| 24 | fn C.sg_destroy_shader(shd C.sg_shader) |
| 25 | fn C.sg_destroy_pipeline(pip C.sg_pipeline) |
| 26 | fn C.sg_destroy_attachments(atts C.sg_attachments) |
| 27 | fn C.sg_update_buffer(buf C.sg_buffer, data &C.sg_range) |
| 28 | fn C.sg_update_image(img C.sg_image, data &C.sg_image_data) |
| 29 | fn C.sg_append_buffer(buf C.sg_buffer, data &C.sg_range) i32 |
| 30 | fn C.sg_query_buffer_overflow(buf C.sg_buffer) bool |
| 31 | fn C.sg_query_buffer_will_overflow(buf C.sg_buffer, size usize) bool |
| 32 | |
| 33 | // rendering functions |
| 34 | fn C.sg_begin_pass(const_pass &C.sg_pass) |
| 35 | fn C.sg_apply_viewport(x i32, y i32, width i32, height i32, origin_top_left bool) |
| 36 | fn C.sg_apply_viewportf(x f32, y f32, width f32, height f32, origin_top_left bool) |
| 37 | fn C.sg_apply_scissor_rect(x i32, y i32, width i32, height i32, origin_top_left bool) |
| 38 | fn C.sg_apply_scissor_rectf(x f32, y f32, width f32, height f32, origin_top_left bool) |
| 39 | fn C.sg_apply_pipeline(pip C.sg_pipeline) |
| 40 | fn C.sg_apply_bindings(bindings &C.sg_bindings) |
| 41 | fn C.sg_apply_uniforms(stage ShaderStage, ub_index i32, const_data &C.sg_range) |
| 42 | fn C.sg_draw(base_element i32, num_elements i32, num_instances i32) |
| 43 | fn C.sg_end_pass() |
| 44 | fn C.sg_commit() |
| 45 | |
| 46 | // getting information |
| 47 | fn C.sg_query_desc() C.sg_desc |
| 48 | fn C.sg_query_backend() Backend |
| 49 | fn C.sg_query_features() C.sg_features |
| 50 | fn C.sg_query_limits() C.sg_limits |
| 51 | fn C.sg_query_pixelformat(fmt PixelFormat) C.sg_pixelformat_info |
| 52 | |
| 53 | // get current state of a resource (INITIAL, ALLOC, VALID, FAILED, INVALID) |
| 54 | fn C.sg_query_buffer_state(buf C.sg_buffer) ResourceState |
| 55 | fn C.sg_query_image_state(img C.sg_image) ResourceState |
| 56 | fn C.sg_query_sampler_state(smp C.sg_sampler) ResourceState |
| 57 | fn C.sg_query_shader_state(shd C.sg_shader) ResourceState |
| 58 | fn C.sg_query_pipeline_state(pip C.sg_pipeline) ResourceState |
| 59 | fn C.sg_query_attachments_state(atts C.sg_attachments) ResourceState |
| 60 | |
| 61 | // get runtime information about a resource |
| 62 | fn C.sg_query_buffer_info(buf C.sg_buffer) C.sg_buffer_info |
| 63 | fn C.sg_query_image_info(img C.sg_image) C.sg_image_info |
| 64 | fn C.sg_query_sampler_info(smp C.sg_sampler) C.sg_sampler_info |
| 65 | fn C.sg_query_shader_info(shd C.sg_shader) C.sg_shader_info |
| 66 | fn C.sg_query_pipeline_info(pip C.sg_pipeline) C.sg_pipeline_info |
| 67 | fn C.sg_query_attachments_info(atts C.sg_attachments) C.sg_attachments_info |
| 68 | |
| 69 | // get desc structs matching a specific resource (NOTE that not all creation attributes may be provided) |
| 70 | fn C.sg_query_buffer_desc(buf C.sg_buffer) C.sg_buffer_desc |
| 71 | fn C.sg_query_image_desc(img C.sg_image) C.sg_image_desc |
| 72 | fn C.sg_query_sampler_desc(smp C.sg_sampler) C.sg_sampler_desc |
| 73 | fn C.sg_query_shader_desc(shd C.sg_shader) C.sg_shader_desc |
| 74 | fn C.sg_query_pipeline_desc(pip C.sg_pipeline) C.sg_pipeline_desc |
| 75 | fn C.sg_query_attachments_desc(atts C.sg_attachments) C.sg_attachments_desc |
| 76 | |
| 77 | // get resource creation desc struct with their default values replaced |
| 78 | fn C.sg_query_buffer_defaults(const_desc &C.sg_buffer_desc) C.sg_buffer_desc |
| 79 | fn C.sg_query_image_defaults(const_desc &C.sg_image_desc) C.sg_image_desc |
| 80 | fn C.sg_query_sampler_defaults(const_desc &C.sg_sampler_desc) C.sg_sampler_desc |
| 81 | fn C.sg_query_shader_defaults(const_desc &C.sg_shader_desc) C.sg_shader_desc |
| 82 | fn C.sg_query_pipeline_defaults(const_desc &C.sg_pipeline_desc) C.sg_pipeline_desc |
| 83 | fn C.sg_query_attachments_defaults(const_desc &C.sg_attachments_desc) C.sg_attachments_desc |
| 84 | |
| 85 | // separate resource allocation and initialization (for async setup) |
| 86 | fn C.sg_alloc_buffer() C.sg_buffer |
| 87 | fn C.sg_alloc_image() C.sg_image |
| 88 | fn C.sg_alloc_sampler() C.sg_sampler |
| 89 | fn C.sg_alloc_shader() C.sg_shader |
| 90 | fn C.sg_alloc_pipeline() C.sg_pipeline |
| 91 | fn C.sg_alloc_attachments() C.sg_attachments |
| 92 | fn C.sg_dealloc_buffer(buf C.sg_buffer) |
| 93 | fn C.sg_dealloc_image(img C.sg_image) |
| 94 | fn C.sg_dealloc_sampler(smp C.sg_sampler) |
| 95 | fn C.sg_dealloc_shader(shd C.sg_shader) |
| 96 | fn C.sg_dealloc_pipeline(pip C.sg_pipeline) |
| 97 | fn C.sg_dealloc_attachments(atts C.sg_attachments) |
| 98 | fn C.sg_init_buffer(buf C.sg_buffer, const_desc &C.sg_buffer_desc) |
| 99 | fn C.sg_init_image(img C.sg_image, const_desc &C.sg_buffer_desc) |
| 100 | fn C.sg_init_sampler(smg C.sg_sampler, const_desc &C.sg_sampler_desc) |
| 101 | fn C.sg_init_shader(shd C.sg_shader, const_desc &C.sg_shader_desc) |
| 102 | fn C.sg_init_pipeline(pip C.sg_pipeline, const_desc &C.sg_pipeline_desc) |
| 103 | fn C.sg_init_attachments(atts C.sg_attachments, const_desc &C.sg_attachments_desc) |
| 104 | fn C.sg_uninit_buffer(buf C.sg_buffer) |
| 105 | fn C.sg_uninit_image(img C.sg_image) |
| 106 | fn C.sg_uninit_sampler(smp C.sg_sampler) |
| 107 | fn C.sg_uninit_shader(shd C.sg_shader) |
| 108 | fn C.sg_uninit_pipeline(pip C.sg_pipeline) |
| 109 | fn C.sg_uninit_attachments(atts C.sg_attachments) |
| 110 | fn C.sg_fail_buffer(buf C.sg_buffer) |
| 111 | fn C.sg_fail_image(img C.sg_image) |
| 112 | fn C.sg_fail_sampler(smp C.sg_sampler) |
| 113 | fn C.sg_fail_shader(shd C.sg_shader) |
| 114 | fn C.sg_fail_pipeline(pip C.sg_pipeline) |
| 115 | fn C.sg_fail_attachments(atts C.sg_attachments) |
| 116 | |
| 117 | // frame stats |
| 118 | fn C.sg_enable_frame_stats() |
| 119 | fn C.sg_disable_frame_stats() |
| 120 | fn C.sg_frame_stats_enabled() bool |
| 121 | fn C.sg_query_frame_stats() C.sg_frame_stats |
| 122 | |