1# Copyright © 2017 Intel Corporation 2# SPDX-License-Identifier: MIT 3 4nir_depends = files('nir_opcodes.py', 'nir_intrinsics.py') 5 6nir_algebraic_depends = files('nir_opcodes.py', 'nir_algebraic.py') 7 8nir_builder_opcodes_h = custom_target( 9 'nir_builder_opcodes.h', 10 input : 'nir_builder_opcodes_h.py', 11 output : 'nir_builder_opcodes.h', 12 command : [prog_python, '@INPUT@'], 13 capture : true, 14 depend_files : nir_depends, 15) 16 17nir_constant_expressions_c = custom_target( 18 'nir_constant_expressions.c', 19 input : 'nir_constant_expressions.py', 20 output : 'nir_constant_expressions.c', 21 command : [prog_python, '@INPUT@'], 22 capture : true, 23 depend_files : nir_depends, 24) 25 26nir_opcodes_h = custom_target( 27 'nir_opcodes.h', 28 input : 'nir_opcodes_h.py', 29 output : 'nir_opcodes.h', 30 command : [prog_python, '@INPUT@'], 31 capture : true, 32 depend_files : nir_depends, 33) 34 35nir_opcodes_c = custom_target( 36 'nir_opcodes.c', 37 input : 'nir_opcodes_c.py', 38 output : 'nir_opcodes.c', 39 command : [prog_python, '@INPUT@'], 40 capture : true, 41 depend_files : nir_depends, 42) 43 44nir_opt_algebraic_c = custom_target( 45 'nir_opt_algebraic.c', 46 input : 'nir_opt_algebraic.py', 47 output : 'nir_opt_algebraic.c', 48 command : [prog_python, '@INPUT@', '--out', '@OUTPUT@'], 49 depend_files : nir_algebraic_depends, 50) 51 52nir_intrinsics_h = custom_target( 53 'nir_intrinsics.h', 54 input : 'nir_intrinsics_h.py', 55 output : 'nir_intrinsics.h', 56 command : [prog_python, '@INPUT@', '--outdir', meson.current_build_dir()], 57 capture : false, 58 depend_files : files('nir_intrinsics.py'), 59) 60 61nir_intrinsics_indices_h = custom_target( 62 'nir_intrinsics_indices.h', 63 input : 'nir_intrinsics_indices_h.py', 64 output : 'nir_intrinsics_indices.h', 65 command : [prog_python, '@INPUT@', '--outdir', meson.current_build_dir()], 66 capture : false, 67 depend_files : files('nir_intrinsics.py'), 68) 69 70nir_intrinsics_c = custom_target( 71 'nir_intrinsic.c', 72 input : 'nir_intrinsics_c.py', 73 output : 'nir_intrinsics.c', 74 command : [prog_python, '@INPUT@', '--outdir', meson.current_build_dir()], 75 capture: false, 76 depend_files : files('nir_intrinsics.py'), 77) 78 79files_libnir = files( 80 'nir.c', 81 'nir.h', 82 'nir_builder.c', 83 'nir_builder.h', 84 'nir_builtin_builder.c', 85 'nir_builtin_builder.h', 86 'nir_conversion_builder.h', 87 'nir_clone.c', 88 'nir_constant_expressions.h', 89 'nir_control_flow.c', 90 'nir_control_flow.h', 91 'nir_control_flow_private.h', 92 'nir_deref.c', 93 'nir_deref.h', 94 'nir_divergence_analysis.c', 95 'nir_dominance.c', 96 'nir_format_convert.c', 97 'nir_format_convert.h', 98 'nir_from_ssa.c', 99 'nir_functions.c', 100 'nir_gather_info.c', 101 'nir_gather_types.c', 102 'nir_gather_xfb_info.c', 103 'nir_group_loads.c', 104 'nir_gs_count_vertices.c', 105 'nir_inline_uniforms.c', 106 'nir_instr_set.c', 107 'nir_instr_set.h', 108 'nir_legacy.c', 109 'nir_legacy.h', 110 'nir_linking_helpers.c', 111 'nir_liveness.c', 112 'nir_loop_analyze.c', 113 'nir_loop_analyze.h', 114 'nir_lower_alu.c', 115 'nir_lower_alu_width.c', 116 'nir_lower_alpha_test.c', 117 'nir_lower_amul.c', 118 'nir_lower_array_deref_of_vec.c', 119 'nir_lower_atomics_to_ssbo.c', 120 'nir_lower_bitmap.c', 121 'nir_lower_blend.c', 122 'nir_lower_bool_to_bitsize.c', 123 'nir_lower_bool_to_float.c', 124 'nir_lower_bool_to_int32.c', 125 'nir_lower_cl_images.c', 126 'nir_lower_clamp_color_outputs.c', 127 'nir_lower_clip.c', 128 'nir_lower_clip_cull_distance_arrays.c', 129 'nir_lower_clip_disable.c', 130 'nir_lower_clip_halfz.c', 131 'nir_lower_const_arrays_to_uniforms.c', 132 'nir_lower_continue_constructs.c', 133 'nir_lower_convert_alu_types.c', 134 'nir_lower_variable_initializers.c', 135 'nir_lower_discard_if.c', 136 'nir_lower_double_ops.c', 137 'nir_lower_drawpixels.c', 138 'nir_lower_fb_read.c', 139 'nir_lower_flatshade.c', 140 'nir_lower_flrp.c', 141 'nir_lower_fp16_conv.c', 142 'nir_lower_fragcoord_wtrans.c', 143 'nir_lower_frag_coord_to_pixel_coord.c', 144 'nir_lower_fragcolor.c', 145 'nir_lower_frexp.c', 146 'nir_lower_global_vars_to_local.c', 147 'nir_lower_goto_ifs.c', 148 'nir_lower_gs_intrinsics.c', 149 'nir_lower_helper_writes.c', 150 'nir_lower_load_const_to_scalar.c', 151 'nir_lower_locals_to_regs.c', 152 'nir_lower_idiv.c', 153 'nir_lower_image.c', 154 'nir_lower_image_atomics_to_global.c', 155 'nir_lower_indirect_derefs.c', 156 'nir_lower_input_attachments.c', 157 'nir_lower_int64.c', 158 'nir_lower_interpolation.c', 159 'nir_lower_int_to_float.c', 160 'nir_lower_io.c', 161 'nir_lower_io_arrays_to_elements.c', 162 'nir_lower_io_to_temporaries.c', 163 'nir_lower_io_to_scalar.c', 164 'nir_lower_io_to_vector.c', 165 'nir_lower_is_helper_invocation.c', 166 'nir_lower_multiview.c', 167 'nir_lower_mediump.c', 168 'nir_lower_mem_access_bit_sizes.c', 169 'nir_lower_memcpy.c', 170 'nir_lower_memory_model.c', 171 'nir_lower_non_uniform_access.c', 172 'nir_lower_packing.c', 173 'nir_lower_passthrough_edgeflags.c', 174 'nir_lower_patch_vertices.c', 175 'nir_lower_phis_to_scalar.c', 176 'nir_lower_pntc_ytransform.c', 177 'nir_lower_point_size.c', 178 'nir_lower_point_size_mov.c', 179 'nir_lower_point_smooth.c', 180 'nir_lower_poly_line_smooth.c', 181 'nir_lower_printf.c', 182 'nir_lower_reg_intrinsics_to_ssa.c', 183 'nir_lower_readonly_images_to_tex.c', 184 'nir_lower_returns.c', 185 'nir_lower_robust_access.c', 186 'nir_lower_samplers.c', 187 'nir_lower_scratch.c', 188 'nir_lower_shader_calls.c', 189 'nir_lower_single_sampled.c', 190 'nir_lower_ssbo.c', 191 'nir_lower_subgroups.c', 192 'nir_lower_system_values.c', 193 'nir_lower_task_shader.c', 194 'nir_lower_terminate_to_demote.c', 195 'nir_lower_tess_coord_z.c', 196 'nir_lower_tex_shadow.c', 197 'nir_lower_tex.c', 198 'nir_lower_texcoord_replace.c', 199 'nir_lower_texcoord_replace_late.c', 200 'nir_lower_two_sided_color.c', 201 'nir_lower_undef_to_zero.c', 202 'nir_lower_vars_to_ssa.c', 203 'nir_lower_var_copies.c', 204 'nir_lower_vec_to_regs.c', 205 'nir_lower_vec3_to_vec4.c', 206 'nir_lower_view_index_to_device_index.c', 207 'nir_lower_viewport_transform.c', 208 'nir_lower_wpos_center.c', 209 'nir_lower_wpos_ytransform.c', 210 'nir_lower_wrmasks.c', 211 'nir_lower_bit_size.c', 212 'nir_lower_ubo_vec4.c', 213 'nir_lower_uniforms_to_ubo.c', 214 'nir_lower_sysvals_to_varyings.c', 215 'nir_metadata.c', 216 'nir_mod_analysis.c', 217 'nir_move_vec_src_uses_to_dest.c', 218 'nir_normalize_cubemap_coords.c', 219 'nir_opt_access.c', 220 'nir_opt_barriers.c', 221 'nir_opt_combine_stores.c', 222 'nir_opt_comparison_pre.c', 223 'nir_opt_conditional_discard.c', 224 'nir_opt_constant_folding.c', 225 'nir_opt_copy_prop_vars.c', 226 'nir_opt_copy_propagate.c', 227 'nir_opt_cse.c', 228 'nir_opt_dce.c', 229 'nir_opt_dead_cf.c', 230 'nir_opt_dead_write_vars.c', 231 'nir_opt_find_array_copies.c', 232 'nir_opt_fragdepth.c', 233 'nir_opt_gcm.c', 234 'nir_opt_generate_bfi.c', 235 'nir_opt_idiv_const.c', 236 'nir_opt_if.c', 237 'nir_opt_intrinsics.c', 238 'nir_opt_large_constants.c', 239 'nir_opt_licm.c', 240 'nir_opt_load_store_vectorize.c', 241 'nir_opt_loop.c', 242 'nir_opt_loop_unroll.c', 243 'nir_opt_memcpy.c', 244 'nir_opt_move.c', 245 'nir_opt_move_discards_to_top.c', 246 'nir_opt_mqsad.c', 247 'nir_opt_non_uniform_access.c', 248 'nir_opt_offsets.c', 249 'nir_opt_peephole_select.c', 250 'nir_opt_phi_precision.c', 251 'nir_opt_preamble.c', 252 'nir_opt_ray_queries.c', 253 'nir_opt_reassociate_bfi.c', 254 'nir_opt_rematerialize_compares.c', 255 'nir_opt_remove_phis.c', 256 'nir_opt_reuse_constants.c', 257 'nir_opt_shrink_stores.c', 258 'nir_opt_shrink_vectors.c', 259 'nir_opt_sink.c', 260 'nir_opt_undef.c', 261 'nir_opt_uniform_atomics.c', 262 'nir_opt_uniform_subgroup.c', 263 'nir_opt_varyings.c', 264 'nir_opt_vectorize.c', 265 'nir_opt_vectorize_io.c', 266 'nir_passthrough_gs.c', 267 'nir_passthrough_tcs.c', 268 'nir_phi_builder.c', 269 'nir_phi_builder.h', 270 'nir_print.c', 271 'nir_propagate_invariant.c', 272 'nir_range_analysis.c', 273 'nir_range_analysis.h', 274 'nir_remove_dead_variables.c', 275 'nir_remove_tex_shadow.c', 276 'nir_repair_ssa.c', 277 'nir_scale_fdiv.c', 278 'nir_schedule.c', 279 'nir_schedule.h', 280 'nir_search.c', 281 'nir_search.h', 282 'nir_search_helpers.h', 283 'nir_serialize.c', 284 'nir_serialize.h', 285 'nir_split_64bit_vec3_and_vec4.c', 286 'nir_split_per_member_structs.c', 287 'nir_split_var_copies.c', 288 'nir_split_vars.c', 289 'nir_sweep.c', 290 'nir_to_lcssa.c', 291 'nir_trivialize_registers.c', 292 'nir_use_dominance.c', 293 'nir_validate.c', 294 'nir_vla.h', 295 'nir_worklist.c', 296 'nir_worklist.h', 297 'nir_xfb_info.h', 298) 299 300# When a file is too large, -Wmisleading-indentation will give a note about 301# not being able to process it, however that is not suppressable by a #pragma 302# in GCC. This happens with the generated code in nir_opt_algebraic.c. 303# 304# As a workaround, drop the warning for GCC. Clang builds should cover this. 305no_misleading_indentation = [] 306if cc.get_id() == 'gcc' 307 no_misleading_indentation += cc.get_supported_arguments('-Wno-misleading-indentation') 308endif 309 310_libnir = static_library( 311 'nir', 312 [files_libnir, nir_opt_algebraic_c, nir_opcodes_c, 313 nir_opcodes_h, nir_constant_expressions_c, nir_builder_opcodes_h, 314 nir_intrinsics_c, nir_intrinsics_h, nir_intrinsics_indices_h], 315 include_directories : [inc_include, inc_src], 316 c_args : [c_msvc_compat_args, no_override_init_args, no_misleading_indentation], 317 gnu_symbol_visibility : 'hidden', 318 dependencies : [idep_compiler, dep_valgrind, idep_mesautil], 319 build_by_default : false, 320) 321 322inc_nir = include_directories('.') 323 324# Headers-only dependency 325idep_nir_headers = declare_dependency( 326 sources : [nir_opcodes_h, nir_builder_opcodes_h, nir_intrinsics_h, nir_intrinsics_indices_h, 327 ir_expression_operation_h, builtin_types_h], 328 include_directories : [inc_nir, inc_compiler, inc_src, inc_include], 329) 330 331# Also link with nir 332idep_nir = declare_dependency( 333 dependencies : [idep_nir_headers, idep_mesautil, idep_compiler], 334 link_with : _libnir, 335) 336 337if with_tests 338 if cc.get_id() == 'msvc' and cc.version().version_compare('< 19.29') 339 msvc_designated_initializer = 'cpp_std=c++latest' 340 else 341 msvc_designated_initializer = 'cpp_std=c++20' 342 endif 343 344 msvc_bigobj = [] 345 if cc.get_id() == 'msvc' 346 msvc_bigobj = '/bigobj' 347 endif 348 349 test( 350 'nir_tests', 351 executable( 352 'nir_tests', 353 files( 354 'tests/algebraic_tests.cpp', 355 'tests/builder_tests.cpp', 356 'tests/comparison_pre_tests.cpp', 357 'tests/control_flow_tests.cpp', 358 'tests/core_tests.cpp', 359 'tests/dce_tests.cpp', 360 'tests/format_convert_tests.cpp', 361 'tests/load_store_vectorizer_tests.cpp', 362 'tests/loop_analyze_tests.cpp', 363 'tests/loop_unroll_tests.cpp', 364 'tests/lower_alu_width_tests.cpp', 365 'tests/mod_analysis_tests.cpp', 366 'tests/negative_equal_tests.cpp', 367 'tests/opt_if_tests.cpp', 368 'tests/opt_loop_tests.cpp', 369 'tests/opt_peephole_select.cpp', 370 'tests/opt_shrink_vectors_tests.cpp', 371 'tests/opt_varyings_tests_bicm_binary_alu.cpp', 372 'tests/opt_varyings_tests_dead_input.cpp', 373 'tests/opt_varyings_tests_dead_output.cpp', 374 'tests/opt_varyings_tests_dedup.cpp', 375 'tests/opt_varyings_tests_prop_const.cpp', 376 'tests/opt_varyings_tests_prop_ubo.cpp', 377 'tests/opt_varyings_tests_prop_uniform.cpp', 378 'tests/opt_varyings_tests_prop_uniform_expr.cpp', 379 'tests/serialize_tests.cpp', 380 'tests/range_analysis_tests.cpp', 381 'tests/vars_tests.cpp', 382 ), 383 cpp_args : [cpp_msvc_compat_args, msvc_bigobj], 384 override_options: [msvc_designated_initializer], 385 gnu_symbol_visibility : 'hidden', 386 include_directories : [inc_include, inc_src], 387 dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil], 388 ), 389 suite : ['compiler', 'nir'], 390 protocol : 'gtest', 391 ) 392 393 test( 394 'nir_algebraic_parser', 395 prog_python, 396 args : [ 397 files('tests/algebraic_parser_test.py') 398 ], 399 suite : ['compiler', 'nir'], 400 ) 401endif 402