aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Rakos <daniel.rakos@rastergrid.com>2023-05-22 15:46:07 +0200
committerJuan Ramos <114601453+juan-lunarg@users.noreply.github.com>2023-05-24 11:05:08 -0600
commit9aafa3cf1a72170cedab37073dcc184a6428469b (patch)
treeda4669e052a1429adf4d4f4d5d8ac202f3d41d7a
parent4b7e5871e224c1d4141f727a6706de23e8812edf (diff)
downloadusermoji-9aafa3cf1a72170cedab37073dcc184a6428469b.tar.xz
mock: Parameterization changes for Vulkan SC
-rw-r--r--CMakeLists.txt5
-rw-r--r--icd/CMakeLists.txt8
-rw-r--r--icd/generated/mock_icd.h6
-rwxr-xr-xscripts/generate_source.py14
-rw-r--r--scripts/known_good.json2
-rw-r--r--scripts/kvt_genvk.py34
-rw-r--r--scripts/mock_icd_generator.py15
-rwxr-xr-xscripts/update_deps.py21
8 files changed, 76 insertions, 29 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5aa71694..561b8805 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,7 @@
# ~~~
# Copyright (c) 2014-2023 Valve Corporation
# Copyright (c) 2014-2023 LunarG, Inc.
+# Copyright (c) 2023-2023 RasterGrid Kft.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -36,6 +37,8 @@ option(BUILD_ICD "Build icd" ON)
# Require the user to ask that it be installed if they really want it.
option(INSTALL_ICD "Install icd" OFF)
+set(API_TYPE "vulkan")
+
if (UNIX AND NOT APPLE) # i.e. Linux
option(ENABLE_ADDRESS_SANITIZER "Use addres sanitization" OFF)
endif()
@@ -149,7 +152,7 @@ option(TOOLS_CODEGEN "Enable helper codegen target")
if (TOOLS_CODEGEN)
find_package(Python3 REQUIRED QUIET)
add_custom_target(tools_codegen
- COMMAND Python3::Interpreter ${PROJECT_SOURCE_DIR}/scripts/generate_source.py ${VULKAN_HEADERS_REGISTRY_DIRECTORY} --incremental
+ COMMAND Python3::Interpreter ${PROJECT_SOURCE_DIR}/scripts/generate_source.py ${VULKAN_HEADERS_REGISTRY_DIRECTORY} --incremental --api ${API_TYPE}
)
endif()
diff --git a/icd/CMakeLists.txt b/icd/CMakeLists.txt
index 365b43e3..0e98928f 100644
--- a/icd/CMakeLists.txt
+++ b/icd/CMakeLists.txt
@@ -1,6 +1,7 @@
# ~~~
# Copyright (c) 2014-2018 Valve Corporation
# Copyright (c) 2014-2018 LunarG, Inc.
+# Copyright (c) 2023-2023 RasterGrid Kft.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,6 +16,9 @@
# limitations under the License.
# ~~~
+set(MOCK_ICD_NAME mock_icd)
+set(GENERATED generated)
+
if(WIN32)
add_definitions(-DVK_USE_PLATFORM_WIN32_KHR -DVK_USE_PLATFORM_WIN32_KHX -DWIN32_LEAN_AND_MEAN)
elseif(ANDROID)
@@ -38,7 +42,7 @@ else()
endif()
# Copy or link the JSON files to the binary directory for ease of use in the build tree.
-set(ICD_JSON_FILES VkICD_mock_icd)
+set(ICD_JSON_FILES VkICD_${MOCK_ICD_NAME})
if(WIN32)
# extra setup for out-of-tree builds
if(NOT (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR))
@@ -158,7 +162,7 @@ else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpointer-arith -Wno-unused-function -Wno-sign-compare")
endif()
-add_vk_icd(mock_icd generated/mock_icd.cpp generated/mock_icd.h)
+add_vk_icd(${MOCK_ICD_NAME} ${GENERATED}/mock_icd.cpp ${GENERATED}/mock_icd.h)
# JSON file(s) install targets. For Linux, need to remove the "./" from the library path before installing to system directories.
if((UNIX AND NOT APPLE) AND INSTALL_ICD) # i.e. Linux
diff --git a/icd/generated/mock_icd.h b/icd/generated/mock_icd.h
index 19b242da..8cd604d7 100644
--- a/icd/generated/mock_icd.h
+++ b/icd/generated/mock_icd.h
@@ -87,7 +87,6 @@ static const std::unordered_map<std::string, uint32_t> instance_extension_map =
{"VK_QNX_screen_surface", 1},
{"VK_KHR_portability_enumeration", 1},
{"VK_GOOGLE_surfaceless_query", 2},
- {"VK_EXT_application_parameters", 1},
{"VK_LUNARG_direct_driver_loading", 1},
};
// Map of device extension name to version
@@ -121,7 +120,6 @@ static const std::unordered_map<std::string, uint32_t> device_extension_map = {
{"VK_KHR_dynamic_rendering", 1},
{"VK_AMD_shader_image_load_store_lod", 1},
{"VK_NV_corner_sampled_image", 2},
- {"VK_NV_private_vendor_info", 2},
{"VK_KHR_multiview", 1},
{"VK_IMG_format_pvrtc", 1},
{"VK_NV_external_memory", 1},
@@ -294,7 +292,6 @@ static const std::unordered_map<std::string, uint32_t> device_extension_map = {
{"VK_KHR_video_encode_queue", 8},
{"VK_NV_device_diagnostics_config", 2},
{"VK_QCOM_render_pass_store_ops", 2},
- {"VK_KHR_object_refresh", 1},
{"VK_NV_low_latency", 1},
{"VK_EXT_metal_objects", 1},
{"VK_KHR_synchronization2", 1},
@@ -334,8 +331,6 @@ static const std::unordered_map<std::string, uint32_t> device_extension_map = {
{"VK_HUAWEI_invocation_mask", 1},
{"VK_NV_external_memory_rdma", 1},
{"VK_EXT_pipeline_properties", 1},
- {"VK_NV_external_sci_sync", 2},
- {"VK_NV_external_memory_sci_buf", 2},
{"VK_EXT_multisampled_render_to_single_sampled", 1},
{"VK_EXT_extended_dynamic_state2", 1},
{"VK_EXT_color_write_enable", 1},
@@ -376,7 +371,6 @@ static const std::unordered_map<std::string, uint32_t> device_extension_map = {
{"VK_QCOM_tile_properties", 1},
{"VK_SEC_amigo_profiling", 1},
{"VK_QCOM_multiview_per_view_viewports", 1},
- {"VK_NV_external_sci_sync2", 1},
{"VK_NV_ray_tracing_invocation_reorder", 1},
{"VK_EXT_mutable_descriptor_type", 1},
{"VK_ARM_shader_core_builtins", 2},
diff --git a/scripts/generate_source.py b/scripts/generate_source.py
index a2002aae..5fb7941e 100755
--- a/scripts/generate_source.py
+++ b/scripts/generate_source.py
@@ -1,8 +1,9 @@
#!/usr/bin/env python3
-# Copyright (c) 2019 The Khronos Group Inc.
-# Copyright (c) 2019 Valve Corporation
-# Copyright (c) 2019 LunarG, Inc.
-# Copyright (c) 2019 Google Inc.
+# Copyright (c) 2019-2023 The Khronos Group Inc.
+# Copyright (c) 2019-2023 Valve Corporation
+# Copyright (c) 2019-2023 LunarG, Inc.
+# Copyright (c) 2019-2023 Google Inc.
+# Copyright (c) 2023-2023 RasterGrid Kft.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -33,6 +34,10 @@ verify_exclude = ['.clang-format']
def main(argv):
parser = argparse.ArgumentParser(description='Generate source code for this repository')
+ parser.add_argument('--api',
+ default='vulkan',
+ choices=['vulkan', 'vulkansc'],
+ help='Specify API name to generate')
parser.add_argument('registry', metavar='REGISTRY_PATH', help='path to the Vulkan-Headers registry directory')
group = parser.add_mutually_exclusive_group()
group.add_argument('-i', '--incremental', action='store_true', help='only update repo files that change')
@@ -65,6 +70,7 @@ def main(argv):
output_path = common_codegen.repo_relative(path)
cmd = [common_codegen.repo_relative(os.path.join('scripts','kvt_genvk.py')),
+ '-api', args.api,
'-registry', os.path.abspath(os.path.join(args.registry, 'vk.xml')),
'-quiet', '-directory', output_path, filename]
print(' '.join(cmd))
diff --git a/scripts/known_good.json b/scripts/known_good.json
index da780055..16abe2f5 100644
--- a/scripts/known_good.json
+++ b/scripts/known_good.json
@@ -2,6 +2,7 @@
"repos" : [
{
"name" : "Vulkan-Headers",
+ "api": "vulkan",
"url" : "https://github.com/KhronosGroup/Vulkan-Headers.git",
"sub_dir" : "Vulkan-Headers",
"build_dir" : "Vulkan-Headers/build",
@@ -26,6 +27,7 @@
},
{
"name" : "Vulkan-Loader",
+ "api": "vulkan",
"url" : "https://github.com/KhronosGroup/Vulkan-Loader.git",
"sub_dir" : "Vulkan-Loader",
"build_dir" : "Vulkan-Loader/build",
diff --git a/scripts/kvt_genvk.py b/scripts/kvt_genvk.py
index fe141165..332ca76b 100644
--- a/scripts/kvt_genvk.py
+++ b/scripts/kvt_genvk.py
@@ -1,6 +1,7 @@
#!/usr/bin/python3
#
-# Copyright (c) 2013-2019 The Khronos Group Inc.
+# Copyright (c) 2013-2023 The Khronos Group Inc.
+# Copyright (c) 2023-2023 RasterGrid Kft.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -59,8 +60,14 @@ def makeGenOpts(args):
global genOpts
genOpts = {}
+ # API to generate sources for
+ apiname = args.api
+
# Default class of extensions to include, or None
- defaultExtensions = args.defaultExtensions
+ if args.defaultExtensions is not None:
+ defaultExtensions = args.defaultExtensions
+ else:
+ defaultExtensions = apiname
# Additional extensions to include (list of extensions)
extensions = args.extension
@@ -137,11 +144,11 @@ def makeGenOpts(args):
filename='vk_typemap_helper.h',
directory=directory,
genpath=None,
- apiname='vulkan',
+ apiname=apiname,
profile=None,
versions=featuresPat,
emitversions=featuresPat,
- defaultExtensions='vulkan',
+ defaultExtensions=defaultExtensions,
addExtensions=addExtensionsPat,
removeExtensions=removeExtensionsPat,
emitExtensions=emitExtensionsPat,
@@ -163,11 +170,11 @@ def makeGenOpts(args):
filename='mock_icd.h',
directory=directory,
genpath=None,
- apiname='vulkan',
+ apiname=apiname,
profile=None,
versions=featuresPat,
emitversions=featuresPat,
- defaultExtensions='vulkan',
+ defaultExtensions=defaultExtensions,
addExtensions=addExtensionsPat,
removeExtensions=removeExtensionsPat,
emitExtensions=emitExtensionsPat,
@@ -189,11 +196,11 @@ def makeGenOpts(args):
filename='mock_icd.cpp',
directory=directory,
genpath=None,
- apiname='vulkan',
+ apiname=apiname,
profile=None,
versions=featuresPat,
emitversions=featuresPat,
- defaultExtensions='vulkan',
+ defaultExtensions=defaultExtensions,
addExtensions=addExtensionsPat,
removeExtensions=removeExtensionsPat,
emitExtensions=emitExtensionsPat,
@@ -215,11 +222,11 @@ def makeGenOpts(args):
filename='vulkaninfo.hpp',
directory=directory,
genpath=None,
- apiname='vulkan',
+ apiname=apiname,
profile=None,
versions=featuresPat,
emitversions=featuresPat,
- defaultExtensions='vulkan',
+ defaultExtensions=defaultExtensions,
addExtensions=addExtensionsPat,
removeExtensions=removeExtensionsPat,
emitExtensions=emitExtensionsPat,
@@ -254,6 +261,7 @@ def genTarget(args):
if not args.quiet:
write('* Building', options.filename, file=sys.stderr)
+ write('* options.apiname =', options.apiname, file=sys.stderr)
write('* options.versions =', options.versions, file=sys.stderr)
write('* options.emitversions =', options.emitversions, file=sys.stderr)
write('* options.defaultExtensions =', options.defaultExtensions, file=sys.stderr)
@@ -279,8 +287,12 @@ def genTarget(args):
if __name__ == '__main__':
parser = argparse.ArgumentParser()
- parser.add_argument('-defaultExtensions', action='store',
+ parser.add_argument('-api', action='store',
default='vulkan',
+ choices=['vulkan', 'vulkansc'],
+ help='Specify API name to generate')
+ parser.add_argument('-defaultExtensions', action='store',
+ default=None,
help='Specify a single class of extensions to add to targets')
parser.add_argument('-directory', action='store', default='.',
help='Specify where the built file is place')
diff --git a/scripts/mock_icd_generator.py b/scripts/mock_icd_generator.py
index 0d81561d..c67d17b5 100644
--- a/scripts/mock_icd_generator.py
+++ b/scripts/mock_icd_generator.py
@@ -1,9 +1,10 @@
#!/usr/bin/python3 -i
#
-# Copyright (c) 2015-2022 The Khronos Group Inc.
-# Copyright (c) 2015-2022 Valve Corporation
-# Copyright (c) 2015-2022 LunarG, Inc.
-# Copyright (c) 2015-2022 Google Inc.
+# Copyright (c) 2015-2023 The Khronos Group Inc.
+# Copyright (c) 2015-2023 Valve Corporation
+# Copyright (c) 2015-2023 LunarG, Inc.
+# Copyright (c) 2015-2023 Google Inc.
+# Copyright (c) 2023-2023 RasterGrid Kft.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -1523,6 +1524,10 @@ class MockICDOutputGenerator(OutputGenerator):
else:
return False
+ # Check that the target API is in the supported list for the extension
+ def checkExtensionAPISupport(self, supported):
+ return self.genOpts.apiname in supported.split(',')
+
def beginFile(self, genOpts):
OutputGenerator.beginFile(self, genOpts)
# C-specific
@@ -1564,7 +1569,7 @@ class MockICDOutputGenerator(OutputGenerator):
# Ignore extensions that ICDs should not implement or are not safe to report
ignore_exts = ['VK_EXT_validation_cache', 'VK_KHR_portability_subset']
for ext in self.registry.tree.findall("extensions/extension"):
- if ext.attrib['supported'] != 'disabled': # Only include enabled extensions
+ if self.checkExtensionAPISupport(ext.attrib['supported']): # Only include API-relevant extensions
if (ext.attrib['name'] not in ignore_exts):
# Search for extension version enum
for enum in ext.findall('require/enum'):
diff --git a/scripts/update_deps.py b/scripts/update_deps.py
index 7664a55f..d53760a0 100755
--- a/scripts/update_deps.py
+++ b/scripts/update_deps.py
@@ -3,6 +3,7 @@
# Copyright 2017 The Glslang Authors. All rights reserved.
# Copyright (c) 2018-2023 Valve Corporation
# Copyright (c) 2018-2023 LunarG, Inc.
+# Copyright (c) 2023-2023 RasterGrid Kft.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -117,6 +118,10 @@ examples of all of these elements.
The name of the dependent repository. This field can be referenced
by the "deps.repo_name" structure to record a dependency.
+- api
+
+The name of the API the dependency is specific to (e.g. "vulkan").
+
- url
Specifies the URL of the repository.
@@ -335,6 +340,7 @@ class GoodRepo(object):
self.build_step = json['build_step'] if ('build_step' in json) else 'build'
self.build_platforms = json['build_platforms'] if ('build_platforms' in json) else []
self.optional = set(json.get('optional', []))
+ self.api = json['api'] if ('api' in json) else None
# Absolute paths for a repo's directories
dir_top = os.path.abspath(args.dir)
self.repo_dir = os.path.join(dir_top, self.sub_dir)
@@ -579,6 +585,10 @@ def CreateHelper(args, repos, filename):
install_names = GetInstallNames(args)
with open(filename, 'w') as helper_file:
for repo in repos:
+ # If the repo has an API tag and that does not match
+ # the target API then skip it
+ if repo.api is not None and repo.api != args.api:
+ continue
if install_names and repo.name in install_names and repo.on_build_platform:
helper_file.write('set({var} "{dir}" CACHE STRING "" FORCE)\n'
.format(
@@ -655,6 +665,12 @@ def main():
help="Set build files configuration",
default='debug')
parser.add_argument(
+ '--api',
+ dest='api',
+ default='vulkan',
+ choices=['vulkan', 'vulkansc'],
+ help="Target API")
+ parser.add_argument(
'--generator',
dest='generator',
help="Set the CMake generator",
@@ -685,6 +701,11 @@ def main():
print('Starting builds in {d}'.format(d=abs_top_dir))
for repo in repos:
+ # If the repo has an API tag and that does not match
+ # the target API then skip it
+ if repo.api is not None and repo.api != args.api:
+ continue
+
# If the repo has a platform whitelist, skip the repo
# unless we are building on a whitelisted platform.
if not repo.on_build_platform: