1# Copyright 2024 Google, LLC 2# 3# Permission is hereby granted, free of charge, to any person obtaining a 4# copy of this software and associated documentation files (the "Software"), 5# to deal in the Software without restriction, including without limitation 6# the rights to use, copy, modify, merge, publish, distribute, sublicense, 7# and/or sell copies of the Software, and to permit persons to whom the 8# Software is furnished to do so, subject to the following conditions: 9# 10# The above copyright notice and this permission notice (including the next 11# paragraph) shall be included in all copies or substantial portions of the 12# Software. 13# 14# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20# IN THE SOFTWARE. 21 22import("//build/python/python_action.gni") 23import("//build/python/python_binary.gni") 24import("../../../mesa.gni") 25 26runtime = "$mesa_source_root/src/vulkan/runtime" 27 28config("config") { 29 include_dirs = [ 30 "$target_gen_dir", 31 "$runtime", 32 ] 33 34 defines = [ "VK_NO_NIR=1" ] 35} 36 37mesa_source_set("runtime") { 38 public_configs = [ ":config" ] 39 40 public_deps = [ 41 "$mesa_build_root/include:c_compat", 42 "$mesa_build_root/include:vulkan", 43 ] 44 45 deps = [ 46 ":vk_cmd_enqueue_entrypoints", 47 ":vk_cmd_queue", 48 ":vk_common_entrypoints", 49 ":vk_dispatch_trampolines", 50 ":vk_format_info", 51 ":vk_physical_device_features", 52 ":vk_physical_device_properties", 53 "$mesa_build_root/src/util", 54 "$mesa_build_root/src/vulkan/util", 55 ] 56 57 sources = [ 58 "$runtime/rmv/vk_rmv_common.c", 59 "$runtime/rmv/vk_rmv_common.h", 60 "$runtime/vk_buffer.c", 61 "$runtime/vk_buffer.h", 62 "$runtime/vk_buffer_view.c", 63 "$runtime/vk_buffer_view.h", 64 "$runtime/vk_cmd_copy.c", 65 "$runtime/vk_cmd_enqueue.c", 66 "$runtime/vk_command_buffer.c", 67 "$runtime/vk_command_buffer.h", 68 "$runtime/vk_command_pool.c", 69 "$runtime/vk_command_pool.h", 70 "$runtime/vk_debug_report.c", 71 "$runtime/vk_debug_report.h", 72 "$runtime/vk_debug_utils.c", 73 "$runtime/vk_debug_utils.h", 74 "$runtime/vk_deferred_operation.c", 75 "$runtime/vk_deferred_operation.h", 76 "$runtime/vk_descriptor_set_layout.c", 77 "$runtime/vk_descriptor_set_layout.h", 78 "$runtime/vk_descriptor_update_template.c", 79 "$runtime/vk_descriptor_update_template.h", 80 "$runtime/vk_descriptors.c", 81 "$runtime/vk_descriptors.h", 82 "$runtime/vk_device.c", 83 "$runtime/vk_device.h", 84 "$runtime/vk_device_memory.c", 85 "$runtime/vk_device_memory.h", 86 "$runtime/vk_fence.c", 87 "$runtime/vk_fence.h", 88 "$runtime/vk_framebuffer.c", 89 "$runtime/vk_framebuffer.h", 90 "$runtime/vk_graphics_state.c", 91 "$runtime/vk_graphics_state.h", 92 "$runtime/vk_image.c", 93 "$runtime/vk_image.h", 94 "$runtime/vk_instance.c", 95 "$runtime/vk_instance.h", 96 "$runtime/vk_log.c", 97 "$runtime/vk_log.h", 98 "$runtime/vk_object.c", 99 "$runtime/vk_object.h", 100 "$runtime/vk_physical_device.c", 101 "$runtime/vk_physical_device.h", 102 "$runtime/vk_query_pool.c", 103 "$runtime/vk_query_pool.h", 104 "$runtime/vk_queue.c", 105 "$runtime/vk_queue.h", 106 "$runtime/vk_render_pass.c", 107 "$runtime/vk_sampler.c", 108 "$runtime/vk_sampler.h", 109 "$runtime/vk_semaphore.c", 110 "$runtime/vk_semaphore.h", 111 "$runtime/vk_standard_sample_locations.c", 112 "$runtime/vk_standard_sample_locations.h", 113 "$runtime/vk_sync.c", 114 "$runtime/vk_sync.h", 115 "$runtime/vk_sync_binary.c", 116 "$runtime/vk_sync_binary.h", 117 "$runtime/vk_sync_dummy.c", 118 "$runtime/vk_sync_dummy.h", 119 "$runtime/vk_sync_timeline.c", 120 "$runtime/vk_sync_timeline.h", 121 "$runtime/vk_synchronization2.c", 122 "$target_gen_dir/vk_cmd_enqueue_entrypoints.c", 123 "$target_gen_dir/vk_cmd_enqueue_entrypoints.h", 124 "$target_gen_dir/vk_cmd_queue.c", 125 "$target_gen_dir/vk_cmd_queue.h", 126 "$target_gen_dir/vk_common_entrypoints.c", 127 "$target_gen_dir/vk_common_entrypoints.h", 128 "$target_gen_dir/vk_dispatch_trampolines.c", 129 "$target_gen_dir/vk_dispatch_trampolines.h", 130 "$target_gen_dir/vk_physical_device_features.c", 131 ] 132 133 configs = [ "//build/config:Wno-strict-prototypes" ] 134} 135 136python_binary("vk_cmd_queue_gen_bin") { 137 main_source = "$mesa_source_root/src/vulkan/util/vk_cmd_queue_gen.py" 138 139 sources = [ 140 "$mesa_source_root/src/vulkan/util/vk_entrypoints.py", 141 "$mesa_source_root/src/vulkan/util/vk_extensions.py", 142 ] 143 144 deps = [ "//third_party/mako" ] 145} 146 147python_action("vk_cmd_queue") { 148 binary_label = ":vk_cmd_queue_gen_bin" 149 150 h_file = "$target_gen_dir/vk_cmd_queue.h" 151 c_file = "$target_gen_dir/vk_cmd_queue.c" 152 153 outputs = [ 154 h_file, 155 c_file, 156 ] 157 158 inputs = [ 159 "$mesa_source_root/src/vulkan/util/vk_dispatch_table_gen.py", 160 "$mesa_source_root/src/vulkan/util/vk_extensions.py", 161 "$mesa_source_root/src/vulkan/util/vk_entrypoints.py", 162 mesa_vk_xml, 163 ] 164 165 args = [ 166 "--xml", 167 rebase_path(mesa_vk_xml), 168 "--out-h", 169 rebase_path(h_file, root_build_dir), 170 "--out-c", 171 rebase_path(c_file, root_build_dir), 172 "--beta", 173 "false", 174 ] 175} 176 177python_binary("vk_entrypoints_gen_bin") { 178 main_source = "$mesa_source_root/src/vulkan/util/vk_entrypoints_gen.py" 179 180 sources = [ 181 "$mesa_source_root/src/vulkan/util/vk_entrypoints.py", 182 "$mesa_source_root/src/vulkan/util/vk_extensions.py", 183 ] 184 185 deps = [ "//third_party/mako" ] 186} 187 188python_action("vk_common_entrypoints") { 189 binary_label = ":vk_entrypoints_gen_bin" 190 191 h_file = "$target_gen_dir/vk_common_entrypoints.h" 192 c_file = "$target_gen_dir/vk_common_entrypoints.c" 193 194 outputs = [ 195 h_file, 196 c_file, 197 ] 198 199 inputs = [ 200 "$mesa_source_root/src/vulkan/util/vk_dispatch_table_gen.py", 201 "$mesa_source_root/src/vulkan/util/vk_extensions.py", 202 "$mesa_source_root/src/vulkan/util/vk_entrypoints.py", 203 mesa_vk_xml, 204 ] 205 206 args = [ 207 "--xml", 208 rebase_path(mesa_vk_xml), 209 "--proto", 210 "--weak", 211 "--out-h", 212 rebase_path(h_file, root_build_dir), 213 "--out-c", 214 rebase_path(c_file, root_build_dir), 215 "--prefix", 216 "vk_common", 217 "--beta", 218 "false", 219 ] 220} 221 222python_action("vk_cmd_enqueue_entrypoints") { 223 binary_label = ":vk_entrypoints_gen_bin" 224 225 h_file = "$target_gen_dir/vk_cmd_enqueue_entrypoints.h" 226 c_file = "$target_gen_dir/vk_cmd_enqueue_entrypoints.c" 227 228 outputs = [ 229 h_file, 230 c_file, 231 ] 232 233 inputs = [ 234 "$mesa_source_root/src/vulkan/util/vk_dispatch_table_gen.py", 235 "$mesa_source_root/src/vulkan/util/vk_extensions.py", 236 "$mesa_source_root/src/vulkan/util/vk_entrypoints.py", 237 mesa_vk_xml, 238 ] 239 240 args = [ 241 "--xml", 242 rebase_path(mesa_vk_xml), 243 "--proto", 244 "--weak", 245 "--out-h", 246 rebase_path(h_file, root_build_dir), 247 "--out-c", 248 rebase_path(c_file, root_build_dir), 249 "--prefix", 250 "vk_cmd_enqueue", 251 "--prefix", 252 "vk_cmd_enqueue_unless_primary", 253 "--beta", 254 "false", 255 ] 256} 257 258python_binary("vk_dispatch_trampolines_gen_bin") { 259 main_source = 260 "$mesa_source_root/src/vulkan/util/vk_dispatch_trampolines_gen.py" 261 262 sources = [ 263 "$mesa_source_root/src/vulkan/util/vk_entrypoints.py", 264 "$mesa_source_root/src/vulkan/util/vk_extensions.py", 265 ] 266 267 deps = [ "//third_party/mako" ] 268} 269 270python_action("vk_dispatch_trampolines") { 271 binary_label = ":vk_dispatch_trampolines_gen_bin" 272 273 h_file = "$target_gen_dir/vk_dispatch_trampolines.h" 274 c_file = "$target_gen_dir/vk_dispatch_trampolines.c" 275 276 outputs = [ 277 h_file, 278 c_file, 279 ] 280 281 inputs = [ 282 "$mesa_source_root/src/vulkan/util/vk_dispatch_table_gen.py", 283 "$mesa_source_root/src/vulkan/util/vk_extensions.py", 284 "$mesa_source_root/src/vulkan/util/vk_entrypoints.py", 285 mesa_vk_xml, 286 ] 287 288 args = [ 289 "--xml", 290 rebase_path(mesa_vk_xml), 291 "--out-h", 292 rebase_path(h_file, root_build_dir), 293 "--out-c", 294 rebase_path(c_file, root_build_dir), 295 "--beta", 296 "false", 297 ] 298} 299 300python_binary("vk_physical_device_features_gen_bin") { 301 main_source = 302 "$mesa_source_root/src/vulkan/util/vk_physical_device_features_gen.py" 303 304 sources = [ "$mesa_source_root/src/vulkan/util/vk_extensions.py" ] 305 306 deps = [ "//third_party/mako" ] 307} 308 309python_action("vk_physical_device_features") { 310 binary_label = ":vk_physical_device_features_gen_bin" 311 312 c_file = "$target_gen_dir/vk_physical_device_features.c" 313 h_file = "$target_gen_dir/vk_physical_device_features.h" 314 315 outputs = [ 316 c_file, 317 h_file, 318 ] 319 320 inputs = [ mesa_vk_xml ] 321 322 args = [ 323 "--xml", 324 rebase_path(mesa_vk_xml), 325 "--out-h", 326 rebase_path(h_file, root_build_dir), 327 "--out-c", 328 rebase_path(c_file, root_build_dir), 329 "--beta", 330 "false", 331 ] 332} 333 334python_binary("vk_physical_device_properties_gen_bin") { 335 main_source = 336 "$mesa_source_root/src/vulkan/util/vk_physical_device_properties_gen.py" 337 338 sources = [ "$mesa_source_root/src/vulkan/util/vk_extensions.py" ] 339 340 deps = [ "//third_party/mako" ] 341} 342 343python_action("vk_physical_device_properties") { 344 binary_label = ":vk_physical_device_properties_gen_bin" 345 346 c_file = "$target_gen_dir/vk_physical_device_properties.c" 347 h_file = "$target_gen_dir/vk_physical_device_properties.h" 348 349 outputs = [ 350 c_file, 351 h_file, 352 ] 353 354 inputs = [ mesa_vk_xml ] 355 356 args = [ 357 "--xml", 358 rebase_path(mesa_vk_xml), 359 "--out-h", 360 rebase_path(h_file, root_build_dir), 361 "--out-c", 362 rebase_path(c_file, root_build_dir), 363 "--beta", 364 "false", 365 ] 366} 367 368python_binary("vk_format_info_gen_bin") { 369 main_source = "$mesa_source_root/src/vulkan/runtime/vk_format_info_gen.py" 370 371 sources = [ "$mesa_source_root/src/vulkan/util/vk_extensions.py" ] 372 373 deps = [ "//third_party/mako" ] 374} 375 376python_action("vk_format_info") { 377 binary_label = ":vk_format_info_gen_bin" 378 379 c_file = "$target_gen_dir/vk_format_info.c" 380 h_file = "$target_gen_dir/vk_format_info.h" 381 382 outputs = [ 383 c_file, 384 h_file, 385 ] 386 387 inputs = [ mesa_vk_xml ] 388 389 args = [ 390 "--xml", 391 rebase_path(mesa_vk_xml), 392 "--out-h", 393 rebase_path(h_file, root_build_dir), 394 "--out-c", 395 rebase_path(c_file, root_build_dir), 396 ] 397} 398