blob: e3af2d8a7a93814d0d998105ec9f1eb4139ac72c [file] [log] [blame]
# Copyright 2022 Google, LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice (including the next
# paragraph) shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
import("../../../mesa.gni")
config("common") {
include_dirs = [
"$target_gen_dir",
# Needed because generated vk_dispatch_trampolines.h includes 'vulkan/util/vk_dispatch_table.h'
"$target_gen_dir/../..",
".",
"$mesa_build_root/src/vulkan",
"$mesa_build_root/src/vulkan/util",
"$mesa_build_root/include",
]
}
config("magma_config") {
configs = [ ":common" ]
defines = [ "USE_MAGMA=1" ]
}
runtime_headers = [
"vk_buffer.h",
"vk_command_buffer.h",
"vk_command_pool.h",
"vk_debug_report.h",
"vk_debug_utils.h",
"vk_deferred_operation.h",
"vk_descriptor_set_layout.h",
"vk_descriptor_update_template.h",
"vk_descriptors.h",
"vk_device.h",
"vk_fence.h",
"vk_framebuffer.h",
"vk_graphics_state.h",
"vk_image.h",
"vk_instance.h",
"vk_log.h",
"vk_nir.h",
"vk_object.h",
"vk_physical_device.h",
"vk_pipeline.h",
"vk_pipeline_cache.h",
"vk_pipeline_layout.h",
"vk_queue.h",
"vk_sampler.h",
"vk_semaphore.h",
"vk_shader_module.h",
"vk_standard_sample_locations.h",
"vk_sync.h",
"vk_sync_binary.h",
"vk_sync_dummy.h",
"vk_sync_timeline.h",
]
runtime_sources = [
"vk_buffer.c",
"vk_cmd_copy.c",
"vk_cmd_enqueue.c",
"vk_command_buffer.c",
"vk_command_pool.c",
"vk_debug_report.c",
"vk_debug_utils.c",
"vk_deferred_operation.c",
"vk_descriptor_set_layout.c",
"vk_descriptor_update_template.c",
"vk_descriptors.c",
"vk_device.c",
"vk_fence.c",
"vk_framebuffer.c",
"vk_graphics_state.c",
"vk_image.c",
"vk_instance.c",
"vk_log.c",
"vk_nir.c",
"vk_object.c",
"vk_object.h",
"vk_physical_device.c",
"vk_pipeline.c",
"vk_pipeline_cache.c",
"vk_pipeline_layout.c",
"vk_queue.c",
"vk_render_pass.c",
"vk_sampler.c",
"vk_semaphore.c",
"vk_shader_module.c",
"vk_standard_sample_locations.c",
"vk_sync.c",
"vk_sync_binary.c",
"vk_sync_dummy.c",
"vk_sync_timeline.c",
"vk_synchronization2.c",
]
runtime_public_deps = [
"$mesa_build_root/include:c_compat",
"$mesa_build_root/include:vulkan",
]
mesa_source_set("generated") {
public_deps = [
":vk_cmd_enqueue_entrypoints",
":vk_cmd_queue",
":vk_common_entrypoints",
":vk_dispatch_trampolines",
":vk_physical_device_features",
"$mesa_build_root/src/compiler/nir",
"$mesa_build_root/src/util",
"$mesa_build_root/src/vulkan/util",
]
}
mesa_source_set("runtime") {
public_configs = [ ":magma_config" ]
deps = [ ":generated" ]
public_deps = runtime_public_deps + [ "//sdk/lib/magma_client:magma_headers" ]
sources = [
"$target_gen_dir/vk_cmd_enqueue_entrypoints.c",
"$target_gen_dir/vk_cmd_queue.c",
"$target_gen_dir/vk_common_entrypoints.c",
"$target_gen_dir/vk_dispatch_trampolines.c",
"$target_gen_dir/vk_physical_device_features.c",
"vk_magma_syncobj.c",
"vk_magma_syncobj.h"
] + runtime_sources + runtime_headers
configs = [ "//build/config:Wno-strict-prototypes" ]
}
mesa_source_set("zircon") {
public_configs = [ ":common" ]
deps = [ ":generated" ]
public_deps = runtime_public_deps
sources = [
"$target_gen_dir/vk_cmd_enqueue_entrypoints.c",
"$target_gen_dir/vk_cmd_queue.c",
"$target_gen_dir/vk_common_entrypoints.c",
"$target_gen_dir/vk_dispatch_trampolines.c",
"$target_gen_dir/vk_physical_device_features.c",
] + runtime_sources + runtime_headers
configs = [ "//build/config:Wno-strict-prototypes" ]
}
mesa_python_action("vk_cmd_queue") {
outputs = [
"$target_gen_dir/vk_cmd_queue.h",
"$target_gen_dir/vk_cmd_queue.c",
]
script = "$mesa_build_root/src/vulkan/util/vk_cmd_queue_gen.py"
inputs = [
"$mesa_build_root/src/vulkan/util/vk_dispatch_table_gen.py",
"$mesa_build_root/src/vulkan/util/vk_extensions.py",
"$mesa_build_root/src/vulkan/util/vk_entrypoints.py",
"$mesa_build_root/src/vulkan/registry/vk.xml",
]
args = [
"--xml",
rebase_path("$mesa_build_root", root_build_dir) +
"/src/vulkan/registry/vk.xml",
"--out-h",
rebase_path("$target_gen_dir/vk_cmd_queue.h", root_build_dir),
"--out-c",
rebase_path("$target_gen_dir/vk_cmd_queue.c", root_build_dir),
]
}
mesa_python_action("vk_common_entrypoints") {
h_file = "$target_gen_dir/vk_common_entrypoints.h"
c_file = "$target_gen_dir/vk_common_entrypoints.c"
outputs = [
h_file,
c_file,
]
script = "$mesa_build_root/src/vulkan/util/vk_entrypoints_gen.py"
inputs = [
"$mesa_build_root/src/vulkan/util/vk_dispatch_table_gen.py",
"$mesa_build_root/src/vulkan/util/vk_extensions.py",
"$mesa_build_root/src/vulkan/util/vk_entrypoints.py",
"$mesa_build_root/src/vulkan/registry/vk.xml",
]
args = [
"--xml",
rebase_path("$mesa_build_root", root_build_dir) +
"/src/vulkan/registry/vk.xml",
"--proto",
"--weak",
"--out-h",
rebase_path(h_file, root_build_dir),
"--out-c",
rebase_path(c_file, root_build_dir),
"--prefix",
"vk_common",
]
}
mesa_python_action("vk_cmd_enqueue_entrypoints") {
h_file = "$target_gen_dir/vk_cmd_enqueue_entrypoints.h"
c_file = "$target_gen_dir/vk_cmd_enqueue_entrypoints.c"
outputs = [
h_file,
c_file,
]
script = "$mesa_build_root/src/vulkan/util/vk_entrypoints_gen.py"
inputs = [
"$mesa_build_root/src/vulkan/util/vk_dispatch_table_gen.py",
"$mesa_build_root/src/vulkan/util/vk_extensions.py",
"$mesa_build_root/src/vulkan/util/vk_entrypoints.py",
"$mesa_build_root/src/vulkan/registry/vk.xml",
]
args = [
"--xml",
rebase_path("$mesa_build_root", root_build_dir) +
"/src/vulkan/registry/vk.xml",
"--proto",
"--weak",
"--out-h",
rebase_path(h_file, root_build_dir),
"--out-c",
rebase_path(c_file, root_build_dir),
"--prefix",
"vk_cmd_enqueue",
"--prefix",
"vk_cmd_enqueue_unless_primary",
]
}
mesa_python_action("vk_dispatch_trampolines") {
h_file = "$target_gen_dir/vk_dispatch_trampolines.h"
c_file = "$target_gen_dir/vk_dispatch_trampolines.c"
outputs = [
h_file,
c_file,
]
script = "$mesa_build_root/src/vulkan/util/vk_dispatch_trampolines_gen.py"
inputs = [
"$mesa_build_root/src/vulkan/util/vk_dispatch_table_gen.py",
"$mesa_build_root/src/vulkan/util/vk_extensions.py",
"$mesa_build_root/src/vulkan/util/vk_entrypoints.py",
"$mesa_build_root/src/vulkan/registry/vk.xml",
]
args = [
"--xml",
rebase_path("$mesa_build_root", root_build_dir) +
"/src/vulkan/registry/vk.xml",
"--out-h",
rebase_path(h_file, root_build_dir),
"--out-c",
rebase_path(c_file, root_build_dir),
]
}
mesa_python_action("vk_physical_device_features") {
c_file = "$target_gen_dir/vk_physical_device_features.c"
outputs = [ c_file ]
script = "$mesa_build_root/src/vulkan/runtime/vk_physical_device_features.py"
inputs = [ "$mesa_build_root/src/vulkan/registry/vk.xml" ]
args = [
"--xml",
rebase_path("$mesa_build_root", root_build_dir) +
"/src/vulkan/registry/vk.xml",
"--out-c",
rebase_path(c_file, root_build_dir),
]
}