1# Copyright © 2017 Intel Corporation 2 3# Permission is hereby granted, free of charge, to any person obtaining a copy 4# of this software and associated documentation files (the "Software"), to deal 5# in the Software without restriction, including without limitation the rights 6# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7# copies of the Software, and to permit persons to whom the Software is 8# furnished to do so, subject to the following conditions: 9 10# The above copyright notice and this permission notice shall be included in 11# all copies or substantial portions of the Software. 12 13# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19# SOFTWARE. 20 21radv_entrypoints_gen_command = [ 22 prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak', 23 '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', 24 '--beta', with_vulkan_beta.to_string() 25] 26 27radv_entrypoints_gen_command += [ 28 # RADV entrypooints 29 '--prefix', 'radv', 30 31 # Tracing layer entrypoints 32 '--device-prefix', 'sqtt', 33 '--device-prefix', 'rra', 34 '--device-prefix', 'rmv', 35 '--device-prefix', 'ctx_roll', 36 37 # Application layer entrypoints 38 '--device-prefix', 'metro_exodus', 39 '--device-prefix', 'rage2', 40 '--device-prefix', 'quantic_dream', 41] 42 43radv_entrypoints = custom_target( 44 'radv_entrypoints', 45 input : [vk_entrypoints_gen, vk_api_xml], 46 output : ['radv_entrypoints.h', 'radv_entrypoints.c'], 47 command : radv_entrypoints_gen_command, 48 depend_files : vk_entrypoints_gen_depend_files, 49) 50 51libradv_files = files( 52 'bvh/bvh.h', 53 'layers/radv_ctx_roll_layer.c', 54 'layers/radv_metro_exodus.c', 55 'layers/radv_rage2.c', 56 'layers/radv_quantic_dream.c', 57 'layers/radv_rmv_layer.c', 58 'layers/radv_rra_layer.c', 59 'layers/radv_sqtt_layer.c', 60 'meta/radv_meta.c', 61 'meta/radv_meta.h', 62 'meta/radv_meta_astc_decode.c', 63 'meta/radv_meta_blit.c', 64 'meta/radv_meta_blit2d.c', 65 'meta/radv_meta_buffer.c', 66 'meta/radv_meta_bufimage.c', 67 'meta/radv_meta_clear.c', 68 'meta/radv_meta_copy.c', 69 'meta/radv_meta_copy_vrs_htile.c', 70 'meta/radv_meta_dcc_retile.c', 71 'meta/radv_meta_decompress.c', 72 'meta/radv_meta_etc_decode.c', 73 'meta/radv_meta_fast_clear.c', 74 'meta/radv_meta_fmask_copy.c', 75 'meta/radv_meta_fmask_expand.c', 76 'meta/radv_meta_resolve.c', 77 'meta/radv_meta_resolve_cs.c', 78 'meta/radv_meta_resolve_fs.c', 79 'nir/radv_nir.h', 80 'nir/radv_nir_apply_pipeline_layout.c', 81 'nir/radv_nir_export_multiview.c', 82 'nir/radv_nir_lower_abi.c', 83 'nir/radv_nir_lower_cooperative_matrix.c', 84 'nir/radv_nir_lower_fs_barycentric.c', 85 'nir/radv_nir_lower_fs_intrinsics.c', 86 'nir/radv_nir_lower_hit_attrib_derefs.c', 87 'nir/radv_nir_lower_intrinsics_early.c', 88 'nir/radv_nir_lower_io.c', 89 'nir/radv_nir_lower_poly_line_smooth.c', 90 'nir/radv_nir_lower_primitive_shading_rate.c', 91 'nir/radv_nir_lower_ray_queries.c', 92 'nir/radv_nir_lower_view_index.c', 93 'nir/radv_nir_lower_viewport_to_zero.c', 94 'nir/radv_nir_lower_vs_inputs.c', 95 'nir/radv_nir_rt_common.c', 96 'nir/radv_nir_rt_shader.c', 97 'winsys/null/radv_null_bo.c', 98 'winsys/null/radv_null_bo.h', 99 'winsys/null/radv_null_cs.c', 100 'winsys/null/radv_null_cs.h', 101 'winsys/null/radv_null_winsys.c', 102 'winsys/null/radv_null_winsys_public.h', 103 'radv_acceleration_structure.c', 104 'radv_android.c', 105 'radv_buffer.c', 106 'radv_buffer_view.c', 107 'radv_cmd_buffer.c', 108 'radv_cp_reg_shadowing.c', 109 'radv_cs.h', 110 'radv_debug.c', 111 'radv_debug.h', 112 'radv_device.c', 113 'radv_device_memory.c', 114 'radv_descriptor_set.c', 115 'radv_descriptor_set.h', 116 'radv_device_generated_commands.c', 117 'radv_event.c', 118 'radv_formats.c', 119 'radv_image.c', 120 'radv_image_view.c', 121 'radv_instance.c', 122 'radv_perfcounter.c', 123 'radv_physical_device.c', 124 'radv_pipeline.c', 125 'radv_pipeline_cache.c', 126 'radv_pipeline_compute.c', 127 'radv_pipeline_graphics.c', 128 'radv_pipeline_rt.c', 129 'radv_printf.c', 130 'radv_private.h', 131 'radv_queue.c', 132 'radv_radeon_winsys.h', 133 'radv_rmv.c', 134 'radv_rra.c', 135 'radv_sampler.c', 136 'radv_sdma.c', 137 'radv_sdma.h', 138 'radv_shader.c', 139 'radv_shader.h', 140 'radv_shader_args.c', 141 'radv_shader_args.h', 142 'radv_shader_info.c', 143 'radv_shader_object.c', 144 'radv_spm.c', 145 'radv_sqtt.c', 146 'radv_query.c', 147 'radv_video.c', 148 'radv_wsi.c', 149 'si_cmd_buffer.c', 150 'vk_format.h', 151) 152 153if not with_platform_windows 154 libradv_files += files( 155 'winsys/amdgpu/radv_amdgpu_bo.c', 156 'winsys/amdgpu/radv_amdgpu_bo.h', 157 'winsys/amdgpu/radv_amdgpu_cs.c', 158 'winsys/amdgpu/radv_amdgpu_cs.h', 159 'winsys/amdgpu/radv_amdgpu_surface.c', 160 'winsys/amdgpu/radv_amdgpu_surface.h', 161 'winsys/amdgpu/radv_amdgpu_winsys.c', 162 'winsys/amdgpu/radv_amdgpu_winsys.h', 163 'winsys/amdgpu/radv_amdgpu_winsys_public.h', 164 ) 165endif 166 167if with_llvm 168 libradv_files += files( 169 'radv_llvm_helper.cpp', 170 'radv_llvm_helper.h', 171 'radv_nir_to_llvm.c', 172 ) 173endif 174 175subdir('radix_sort') 176libradv_files += radix_sort_files 177 178subdir('bvh') 179 180radv_deps = [] 181radv_flags = cc.get_supported_arguments(['-Wimplicit-fallthrough', '-Wshadow']) 182 183if with_platform_x11 184 radv_deps += dep_xcb_dri3 185endif 186 187if with_platform_wayland 188 radv_deps += dep_wayland_client 189endif 190 191if with_xlib_lease 192 radv_deps += [dep_xlib_xrandr] 193endif 194 195if with_platform_android 196 radv_deps += dep_android 197endif 198 199radv_build_id = get_option('radv-build-id') 200if radv_build_id != '' 201 radv_flags += '-DRADV_BUILD_ID_OVERRIDE="' + radv_build_id + '"' 202endif 203 204libvulkan_radeon = shared_library( 205 'vulkan_radeon', 206 [libradv_files, radv_entrypoints, sha1_h, radix_sort_spv, bvh_spv], 207 vs_module_defs : vulkan_api_def, 208 include_directories : [ 209 inc_include, inc_src, inc_amd, inc_amd_common, inc_amd_common_llvm, inc_util, 210 ], 211 link_with : [ 212 libamd_common, libamd_common_llvm, libamdgpu_addrlib, 213 ], 214 dependencies : [ 215 dep_llvm, dep_libdrm_amdgpu, dep_thread, dep_elf, dep_dl, dep_m, 216 dep_valgrind, radv_deps, idep_aco, 217 idep_mesautil, idep_nir, idep_vulkan_util, idep_vulkan_wsi, 218 idep_vulkan_runtime, idep_amdgfxregs_h, idep_xmlconfig, 219 idep_vulkan_common_entrypoints_h, idep_vulkan_wsi_entrypoints_h 220 ], 221 c_args : [no_override_init_args, radv_flags, c_msvc_compat_args], 222 cpp_args : [radv_flags, cpp_msvc_compat_args], 223 link_args : [ 224 ld_args_build_id, ld_args_bsymbolic, ld_args_gc_sections, vulkan_icd_link_args, 225 ], 226 link_depends : vulkan_icd_link_depends, 227 gnu_symbol_visibility : 'hidden', 228 name_prefix : host_machine.system() == 'windows' ? '' : [], 229 install : true, 230) 231 232if with_symbols_check 233 test( 234 'radv symbols check', 235 symbols_check, 236 args : [ 237 '--lib', libvulkan_radeon, 238 '--symbols-file', vulkan_icd_symbols, 239 '--ignore-symbol', 'ac_init_shared_llvm_once', 240 symbols_check_args, 241 ], 242 suite : ['amd'], 243 ) 244endif 245 246icd_lib_path = join_paths(get_option('prefix'), get_option('libdir')) 247icd_file_name = 'libvulkan_radeon.so' 248if with_platform_windows 249 icd_lib_path = join_paths(get_option('prefix'), get_option('bindir')) 250 icd_file_name = 'vulkan_radeon.dll' 251endif 252 253icd_command = [ 254 prog_python, '@INPUT0@', 255 '--api-version', '1.3', '--xml', '@INPUT1@', 256 '--lib-path', join_paths(icd_lib_path, icd_file_name), 257 '--out', '@OUTPUT@', 258] 259if with_platform_windows 260 icd_command += '--use-backslash' 261endif 262 263radeon_icd = custom_target( 264 'radeon_icd', 265 input : [vk_icd_gen, vk_api_xml], 266 output : 'radeon_icd.@0@.json'.format(host_machine.cpu()), 267 command : icd_command, 268 build_by_default : true, 269 install_dir : with_vulkan_icd_dir, 270 install_tag : 'runtime', 271 install : true, 272) 273 274_dev_icdname = 'radeon_devenv_icd.@0@.json'.format(host_machine.cpu()) 275_dev_icd = custom_target( 276 'radeon_devenv_icd', 277 input : [vk_icd_gen, vk_api_xml], 278 output : _dev_icdname, 279 command : [ 280 prog_python, '@INPUT0@', 281 '--api-version', '1.3', '--xml', '@INPUT1@', 282 '--lib-path', meson.current_build_dir() / icd_file_name, 283 '--out', '@OUTPUT@', 284 ], 285 build_by_default : true, 286) 287 288devenv.append('VK_ICD_FILENAMES', _dev_icd.full_path()) 289 290if with_tests 291 test( 292 'radv_tests', 293 executable( 294 'radv_tests', 295 files( 296 'nir/radv_nir_lower_hit_attrib_derefs.c', 297 'tests/radv_nir_lower_hit_attrib_derefs_tests.cpp', 298 ), 299 cpp_args : [cpp_msvc_compat_args], 300 gnu_symbol_visibility : 'hidden', 301 include_directories : [ 302 inc_include, 303 inc_src, 304 inc_mapi, 305 inc_mesa, 306 inc_gallium, 307 inc_gallium_aux, 308 inc_amd, 309 inc_amd_common, 310 inc_compiler, 311 inc_util, 312 include_directories('.'), 313 ], 314 dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil], 315 ), 316 suite : ['compiler', 'nir'], 317 protocol : 'gtest', 318 ) 319endif 320