comparison src/glslang/glslang_c_interface.nim @ 461:59d861a6a5c4

add: initial version
author Sam <sam@basx.dev>
date Wed, 14 Dec 2022 00:49:35 +0700
parents
children bb2a7d3a7003
comparison
equal deleted inserted replaced
-1:000000000000 461:59d861a6a5c4
1 import
2 glslang_c_shader_types
3
4 type
5 glslang_shader_s = object
6 glslang_program_s = object
7 glslang_shader_t* = glslang_shader_s
8 glslang_program_t* = glslang_program_s
9
10 ## TLimits counterpart
11
12 type
13 glslang_limits_t* {.bycopy.} = object
14 non_inductive_for_loops*: bool
15 while_loops*: bool
16 do_while_loops*: bool
17 general_uniform_indexing*: bool
18 general_attribute_matrix_vector_indexing*: bool
19 general_varying_indexing*: bool
20 general_sampler_indexing*: bool
21 general_variable_indexing*: bool
22 general_constant_matrix_vector_indexing*: bool
23
24
25 ## TBuiltInResource counterpart
26
27 type
28 glslang_resource_t* {.bycopy.} = object
29 max_lights*: cint
30 max_clip_planes*: cint
31 max_texture_units*: cint
32 max_texture_coords*: cint
33 max_vertex_attribs*: cint
34 max_vertex_uniform_components*: cint
35 max_varying_floats*: cint
36 max_vertex_texture_image_units*: cint
37 max_combined_texture_image_units*: cint
38 max_texture_image_units*: cint
39 max_fragment_uniform_components*: cint
40 max_draw_buffers*: cint
41 max_vertex_uniform_vectors*: cint
42 max_varying_vectors*: cint
43 max_fragment_uniform_vectors*: cint
44 max_vertex_output_vectors*: cint
45 max_fragment_input_vectors*: cint
46 min_program_texel_offset*: cint
47 max_program_texel_offset*: cint
48 max_clip_distances*: cint
49 max_compute_work_group_count_x*: cint
50 max_compute_work_group_count_y*: cint
51 max_compute_work_group_count_z*: cint
52 max_compute_work_group_size_x*: cint
53 max_compute_work_group_size_y*: cint
54 max_compute_work_group_size_z*: cint
55 max_compute_uniform_components*: cint
56 max_compute_texture_image_units*: cint
57 max_compute_image_uniforms*: cint
58 max_compute_atomic_counters*: cint
59 max_compute_atomic_counter_buffers*: cint
60 max_varying_components*: cint
61 max_vertex_output_components*: cint
62 max_geometry_input_components*: cint
63 max_geometry_output_components*: cint
64 max_fragment_input_components*: cint
65 max_image_units*: cint
66 max_combined_image_units_and_fragment_outputs*: cint
67 max_combined_shader_output_resources*: cint
68 max_image_samples*: cint
69 max_vertex_image_uniforms*: cint
70 max_tess_control_image_uniforms*: cint
71 max_tess_evaluation_image_uniforms*: cint
72 max_geometry_image_uniforms*: cint
73 max_fragment_image_uniforms*: cint
74 max_combined_image_uniforms*: cint
75 max_geometry_texture_image_units*: cint
76 max_geometry_output_vertices*: cint
77 max_geometry_total_output_components*: cint
78 max_geometry_uniform_components*: cint
79 max_geometry_varying_components*: cint
80 max_tess_control_input_components*: cint
81 max_tess_control_output_components*: cint
82 max_tess_control_texture_image_units*: cint
83 max_tess_control_uniform_components*: cint
84 max_tess_control_total_output_components*: cint
85 max_tess_evaluation_input_components*: cint
86 max_tess_evaluation_output_components*: cint
87 max_tess_evaluation_texture_image_units*: cint
88 max_tess_evaluation_uniform_components*: cint
89 max_tess_patch_components*: cint
90 max_patch_vertices*: cint
91 max_tess_gen_level*: cint
92 max_viewports*: cint
93 max_vertex_atomic_counters*: cint
94 max_tess_control_atomic_counters*: cint
95 max_tess_evaluation_atomic_counters*: cint
96 max_geometry_atomic_counters*: cint
97 max_fragment_atomic_counters*: cint
98 max_combined_atomic_counters*: cint
99 max_atomic_counter_bindings*: cint
100 max_vertex_atomic_counter_buffers*: cint
101 max_tess_control_atomic_counter_buffers*: cint
102 max_tess_evaluation_atomic_counter_buffers*: cint
103 max_geometry_atomic_counter_buffers*: cint
104 max_fragment_atomic_counter_buffers*: cint
105 max_combined_atomic_counter_buffers*: cint
106 max_atomic_counter_buffer_size*: cint
107 max_transform_feedback_buffers*: cint
108 max_transform_feedback_interleaved_components*: cint
109 max_cull_distances*: cint
110 max_combined_clip_and_cull_distances*: cint
111 max_samples*: cint
112 max_mesh_output_vertices_nv*: cint
113 max_mesh_output_primitives_nv*: cint
114 max_mesh_work_group_size_x_nv*: cint
115 max_mesh_work_group_size_y_nv*: cint
116 max_mesh_work_group_size_z_nv*: cint
117 max_task_work_group_size_x_nv*: cint
118 max_task_work_group_size_y_nv*: cint
119 max_task_work_group_size_z_nv*: cint
120 max_mesh_view_count_nv*: cint
121 max_mesh_output_vertices_ext*: cint
122 max_mesh_output_primitives_ext*: cint
123 max_mesh_work_group_size_x_ext*: cint
124 max_mesh_work_group_size_y_ext*: cint
125 max_mesh_work_group_size_z_ext*: cint
126 max_task_work_group_size_x_ext*: cint
127 max_task_work_group_size_y_ext*: cint
128 max_task_work_group_size_z_ext*: cint
129 max_mesh_view_count_ext*: cint
130 maxDualSourceDrawBuffersEXT*: cint
131 limits*: glslang_limits_t
132
133 glslang_input_t* {.bycopy.} = object
134 language*: glslang_source_t
135 stage*: glslang_stage_t
136 client*: glslang_client_t
137 client_version*: glslang_target_client_version_t
138 target_language*: glslang_target_language_t
139 target_language_version*: glslang_target_language_version_t
140 ## Shader source code
141 code*: cstring
142 default_version*: cint
143 default_profile*: glslang_profile_t
144 force_default_version_and_profile*: cint
145 forward_compatible*: cint
146 messages*: glslang_messages_t
147 resource*: ptr glslang_resource_t
148
149
150 ## Inclusion result structure allocated by C include_local/include_system callbacks
151
152 type
153 glsl_include_result_t* {.bycopy.} = object
154 ## Header file name or NULL if inclusion failed
155 header_name*: cstring
156 ## Header contents or NULL
157 header_data*: cstring
158 header_length*: csize_t
159
160
161 ## Callback for local file inclusion
162
163 type
164 glsl_include_local_func* = proc (ctx: pointer; header_name: cstring;
165 includer_name: cstring; include_depth: csize_t): ptr glsl_include_result_t
166
167 ## Callback for system file inclusion
168
169 type
170 glsl_include_system_func* = proc (ctx: pointer; header_name: cstring;
171 includer_name: cstring; include_depth: csize_t): ptr glsl_include_result_t
172
173 ## Callback for include result destruction
174
175 type
176 glsl_free_include_result_func* = proc (ctx: pointer;
177 result: ptr glsl_include_result_t): cint
178
179 ## Collection of callbacks for GLSL preprocessor
180
181 type
182 glsl_include_callbacks_t* {.bycopy.} = object
183 include_system*: glsl_include_system_func
184 include_local*: glsl_include_local_func
185 free_include_result*: glsl_free_include_result_func
186
187
188 ## SpvOptions counterpart
189
190 type
191 glslang_spv_options_t* {.bycopy.} = object
192 generate_debug_info*: bool
193 strip_debug_info*: bool
194 disable_optimizer*: bool
195 optimize_size*: bool
196 disassemble*: bool
197 validate*: bool
198 emit_nonsemantic_shader_debug_info*: bool
199 emit_nonsemantic_shader_debug_source*: bool
200
201
202 proc glslang_initialize_process*(): cint {.importc.}
203 proc glslang_finalize_process*() {.importc.}
204 proc glslang_shader_create*(input: ptr glslang_input_t): ptr glslang_shader_t {.importc.}
205 proc glslang_shader_delete*(shader: ptr glslang_shader_t) {.importc.}
206 proc glslang_shader_set_preamble*(shader: ptr glslang_shader_t; s: cstring) {.importc.}
207 proc glslang_shader_shift_binding*(shader: ptr glslang_shader_t; res: glslang_resource_type_t; base: cuint) {.importc.}
208 proc glslang_shader_shift_binding_for_set*(shader: ptr glslang_shader_t; res: glslang_resource_type_t; base: cuint; set: cuint) {.importc.}
209 proc glslang_shader_set_options*(shader: ptr glslang_shader_t; options: cint) {.importc.}
210
211 proc glslang_shader_set_glsl_version*(shader: ptr glslang_shader_t; version: cint) {.importc.}
212 proc glslang_shader_preprocess*(shader: ptr glslang_shader_t; input: ptr glslang_input_t): cint {.importc.}
213 proc glslang_shader_parse*(shader: ptr glslang_shader_t; input: ptr glslang_input_t): cint {.importc.}
214 proc glslang_shader_get_preprocessed_code*(shader: ptr glslang_shader_t): cstring {.importc.}
215 proc glslang_shader_get_info_log*(shader: ptr glslang_shader_t): cstring {.importc.}
216 proc glslang_shader_get_info_debug_log*(shader: ptr glslang_shader_t): cstring {.importc.}
217 proc glslang_program_create*(): ptr glslang_program_t {.importc.}
218 proc glslang_program_delete*(program: ptr glslang_program_t) {.importc.}
219 proc glslang_program_add_shader*(program: ptr glslang_program_t; shader: ptr glslang_shader_t) {.importc.}
220 proc glslang_program_link*(program: ptr glslang_program_t; messages: cint): cint {.importc.}
221
222 proc glslang_program_add_source_text*(program: ptr glslang_program_t; stage: glslang_stage_t; text: cstring; len: csize_t) {.importc.}
223 proc glslang_program_set_source_file*(program: ptr glslang_program_t; stage: glslang_stage_t; file: cstring) {.importc.}
224 proc glslang_program_map_io*(program: ptr glslang_program_t): cint {.importc.}
225 proc glslang_program_SPIRV_generate*(program: ptr glslang_program_t; stage: glslang_stage_t) {.importc.}
226 proc glslang_program_SPIRV_generate_with_options*(program: ptr glslang_program_t; stage: glslang_stage_t; spv_options: ptr glslang_spv_options_t) {.importc.}
227 proc glslang_program_SPIRV_get_size*(program: ptr glslang_program_t): csize_t {.importc.}
228 proc glslang_program_SPIRV_get*(program: ptr glslang_program_t; a2: ptr cuint) {.importc.}
229 proc glslang_program_SPIRV_get_ptr*(program: ptr glslang_program_t): ptr cuint {.importc.}
230 proc glslang_program_SPIRV_get_messages*(program: ptr glslang_program_t): cstring {.importc.}
231 proc glslang_program_get_info_log*(program: ptr glslang_program_t): cstring {.importc.}
232 proc glslang_program_get_info_debug_log*(program: ptr glslang_program_t): cstring {.importc.}
233
234 proc glslang_default_resource*(): ptr glslang_resource_t {.importc.}
235 proc glslang_default_resource_string*(): cstring {.importc.}
236 proc glslang_decode_resource_limits*(resources: ptr glslang_resource_t , config: cstring) {.importc.}