1b8e80941Smrg# Copyright © 2017 Intel Corporation 2b8e80941Smrg 3b8e80941Smrg# Permission is hereby granted, free of charge, to any person obtaining a copy 4b8e80941Smrg# of this software and associated documentation files (the "Software"), to deal 5b8e80941Smrg# in the Software without restriction, including without limitation the rights 6b8e80941Smrg# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7b8e80941Smrg# copies of the Software, and to permit persons to whom the Software is 8b8e80941Smrg# furnished to do so, subject to the following conditions: 9b8e80941Smrg 10b8e80941Smrg# The above copyright notice and this permission notice shall be included in 11b8e80941Smrg# all copies or substantial portions of the Software. 12b8e80941Smrg 13b8e80941Smrg# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14b8e80941Smrg# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15b8e80941Smrg# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16b8e80941Smrg# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17b8e80941Smrg# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18b8e80941Smrg# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19b8e80941Smrg# SOFTWARE. 20b8e80941Smrg 21b8e80941Smrgnir_depends = files('nir_opcodes.py', 'nir_intrinsics.py') 22b8e80941Smrg 23b8e80941Smrgnir_builder_opcodes_h = custom_target( 24b8e80941Smrg 'nir_builder_opcodes.h', 25b8e80941Smrg input : 'nir_builder_opcodes_h.py', 26b8e80941Smrg output : 'nir_builder_opcodes.h', 27b8e80941Smrg command : [prog_python, '@INPUT@'], 28b8e80941Smrg capture : true, 29b8e80941Smrg depend_files : nir_depends, 30b8e80941Smrg) 31b8e80941Smrg 32b8e80941Smrgnir_constant_expressions_c = custom_target( 33b8e80941Smrg 'nir_constant_expressions.c', 34b8e80941Smrg input : 'nir_constant_expressions.py', 35b8e80941Smrg output : 'nir_constant_expressions.c', 36b8e80941Smrg command : [prog_python, '@INPUT@'], 37b8e80941Smrg capture : true, 38b8e80941Smrg depend_files : nir_depends, 39b8e80941Smrg) 40b8e80941Smrg 41b8e80941Smrgnir_opcodes_h = custom_target( 42b8e80941Smrg 'nir_opcodes.h', 43b8e80941Smrg input : 'nir_opcodes_h.py', 44b8e80941Smrg output : 'nir_opcodes.h', 45b8e80941Smrg command : [prog_python, '@INPUT@'], 46b8e80941Smrg capture : true, 47b8e80941Smrg depend_files : nir_depends, 48b8e80941Smrg) 49b8e80941Smrg 50b8e80941Smrgnir_opcodes_c = custom_target( 51b8e80941Smrg 'nir_opcodes.c', 52b8e80941Smrg input : 'nir_opcodes_c.py', 53b8e80941Smrg output : 'nir_opcodes.c', 54b8e80941Smrg command : [prog_python, '@INPUT@'], 55b8e80941Smrg capture : true, 56b8e80941Smrg depend_files : nir_depends, 57b8e80941Smrg) 58b8e80941Smrg 59b8e80941Smrgnir_opt_algebraic_c = custom_target( 60b8e80941Smrg 'nir_opt_algebraic.c', 61b8e80941Smrg input : 'nir_opt_algebraic.py', 62b8e80941Smrg output : 'nir_opt_algebraic.c', 63b8e80941Smrg command : [prog_python, '@INPUT@'], 64b8e80941Smrg capture : true, 65b8e80941Smrg depend_files : files('nir_algebraic.py'), 66b8e80941Smrg) 67b8e80941Smrg 68b8e80941Smrgnir_intrinsics_h = custom_target( 69b8e80941Smrg 'nir_intrinsics.h', 70b8e80941Smrg input : 'nir_intrinsics_h.py', 71b8e80941Smrg output : 'nir_intrinsics.h', 72b8e80941Smrg command : [prog_python, '@INPUT@', '--outdir', meson.current_build_dir()], 73b8e80941Smrg capture : false, 74b8e80941Smrg depend_files : files('nir_intrinsics.py'), 75b8e80941Smrg) 76b8e80941Smrg 77b8e80941Smrgnir_intrinsics_c = custom_target( 78b8e80941Smrg 'nir_intrinsic.c', 79b8e80941Smrg input : 'nir_intrinsics_c.py', 80b8e80941Smrg output : 'nir_intrinsics.c', 81b8e80941Smrg command : [prog_python, '@INPUT@', '--outdir', meson.current_build_dir()], 82b8e80941Smrg capture: false, 83b8e80941Smrg depend_files : files('nir_intrinsics.py'), 84b8e80941Smrg) 85b8e80941Smrg 86b8e80941Smrgfiles_libnir = files( 87b8e80941Smrg 'nir.c', 88b8e80941Smrg 'nir.h', 89b8e80941Smrg 'nir_builder.h', 90b8e80941Smrg 'nir_builtin_builder.c', 91b8e80941Smrg 'nir_builtin_builder.h', 92b8e80941Smrg 'nir_clone.c', 93b8e80941Smrg 'nir_constant_expressions.h', 94b8e80941Smrg 'nir_control_flow.c', 95b8e80941Smrg 'nir_control_flow.h', 96b8e80941Smrg 'nir_control_flow_private.h', 97b8e80941Smrg 'nir_deref.c', 98b8e80941Smrg 'nir_deref.h', 99b8e80941Smrg 'nir_dominance.c', 100b8e80941Smrg 'nir_format_convert.h', 101b8e80941Smrg 'nir_from_ssa.c', 102b8e80941Smrg 'nir_gather_info.c', 103b8e80941Smrg 'nir_gather_ssa_types.c', 104b8e80941Smrg 'nir_gather_xfb_info.c', 105b8e80941Smrg 'nir_gs_count_vertices.c', 106b8e80941Smrg 'nir_inline_functions.c', 107b8e80941Smrg 'nir_instr_set.c', 108b8e80941Smrg 'nir_instr_set.h', 109b8e80941Smrg 'nir_linking_helpers.c', 110b8e80941Smrg 'nir_liveness.c', 111b8e80941Smrg 'nir_loop_analyze.c', 112b8e80941Smrg 'nir_loop_analyze.h', 113b8e80941Smrg 'nir_lower_alu.c', 114b8e80941Smrg 'nir_lower_alu_to_scalar.c', 115b8e80941Smrg 'nir_lower_alpha_test.c', 116b8e80941Smrg 'nir_lower_array_deref_of_vec.c', 117b8e80941Smrg 'nir_lower_atomics_to_ssbo.c', 118b8e80941Smrg 'nir_lower_bitmap.c', 119b8e80941Smrg 'nir_lower_bool_to_float.c', 120b8e80941Smrg 'nir_lower_bool_to_int32.c', 121b8e80941Smrg 'nir_lower_clamp_color_outputs.c', 122b8e80941Smrg 'nir_lower_clip.c', 123b8e80941Smrg 'nir_lower_clip_cull_distance_arrays.c', 124b8e80941Smrg 'nir_lower_constant_initializers.c', 125b8e80941Smrg 'nir_lower_double_ops.c', 126b8e80941Smrg 'nir_lower_drawpixels.c', 127b8e80941Smrg 'nir_lower_fb_read.c', 128b8e80941Smrg 'nir_lower_fragcoord_wtrans.c', 129b8e80941Smrg 'nir_lower_frexp.c', 130b8e80941Smrg 'nir_lower_global_vars_to_local.c', 131b8e80941Smrg 'nir_lower_gs_intrinsics.c', 132b8e80941Smrg 'nir_lower_load_const_to_scalar.c', 133b8e80941Smrg 'nir_lower_locals_to_regs.c', 134b8e80941Smrg 'nir_lower_idiv.c', 135b8e80941Smrg 'nir_lower_indirect_derefs.c', 136b8e80941Smrg 'nir_lower_int64.c', 137b8e80941Smrg 'nir_lower_io.c', 138b8e80941Smrg 'nir_lower_io_arrays_to_elements.c', 139b8e80941Smrg 'nir_lower_io_to_temporaries.c', 140b8e80941Smrg 'nir_lower_io_to_scalar.c', 141b8e80941Smrg 'nir_lower_io_to_vector.c', 142b8e80941Smrg 'nir_lower_non_uniform_access.c', 143b8e80941Smrg 'nir_lower_packing.c', 144b8e80941Smrg 'nir_lower_passthrough_edgeflags.c', 145b8e80941Smrg 'nir_lower_patch_vertices.c', 146b8e80941Smrg 'nir_lower_phis_to_scalar.c', 147b8e80941Smrg 'nir_lower_regs_to_ssa.c', 148b8e80941Smrg 'nir_lower_returns.c', 149b8e80941Smrg 'nir_lower_scratch.c', 150b8e80941Smrg 'nir_lower_subgroups.c', 151b8e80941Smrg 'nir_lower_system_values.c', 152b8e80941Smrg 'nir_lower_tex.c', 153b8e80941Smrg 'nir_lower_to_source_mods.c', 154b8e80941Smrg 'nir_lower_two_sided_color.c', 155b8e80941Smrg 'nir_lower_vars_to_ssa.c', 156b8e80941Smrg 'nir_lower_var_copies.c', 157b8e80941Smrg 'nir_lower_vec_to_movs.c', 158b8e80941Smrg 'nir_lower_viewport_transform.c', 159b8e80941Smrg 'nir_lower_wpos_center.c', 160b8e80941Smrg 'nir_lower_wpos_ytransform.c', 161b8e80941Smrg 'nir_lower_bit_size.c', 162b8e80941Smrg 'nir_lower_uniforms_to_ubo.c', 163b8e80941Smrg 'nir_metadata.c', 164b8e80941Smrg 'nir_move_load_const.c', 165b8e80941Smrg 'nir_move_vec_src_uses_to_dest.c', 166b8e80941Smrg 'nir_normalize_cubemap_coords.c', 167b8e80941Smrg 'nir_opt_combine_stores.c', 168b8e80941Smrg 'nir_opt_comparison_pre.c', 169b8e80941Smrg 'nir_opt_conditional_discard.c', 170b8e80941Smrg 'nir_opt_constant_folding.c', 171b8e80941Smrg 'nir_opt_copy_prop_vars.c', 172b8e80941Smrg 'nir_opt_copy_propagate.c', 173b8e80941Smrg 'nir_opt_cse.c', 174b8e80941Smrg 'nir_opt_dce.c', 175b8e80941Smrg 'nir_opt_dead_cf.c', 176b8e80941Smrg 'nir_opt_dead_write_vars.c', 177b8e80941Smrg 'nir_opt_find_array_copies.c', 178b8e80941Smrg 'nir_opt_gcm.c', 179b8e80941Smrg 'nir_opt_idiv_const.c', 180b8e80941Smrg 'nir_opt_if.c', 181b8e80941Smrg 'nir_opt_intrinsics.c', 182b8e80941Smrg 'nir_opt_large_constants.c', 183b8e80941Smrg 'nir_opt_loop_unroll.c', 184b8e80941Smrg 'nir_opt_move_comparisons.c', 185b8e80941Smrg 'nir_opt_move_load_ubo.c', 186b8e80941Smrg 'nir_opt_peephole_select.c', 187b8e80941Smrg 'nir_opt_remove_phis.c', 188b8e80941Smrg 'nir_opt_shrink_load.c', 189b8e80941Smrg 'nir_opt_trivial_continues.c', 190b8e80941Smrg 'nir_opt_undef.c', 191b8e80941Smrg 'nir_phi_builder.c', 192b8e80941Smrg 'nir_phi_builder.h', 193b8e80941Smrg 'nir_print.c', 194b8e80941Smrg 'nir_propagate_invariant.c', 195b8e80941Smrg 'nir_remove_dead_variables.c', 196b8e80941Smrg 'nir_repair_ssa.c', 197b8e80941Smrg 'nir_search.c', 198b8e80941Smrg 'nir_search.h', 199b8e80941Smrg 'nir_search_helpers.h', 200b8e80941Smrg 'nir_serialize.c', 201b8e80941Smrg 'nir_serialize.h', 202b8e80941Smrg 'nir_strip.c', 203b8e80941Smrg 'nir_split_per_member_structs.c', 204b8e80941Smrg 'nir_split_var_copies.c', 205b8e80941Smrg 'nir_split_vars.c', 206b8e80941Smrg 'nir_sweep.c', 207b8e80941Smrg 'nir_to_lcssa.c', 208b8e80941Smrg 'nir_validate.c', 209b8e80941Smrg 'nir_vla.h', 210b8e80941Smrg 'nir_worklist.c', 211b8e80941Smrg 'nir_worklist.h', 212b8e80941Smrg 'nir_xfb_info.h', 213b8e80941Smrg '../spirv/GLSL.ext.AMD.h', 214b8e80941Smrg '../spirv/GLSL.std.450.h', 215b8e80941Smrg '../spirv/gl_spirv.c', 216b8e80941Smrg '../spirv/nir_spirv.h', 217b8e80941Smrg '../spirv/OpenCL.std.h', 218b8e80941Smrg '../spirv/spirv.h', 219b8e80941Smrg '../spirv/spirv_info.h', 220b8e80941Smrg '../spirv/spirv_to_nir.c', 221b8e80941Smrg '../spirv/vtn_alu.c', 222b8e80941Smrg '../spirv/vtn_amd.c', 223b8e80941Smrg '../spirv/vtn_cfg.c', 224b8e80941Smrg '../spirv/vtn_glsl450.c', 225b8e80941Smrg '../spirv/vtn_opencl.c', 226b8e80941Smrg '../spirv/vtn_private.h', 227b8e80941Smrg '../spirv/vtn_subgroup.c', 228b8e80941Smrg '../spirv/vtn_variables.c', 229b8e80941Smrg) 230b8e80941Smrg 231b8e80941Smrglibnir = static_library( 232b8e80941Smrg 'nir', 233b8e80941Smrg [files_libnir, spirv_info_c, nir_opt_algebraic_c, nir_opcodes_c, 234b8e80941Smrg nir_opcodes_h, nir_constant_expressions_c, nir_builder_opcodes_h, 235b8e80941Smrg vtn_gather_types_c, nir_intrinsics_c, nir_intrinsics_h], 236b8e80941Smrg include_directories : [inc_common, inc_compiler, include_directories('../spirv')], 237b8e80941Smrg c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args], 238b8e80941Smrg link_with : libcompiler, 239b8e80941Smrg build_by_default : false, 240b8e80941Smrg) 241b8e80941Smrg 242b8e80941Smrg# Headers-only dependency 243b8e80941Smrgidep_nir_headers = declare_dependency( 244b8e80941Smrg sources : [nir_opcodes_h, nir_builder_opcodes_h, nir_intrinsics_h], 245b8e80941Smrg include_directories : include_directories('.'), 246b8e80941Smrg) 247b8e80941Smrg 248b8e80941Smrg# Also link with nir 249b8e80941Smrgidep_nir = declare_dependency( 250b8e80941Smrg dependencies : idep_nir_headers, 251b8e80941Smrg link_with : libnir, 252b8e80941Smrg) 253b8e80941Smrg 254b8e80941Smrgnir_algebraic_py = files('nir_algebraic.py') 255b8e80941Smrg 256b8e80941Smrgif with_tests 257b8e80941Smrg test( 258b8e80941Smrg 'nir_control_flow', 259b8e80941Smrg executable( 260b8e80941Smrg 'nir_control_flow_test', 261b8e80941Smrg files('tests/control_flow_tests.cpp'), 262b8e80941Smrg cpp_args : [cpp_vis_args, cpp_msvc_compat_args], 263b8e80941Smrg include_directories : [inc_common], 264b8e80941Smrg dependencies : [dep_thread, idep_gtest, idep_nir], 265b8e80941Smrg link_with : libmesa_util, 266b8e80941Smrg ), 267b8e80941Smrg suite : ['compiler', 'nir'], 268b8e80941Smrg ) 269b8e80941Smrg 270b8e80941Smrg test( 271b8e80941Smrg 'nir_vars', 272b8e80941Smrg executable( 273b8e80941Smrg 'nir_vars_test', 274b8e80941Smrg files('tests/vars_tests.cpp'), 275b8e80941Smrg cpp_args : [cpp_vis_args, cpp_msvc_compat_args], 276b8e80941Smrg include_directories : [inc_common], 277b8e80941Smrg dependencies : [dep_thread, idep_gtest, idep_nir], 278b8e80941Smrg link_with : libmesa_util, 279b8e80941Smrg ), 280b8e80941Smrg suite : ['compiler', 'nir'], 281b8e80941Smrg ) 282b8e80941Smrg test( 283b8e80941Smrg 'nir_algebraic_parser', 284b8e80941Smrg prog_python, 285b8e80941Smrg args : [ 286b8e80941Smrg join_paths(meson.current_source_dir(), 'tests/algebraic_parser_test.py') 287b8e80941Smrg ], 288b8e80941Smrg suite : ['compiler', 'nir'], 289b8e80941Smrg ) 290b8e80941Smrg 291b8e80941Smrg test( 292b8e80941Smrg 'negative_equal', 293b8e80941Smrg executable( 294b8e80941Smrg 'negative_equal', 295b8e80941Smrg files('tests/negative_equal_tests.cpp'), 296b8e80941Smrg c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args], 297b8e80941Smrg include_directories : [inc_common], 298b8e80941Smrg dependencies : [dep_thread, idep_gtest, idep_nir], 299b8e80941Smrg link_with : libmesa_util, 300b8e80941Smrg ) 301b8e80941Smrg ) 302b8e80941Smrg 303b8e80941Smrg test( 304b8e80941Smrg 'comparison_pre', 305b8e80941Smrg executable( 306b8e80941Smrg 'comparison_pre', 307b8e80941Smrg files('tests/comparison_pre_tests.cpp'), 308b8e80941Smrg c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args], 309b8e80941Smrg include_directories : [inc_common], 310b8e80941Smrg dependencies : [dep_thread, idep_gtest, idep_nir], 311b8e80941Smrg link_with : libmesa_util, 312b8e80941Smrg ) 313b8e80941Smrg ) 314b8e80941Smrgendif 315