comparison src/glslang/glslang_c_interface.nim @ 1:bb2a7d3a7003

add: more steps in setup
author Sam <sam@basx.dev>
date Fri, 16 Dec 2022 00:05:41 +0700
parents 5daf3f236d87
children 213fdf8d31dd
comparison
equal deleted inserted replaced
0:5daf3f236d87 1:bb2a7d3a7003
1 # required to link the GLSL compiler
2 when defined(release):
3 {.passl: "-Lthirdparty/glslang/lib/release" .}
4 else:
5 {.passl: "-Lthirdparty/glslang/lib/debug" .}
6 {.passl: "-Lthirdparty/spirv-tools/lib/" .}
7
8 {.passl: "-lglslang" .}
9 {.passl: "-lglslang-default-resource-limits" .}
10 {.passl: "-lHLSL" .}
11 {.passl: "-lMachineIndependent" .}
12 {.passl: "-lGenericCodeGen" .}
13 {.passl: "-lOSDependent" .}
14 {.passl: "-lOGLCompiler" .}
15 {.passl: "-lSPIRV" .}
16 {.passl: "-lSPIRV-Tools-opt" .}
17
18 {.passl: "-lSPIRV-Tools" .}
19 {.passl: "-lSPIRV-Tools-diff" .}
20 {.passl: "-lSPIRV-Tools-fuzz" .}
21 {.passl: "-lSPIRV-Tools-link" .}
22 {.passl: "-lSPIRV-Tools-lint" .}
23 {.passl: "-lSPIRV-Tools-opt" .}
24 {.passl: "-lSPIRV-Tools-reduce" .}
25
26 {.passl: "-lstdc++" .}
27 {.passl: "-lm" .}
28
1 import 29 import
2 glslang_c_shader_types 30 glslang_c_shader_types
3 31
4 type 32 type
5 glslang_shader_s = object 33 glslang_shader_t* {.nodecl incompleteStruct.} = object
6 glslang_program_s = object 34 glslang_program_t* {.nodecl incompleteStruct.} = 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 35 glslang_limits_t* {.bycopy.} = object
14 non_inductive_for_loops*: bool 36 non_inductive_for_loops*: bool
15 while_loops*: bool 37 while_loops*: bool
16 do_while_loops*: bool 38 do_while_loops*: bool
17 general_uniform_indexing*: bool 39 general_uniform_indexing*: bool
18 general_attribute_matrix_vector_indexing*: bool 40 general_attribute_matrix_vector_indexing*: bool
19 general_varying_indexing*: bool 41 general_varying_indexing*: bool
20 general_sampler_indexing*: bool 42 general_sampler_indexing*: bool
21 general_variable_indexing*: bool 43 general_variable_indexing*: bool
22 general_constant_matrix_vector_indexing*: bool 44 general_constant_matrix_vector_indexing*: bool
23
24
25 ## TBuiltInResource counterpart
26
27 type
28 glslang_resource_t* {.bycopy.} = object 45 glslang_resource_t* {.bycopy.} = object
29 max_lights*: cint 46 max_lights*: cint
30 max_clip_planes*: cint 47 max_clip_planes*: cint
31 max_texture_units*: cint 48 max_texture_units*: cint
32 max_texture_coords*: cint 49 max_texture_coords*: cint
127 max_task_work_group_size_y_ext*: cint 144 max_task_work_group_size_y_ext*: cint
128 max_task_work_group_size_z_ext*: cint 145 max_task_work_group_size_z_ext*: cint
129 max_mesh_view_count_ext*: cint 146 max_mesh_view_count_ext*: cint
130 maxDualSourceDrawBuffersEXT*: cint 147 maxDualSourceDrawBuffersEXT*: cint
131 limits*: glslang_limits_t 148 limits*: glslang_limits_t
132
133 glslang_input_t* {.bycopy.} = object 149 glslang_input_t* {.bycopy.} = object
134 language*: glslang_source_t 150 language*: glslang_source_t
135 stage*: glslang_stage_t 151 stage*: glslang_stage_t
136 client*: glslang_client_t 152 client*: glslang_client_t
137 client_version*: glslang_target_client_version_t 153 client_version*: glslang_target_client_version_t
138 target_language*: glslang_target_language_t 154 target_language*: glslang_target_language_t
139 target_language_version*: glslang_target_language_version_t 155 target_language_version*: glslang_target_language_version_t
140 ## Shader source code
141 code*: cstring 156 code*: cstring
142 default_version*: cint 157 default_version*: cint
143 default_profile*: glslang_profile_t 158 default_profile*: glslang_profile_t
144 force_default_version_and_profile*: cint 159 force_default_version_and_profile*: cint
145 forward_compatible*: cint 160 forward_compatible*: cint
146 messages*: glslang_messages_t 161 messages*: glslang_messages_t
147 resource*: ptr glslang_resource_t 162 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 163 glsl_include_result_t* {.bycopy.} = object
154 ## Header file name or NULL if inclusion failed 164 ## Header file name or NULL if inclusion failed
155 header_name*: cstring 165 header_name*: cstring
156 ## Header contents or NULL 166 ## Header contents or NULL
157 header_data*: cstring 167 header_data*: cstring
158 header_length*: csize_t 168 header_length*: csize_t
159 169 glsl_include_local_func* = proc (ctx: pointer; header_name: cstring; includer_name: cstring; include_depth: csize_t): ptr glsl_include_result_t
160 170 glsl_include_system_func* = proc (ctx: pointer; header_name: cstring; includer_name: cstring; include_depth: csize_t): ptr glsl_include_result_t
161 ## Callback for local file inclusion 171 glsl_free_include_result_func* = proc (ctx: pointer; result: ptr glsl_include_result_t): cint
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 172 glsl_include_callbacks_t* {.bycopy.} = object
183 include_system*: glsl_include_system_func 173 include_system*: glsl_include_system_func
184 include_local*: glsl_include_local_func 174 include_local*: glsl_include_local_func
185 free_include_result*: glsl_free_include_result_func 175 free_include_result*: glsl_free_include_result_func
186
187
188 ## SpvOptions counterpart
189
190 type
191 glslang_spv_options_t* {.bycopy.} = object 176 glslang_spv_options_t* {.bycopy.} = object
192 generate_debug_info*: bool 177 generate_debug_info*: bool
193 strip_debug_info*: bool 178 strip_debug_info*: bool
194 disable_optimizer*: bool 179 disable_optimizer*: bool
195 optimize_size*: bool 180 optimize_size*: bool
196 disassemble*: bool 181 disassemble*: bool
197 validate*: bool 182 validate*: bool
198 emit_nonsemantic_shader_debug_info*: bool 183 emit_nonsemantic_shader_debug_info*: bool
199 emit_nonsemantic_shader_debug_source*: bool 184 emit_nonsemantic_shader_debug_source*: bool
200
201 185
202 proc glslang_initialize_process*(): cint {.importc.} 186 proc glslang_initialize_process*(): cint {.importc.}
203 proc glslang_finalize_process*() {.importc.} 187 proc glslang_finalize_process*() {.importc.}
204 proc glslang_shader_create*(input: ptr glslang_input_t): ptr glslang_shader_t {.importc.} 188 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.} 189 proc glslang_shader_delete*(shader: ptr glslang_shader_t) {.importc.}