1#         $NetBSD: libglsl.mk,v 1.8 2023/11/22 17:48:35 rjs Exp $
2
3LIBGLSL_GENERATED_CXX_FILES = \
4          glsl_lexer.cpp \
5          glsl_parser.cpp
6
7#COPTS.glsl_lexer.cpp+=       -Wno-deprecated-register
8COPTS.vtn_glsl450.c+=         ${${ACTIVE_CC} == "clang":? -Wno-error=enum-conversion :}
9
10CPPFLAGS+=          -I${X11SRCDIR.Mesa}/src/compiler \
11                    -I${X11SRCDIR.Mesa}/../src/compiler \
12                    -I${X11SRCDIR.Mesa}/src/compiler/nir \
13                    -I${X11SRCDIR.Mesa}/../src/compiler/nir \
14                    -I${X11SRCDIR.Mesa}/src/compiler/glsl \
15                    -I${X11SRCDIR.Mesa}/../src/compiler/glsl \
16                    -I${X11SRCDIR.Mesa}/src/compiler/glsl/glcpp \
17                    -I${X11SRCDIR.Mesa}/../src/compiler/glsl/glcpp \
18                    -I${X11SRCDIR.Mesa}/src/compiler/spirv \
19                    -I${X11SRCDIR.Mesa}/../src/compiler/spirv
20
21LIBGLSL_FILES = \
22          ast_array_index.cpp \
23          ast_expr.cpp \
24          ast_function.cpp \
25          ast_to_hir.cpp \
26          ast_type.cpp \
27          builtin_functions.cpp \
28          builtin_types.cpp \
29          builtin_variables.cpp \
30          generate_ir.cpp \
31          gl_nir_lower_atomics.c \
32          gl_nir_link_atomics.c \
33          gl_nir_link_uniform_blocks.c \
34          gl_nir_link_uniform_initializers.c \
35          gl_nir_link_uniforms.c \
36          gl_nir_link_xfb.c \
37          gl_nir_linker.c \
38          gl_nir_lower_buffers.c \
39          gl_nir_lower_images.c \
40          gl_nir_lower_samplers.c \
41          gl_nir_lower_samplers_as_deref.c \
42          glsl_parser_extras.cpp \
43          glsl_symbol_table.cpp \
44          glsl_to_nir.cpp \
45          hir_field_selection.cpp \
46          ir.cpp \
47          ir_array_refcount.cpp \
48          ir_basic_block.cpp \
49          ir_builder.cpp \
50          ir_clone.cpp \
51          ir_constant_expression.cpp \
52          ir_equals.cpp \
53          ir_expression_flattening.cpp \
54          ir_function.cpp \
55          ir_function_can_inline.cpp \
56          ir_function_detect_recursion.cpp \
57          ir_hierarchical_visitor.cpp \
58          ir_hv_accept.cpp \
59          ir_builder_print_visitor.cpp \
60          ir_print_visitor.cpp \
61          ir_reader.cpp \
62          ir_rvalue_visitor.cpp \
63          ir_set_program_inouts.cpp \
64          ir_validate.cpp \
65          ir_variable_refcount.cpp \
66          linker.cpp \
67          linker_util.cpp \
68          link_atomics.cpp \
69          link_functions.cpp \
70          link_interface_blocks.cpp \
71          link_uniforms.cpp \
72          link_uniform_initializers.cpp \
73          link_uniform_block_active_visitor.cpp \
74          link_uniform_block_active_visitor.h \
75          link_uniform_blocks.cpp \
76          link_varyings.cpp \
77          loop_analysis.cpp \
78          loop_unroll.cpp \
79          lower_blend_equation_advanced.cpp \
80          lower_buffer_access.cpp \
81          lower_builtins.cpp \
82          lower_const_arrays_to_uniforms.cpp \
83          lower_cs_derived.cpp \
84          lower_discard.cpp \
85          lower_discard_flow.cpp \
86          lower_distance.cpp \
87          lower_if_to_cond_assign.cpp \
88          lower_instructions.cpp \
89          lower_int64.cpp \
90          lower_jumps.cpp \
91          lower_mat_op_to_vec.cpp \
92          lower_offset_array.cpp \
93          lower_packed_varyings.cpp \
94          lower_precision.cpp \
95          lower_named_interface_blocks.cpp \
96          lower_packing_builtins.cpp \
97          lower_subroutine.cpp \
98          lower_tess_level.cpp \
99          lower_variable_index_to_cond_assign.cpp \
100          lower_vec_index_to_cond_assign.cpp \
101          lower_vec_index_to_swizzle.cpp \
102          lower_vector.cpp \
103          lower_vector_derefs.cpp \
104          lower_vector_insert.cpp \
105          lower_vertex_id.cpp \
106          lower_output_reads.cpp \
107          lower_shared_reference.cpp \
108          lower_ubo_reference.cpp \
109          lower_xfb_varying.cpp \
110          opt_algebraic.cpp \
111          opt_array_splitting.cpp \
112          opt_conditional_discard.cpp \
113          opt_constant_folding.cpp \
114          opt_constant_propagation.cpp \
115          opt_constant_variable.cpp \
116          opt_copy_propagation_elements.cpp \
117          opt_dead_builtin_variables.cpp \
118          opt_dead_builtin_varyings.cpp \
119          opt_dead_code.cpp \
120          opt_dead_code_local.cpp \
121          opt_dead_functions.cpp \
122          opt_flatten_nested_if_blocks.cpp \
123          opt_flip_matrices.cpp \
124          opt_function_inlining.cpp \
125          opt_if_simplification.cpp \
126          opt_minmax.cpp \
127          opt_rebalance_tree.cpp \
128          opt_redundant_jumps.cpp \
129          opt_structure_splitting.cpp \
130          opt_swizzle.cpp \
131          opt_tree_grafting.cpp \
132          opt_vectorize.cpp \
133          propagate_invariance.cpp \
134          s_expression.cpp \
135          string_to_uint_map.cpp \
136          serialize.cpp \
137          shader_cache.cpp \
138          blob.c \
139          glsl_types.cpp \
140          nir_types.cpp \
141          shader_enums.c
142
143# XXX
144.if ${MACHINE} == "vax"
145COPTS.ir_constant_expression.cpp+=      -O0
146COPTS.ir.cpp+=      -O0
147COPTS.nir_constant_expressions.c+=      -O0
148.endif
149
150LIBGLCPP_GENERATED_FILES = \
151          glcpp-lex.c \
152          glcpp-parse.c
153
154LIBGLCPP_FILES = \
155          pp.c
156
157NIR_GENERATED_FILES = \
158          nir_constant_expressions.c \
159          nir_intrinsics.c \
160          nir_opcodes.c \
161          nir_opt_algebraic.c
162
163BUILDSYMLINKS+=     ${X11SRCDIR.Mesa}/src/compiler/nir/nir.c nir_nir.c
164
165NIR_FILES = \
166          nir_nir.c \
167          nir_builtin_builder.c \
168          nir_clone.c \
169          nir_control_flow.c \
170          nir_deref.c \
171          nir_divergence_analysis.c \
172          nir_dominance.c \
173          nir_from_ssa.c \
174          nir_gather_info.c \
175          nir_gather_ssa_types.c \
176          nir_gather_xfb_info.c \
177          nir_gs_count_vertices.c \
178          nir_inline_functions.c \
179          nir_inline_uniforms.c \
180          nir_instr_set.c \
181          nir_linking_helpers.c \
182          nir_liveness.c \
183          nir_loop_analyze.c \
184          nir_lower_alpha_test.c \
185          nir_lower_alu.c \
186          nir_lower_alu_to_scalar.c \
187          nir_lower_array_deref_of_vec.c \
188          nir_lower_atomics_to_ssbo.c \
189          nir_lower_bit_size.c \
190          nir_lower_bitmap.c \
191          nir_lower_blend.c \
192          nir_lower_bool_to_float.c \
193          nir_lower_bool_to_int32.c \
194          nir_lower_clamp_color_outputs.c \
195          nir_lower_clip.c \
196          nir_lower_clip_cull_distance_arrays.c \
197          nir_lower_clip_disable.c \
198          nir_lower_double_ops.c \
199          nir_lower_discard_or_demote.c \
200          nir_lower_drawpixels.c \
201          nir_lower_flatshade.c \
202          nir_lower_flrp.c \
203          nir_lower_fp16_conv.c \
204          nir_lower_fragcolor.c \
205          nir_lower_fragcoord_wtrans.c \
206          nir_lower_frexp.c \
207          nir_lower_global_vars_to_local.c \
208          nir_lower_goto_ifs.c \
209          nir_lower_gs_intrinsics.c \
210          nir_lower_idiv.c \
211          nir_lower_image.c \
212          nir_lower_indirect_derefs.c \
213          nir_lower_int64.c \
214          nir_lower_int_to_float.c \
215          nir_lower_interpolation.c \
216          nir_lower_io.c \
217          nir_lower_io_arrays_to_elements.c \
218          nir_lower_io_to_scalar.c \
219          nir_lower_io_to_vector.c \
220          nir_lower_io_to_temporaries.c \
221          nir_lower_load_const_to_scalar.c \
222          nir_lower_locals_to_regs.c \
223          nir_lower_mediump.c \
224          nir_lower_packing.c \
225          nir_lower_passthrough_edgeflags.c \
226          nir_lower_patch_vertices.c \
227          nir_lower_phis_to_scalar.c \
228          nir_lower_pntc_ytransform.c \
229          nir_lower_point_size.c \
230          nir_lower_point_size_mov.c \
231          nir_lower_regs_to_ssa.c \
232          nir_lower_returns.c \
233          nir_lower_samplers.c \
234          nir_lower_scratch.c \
235          nir_lower_ssbo.c \
236          nir_lower_subgroups.c \
237          nir_lower_system_values.c \
238          nir_lower_sysvals_to_varyings.c \
239          nir_lower_tex.c \
240          nir_lower_texcoord_replace.c \
241          nir_lower_to_source_mods.c \
242          nir_lower_two_sided_color.c \
243          nir_lower_ubo_vec4.c \
244          nir_lower_undef_to_zero.c \
245          nir_lower_uniforms_to_ubo.c \
246          nir_lower_var_copies.c \
247          nir_lower_variable_initializers.c \
248          nir_lower_vars_to_ssa.c \
249          nir_lower_vec_to_movs.c \
250          nir_lower_viewport_transform.c \
251          nir_lower_wpos_center.c \
252          nir_lower_wpos_ytransform.c \
253          nir_lower_wrmasks.c \
254          nir_metadata.c \
255          nir_move_vec_src_uses_to_dest.c \
256          nir_normalize_cubemap_coords.c \
257          nir_opt_access.c \
258          nir_opt_barriers.c \
259          nir_opt_combine_stores.c \
260          nir_opt_comparison_pre.c \
261          nir_opt_conditional_discard.c \
262          nir_opt_constant_folding.c \
263          nir_opt_copy_prop_vars.c \
264          nir_opt_copy_propagate.c \
265          nir_opt_cse.c \
266          nir_opt_dce.c \
267          nir_opt_dead_cf.c \
268          nir_opt_dead_write_vars.c \
269          nir_opt_find_array_copies.c \
270          nir_opt_fragdepth.c \
271          nir_opt_gcm.c \
272          nir_opt_idiv_const.c \
273          nir_opt_if.c \
274          nir_opt_intrinsics.c \
275          nir_opt_large_constants.c \
276          nir_opt_load_store_vectorize.c \
277          nir_opt_loop_unroll.c \
278          nir_opt_memcpy.c \
279          nir_opt_move.c \
280          nir_opt_move_discards_to_top.c \
281          nir_opt_offsets.c \
282          nir_opt_peephole_select.c \
283          nir_opt_phi_precision.c \
284          nir_opt_rematerialize_compares.c \
285          nir_opt_remove_phis.c \
286          nir_opt_shrink_vectors.c \
287          nir_opt_sink.c \
288          nir_opt_trivial_continues.c \
289          nir_opt_undef.c \
290          nir_opt_uniform_atomics.c \
291          nir_opt_vectorize.c \
292          nir_phi_builder.c \
293          nir_print.c \
294          nir_propagate_invariant.c \
295          nir_range_analysis.c \
296          nir_remove_dead_variables.c \
297          nir_repair_ssa.c \
298          nir_schedule.c \
299          nir_search.c \
300          nir_serialize.c \
301          nir_split_per_member_structs.c \
302          nir_split_var_copies.c \
303          nir_split_vars.c \
304          nir_sweep.c \
305          nir_to_lcssa.c \
306          nir_validate.c \
307          nir_worklist.c
308
309SPIRV_GENERATED_FILES = \
310          spirv_info.c \
311          vtn_gather_types.c
312
313SPIRV_FILES = \
314          gl_spirv.c \
315          spirv_to_nir.c \
316          vtn_alu.c \
317          vtn_amd.c \
318          vtn_cfg.c \
319          vtn_glsl450.c \
320          vtn_opencl.c \
321          vtn_subgroup.c \
322          vtn_variables.c
323
324
325.PATH:    ${X11SRCDIR.Mesa}/src/compiler
326.PATH:    ${X11SRCDIR.Mesa}/src/compiler/glsl
327.PATH:    ${X11SRCDIR.Mesa}/../src/compiler/glsl
328.PATH:    ${X11SRCDIR.Mesa}/src/compiler/glsl/glcpp
329.PATH:    ${X11SRCDIR.Mesa}/../src/compiler/glsl/glcpp
330.PATH:    ${X11SRCDIR.Mesa}/src/compiler/nir
331.PATH:    ${X11SRCDIR.Mesa}/../src/compiler/nir
332.PATH:    ${X11SRCDIR.Mesa}/src/compiler/spirv
333.PATH:    ${X11SRCDIR.Mesa}/../src/compiler/spirv
334
335SRCS+=    ${LIBGLSL_GENERATED_CXX_FILES} \
336          ${LIBGLSL_FILES} \
337          ${LIBGLCPP_GENERATED_FILES} \
338          ${LIBGLCPP_FILES} \
339          ${NIR_GENERATED_FILES} \
340          ${NIR_FILES} \
341          ${SPIRV_GENERATED_FILES} \
342          ${SPIRV_FILES}
343