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