From 692b6a93f476f7393d4c6a90006045cec6321501 Mon Sep 17 00:00:00 2001 From: Mike Schuchardt Date: Fri, 20 Oct 2023 13:43:39 -0700 Subject: [PATCH] build: Update to header 1.3.269 - Update known-good - Fix hard-coded tag index for getting extension names from vk.xml - Relax regex for correlating kVulkanObjectType* with VK_DEBUG_REPORT_OBJECT_TYPE_* by making the trailing _EXT optional - Generate source --- CMakeLists.txt | 2 +- loader/generated/vk_layer_dispatch_table.h | 8 ++ loader/generated/vk_loader_extensions.c | 131 +++++++++++++++++++++ loader/generated/vk_object_types.h | 20 +++- loader/loader.rc | 4 +- scripts/helper_file_generator.py | 7 +- scripts/known_good.json | 2 +- 7 files changed, 159 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 16e65a62c..2c7d05093 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ # ~~~ cmake_minimum_required(VERSION 3.17.2) -project(VULKAN_LOADER VERSION 1.3.268) +project(VULKAN_LOADER VERSION 1.3.269) add_subdirectory(scripts) diff --git a/loader/generated/vk_layer_dispatch_table.h b/loader/generated/vk_layer_dispatch_table.h index 7c775c51b..b6db4ca7d 100644 --- a/loader/generated/vk_layer_dispatch_table.h +++ b/loader/generated/vk_layer_dispatch_table.h @@ -908,6 +908,14 @@ typedef struct VkLayerDispatchTable_ { PFN_vkSetPrivateDataEXT SetPrivateDataEXT; PFN_vkGetPrivateDataEXT GetPrivateDataEXT; + // ---- VK_NV_cuda_kernel_launch extension commands + PFN_vkCreateCudaModuleNV CreateCudaModuleNV; + PFN_vkGetCudaModuleCacheNV GetCudaModuleCacheNV; + PFN_vkCreateCudaFunctionNV CreateCudaFunctionNV; + PFN_vkDestroyCudaModuleNV DestroyCudaModuleNV; + PFN_vkDestroyCudaFunctionNV DestroyCudaFunctionNV; + PFN_vkCmdCudaLaunchKernelNV CmdCudaLaunchKernelNV; + // ---- VK_EXT_metal_objects extension commands #if defined(VK_USE_PLATFORM_METAL_EXT) PFN_vkExportMetalObjectsEXT ExportMetalObjectsEXT; diff --git a/loader/generated/vk_loader_extensions.c b/loader/generated/vk_loader_extensions.c index 948c2f176..16677bdac 100644 --- a/loader/generated/vk_loader_extensions.c +++ b/loader/generated/vk_loader_extensions.c @@ -946,6 +946,14 @@ VKAPI_ATTR void VKAPI_CALL loader_init_device_extension_dispatch_table(struct lo table->SetPrivateDataEXT = (PFN_vkSetPrivateDataEXT)gdpa(dev, "vkSetPrivateDataEXT"); table->GetPrivateDataEXT = (PFN_vkGetPrivateDataEXT)gdpa(dev, "vkGetPrivateDataEXT"); + // ---- VK_NV_cuda_kernel_launch extension commands + table->CreateCudaModuleNV = (PFN_vkCreateCudaModuleNV)gdpa(dev, "vkCreateCudaModuleNV"); + table->GetCudaModuleCacheNV = (PFN_vkGetCudaModuleCacheNV)gdpa(dev, "vkGetCudaModuleCacheNV"); + table->CreateCudaFunctionNV = (PFN_vkCreateCudaFunctionNV)gdpa(dev, "vkCreateCudaFunctionNV"); + table->DestroyCudaModuleNV = (PFN_vkDestroyCudaModuleNV)gdpa(dev, "vkDestroyCudaModuleNV"); + table->DestroyCudaFunctionNV = (PFN_vkDestroyCudaFunctionNV)gdpa(dev, "vkDestroyCudaFunctionNV"); + table->CmdCudaLaunchKernelNV = (PFN_vkCmdCudaLaunchKernelNV)gdpa(dev, "vkCmdCudaLaunchKernelNV"); + // ---- VK_EXT_metal_objects extension commands #if defined(VK_USE_PLATFORM_METAL_EXT) table->ExportMetalObjectsEXT = (PFN_vkExportMetalObjectsEXT)gdpa(dev, "vkExportMetalObjectsEXT"); @@ -2678,6 +2686,14 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_device_dispatch_table(const VkLayerDis if (!strcmp(name, "SetPrivateDataEXT")) return (void *)table->SetPrivateDataEXT; if (!strcmp(name, "GetPrivateDataEXT")) return (void *)table->GetPrivateDataEXT; + // ---- VK_NV_cuda_kernel_launch extension commands + if (!strcmp(name, "CreateCudaModuleNV")) return (void *)table->CreateCudaModuleNV; + if (!strcmp(name, "GetCudaModuleCacheNV")) return (void *)table->GetCudaModuleCacheNV; + if (!strcmp(name, "CreateCudaFunctionNV")) return (void *)table->CreateCudaFunctionNV; + if (!strcmp(name, "DestroyCudaModuleNV")) return (void *)table->DestroyCudaModuleNV; + if (!strcmp(name, "DestroyCudaFunctionNV")) return (void *)table->DestroyCudaFunctionNV; + if (!strcmp(name, "CmdCudaLaunchKernelNV")) return (void *)table->CmdCudaLaunchKernelNV; + // ---- VK_EXT_metal_objects extension commands #if defined(VK_USE_PLATFORM_METAL_EXT) if (!strcmp(name, "ExportMetalObjectsEXT")) return (void *)table->ExportMetalObjectsEXT; @@ -7283,6 +7299,95 @@ VKAPI_ATTR void VKAPI_CALL GetPrivateDataEXT( } +// ---- VK_NV_cuda_kernel_launch extension trampoline/terminators + +VKAPI_ATTR VkResult VKAPI_CALL CreateCudaModuleNV( + VkDevice device, + const VkCudaModuleCreateInfoNV* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkCudaModuleNV* pModule) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCreateCudaModuleNV: Invalid device " + "[VUID-vkCreateCudaModuleNV-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->CreateCudaModuleNV(device, pCreateInfo, pAllocator, pModule); +} + +VKAPI_ATTR VkResult VKAPI_CALL GetCudaModuleCacheNV( + VkDevice device, + VkCudaModuleNV module, + size_t* pCacheSize, + void* pCacheData) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkGetCudaModuleCacheNV: Invalid device " + "[VUID-vkGetCudaModuleCacheNV-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->GetCudaModuleCacheNV(device, module, pCacheSize, pCacheData); +} + +VKAPI_ATTR VkResult VKAPI_CALL CreateCudaFunctionNV( + VkDevice device, + const VkCudaFunctionCreateInfoNV* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkCudaFunctionNV* pFunction) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCreateCudaFunctionNV: Invalid device " + "[VUID-vkCreateCudaFunctionNV-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + return disp->CreateCudaFunctionNV(device, pCreateInfo, pAllocator, pFunction); +} + +VKAPI_ATTR void VKAPI_CALL DestroyCudaModuleNV( + VkDevice device, + VkCudaModuleNV module, + const VkAllocationCallbacks* pAllocator) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkDestroyCudaModuleNV: Invalid device " + "[VUID-vkDestroyCudaModuleNV-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->DestroyCudaModuleNV(device, module, pAllocator); +} + +VKAPI_ATTR void VKAPI_CALL DestroyCudaFunctionNV( + VkDevice device, + VkCudaFunctionNV function, + const VkAllocationCallbacks* pAllocator) { + const VkLayerDispatchTable *disp = loader_get_dispatch(device); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkDestroyCudaFunctionNV: Invalid device " + "[VUID-vkDestroyCudaFunctionNV-device-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->DestroyCudaFunctionNV(device, function, pAllocator); +} + +VKAPI_ATTR void VKAPI_CALL CmdCudaLaunchKernelNV( + VkCommandBuffer commandBuffer, + const VkCudaLaunchInfoNV* pLaunchInfo) { + const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); + if (NULL == disp) { + loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, + "vkCmdCudaLaunchKernelNV: Invalid commandBuffer " + "[VUID-vkCmdCudaLaunchKernelNV-commandBuffer-parameter]"); + abort(); /* Intentionally fail so user can correct issue. */ + } + disp->CmdCudaLaunchKernelNV(commandBuffer, pLaunchInfo); +} + + // ---- VK_EXT_metal_objects extension trampoline/terminators #if defined(VK_USE_PLATFORM_METAL_EXT) @@ -10769,6 +10874,32 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *na return true; } + // ---- VK_NV_cuda_kernel_launch extension commands + if (!strcmp("vkCreateCudaModuleNV", name)) { + *addr = (void *)CreateCudaModuleNV; + return true; + } + if (!strcmp("vkGetCudaModuleCacheNV", name)) { + *addr = (void *)GetCudaModuleCacheNV; + return true; + } + if (!strcmp("vkCreateCudaFunctionNV", name)) { + *addr = (void *)CreateCudaFunctionNV; + return true; + } + if (!strcmp("vkDestroyCudaModuleNV", name)) { + *addr = (void *)DestroyCudaModuleNV; + return true; + } + if (!strcmp("vkDestroyCudaFunctionNV", name)) { + *addr = (void *)DestroyCudaFunctionNV; + return true; + } + if (!strcmp("vkCmdCudaLaunchKernelNV", name)) { + *addr = (void *)CmdCudaLaunchKernelNV; + return true; + } + // ---- VK_EXT_metal_objects extension commands #if defined(VK_USE_PLATFORM_METAL_EXT) if (!strcmp("vkExportMetalObjectsEXT", name)) { diff --git a/loader/generated/vk_object_types.h b/loader/generated/vk_object_types.h index 86a48a9be..a120ea0a7 100644 --- a/loader/generated/vk_object_types.h +++ b/loader/generated/vk_object_types.h @@ -80,12 +80,14 @@ typedef enum VulkanObjectType { kVulkanObjectTypeAccelerationStructureNV = 41, kVulkanObjectTypePerformanceConfigurationINTEL = 42, kVulkanObjectTypeIndirectCommandsLayoutNV = 43, - kVulkanObjectTypeAccelerationStructureKHR = 44, - kVulkanObjectTypeBufferCollectionFUCHSIA = 45, - kVulkanObjectTypeMicromapEXT = 46, - kVulkanObjectTypeOpticalFlowSessionNV = 47, - kVulkanObjectTypeShaderEXT = 48, - kVulkanObjectTypeMax = 49, + kVulkanObjectTypeCudaModuleNV = 44, + kVulkanObjectTypeCudaFunctionNV = 45, + kVulkanObjectTypeAccelerationStructureKHR = 46, + kVulkanObjectTypeBufferCollectionFUCHSIA = 47, + kVulkanObjectTypeMicromapEXT = 48, + kVulkanObjectTypeOpticalFlowSessionNV = 49, + kVulkanObjectTypeShaderEXT = 50, + kVulkanObjectTypeMax = 51, // Aliases for backwards compatibilty of "promoted" types kVulkanObjectTypeDescriptorUpdateTemplateKHR = kVulkanObjectTypeDescriptorUpdateTemplate, kVulkanObjectTypeSamplerYcbcrConversionKHR = kVulkanObjectTypeSamplerYcbcrConversion, @@ -138,6 +140,8 @@ static const char * const object_string[kVulkanObjectTypeMax] = { "AccelerationStructureNV", "PerformanceConfigurationINTEL", "IndirectCommandsLayoutNV", + "CudaModuleNV", + "CudaFunctionNV", "AccelerationStructureKHR", "BufferCollectionFUCHSIA", "MicromapEXT", @@ -191,6 +195,8 @@ const VkDebugReportObjectTypeEXT get_debug_report_enum[] = { VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV_EXT, // kVulkanObjectTypeAccelerationStructureNV VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, // kVulkanObjectTypePerformanceConfigurationINTEL VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, // kVulkanObjectTypeIndirectCommandsLayoutNV + VK_DEBUG_REPORT_OBJECT_TYPE_CUDA_MODULE_NV, // kVulkanObjectTypeCudaModuleNV + VK_DEBUG_REPORT_OBJECT_TYPE_CUDA_FUNCTION_NV, // kVulkanObjectTypeCudaFunctionNV VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR_EXT, // kVulkanObjectTypeAccelerationStructureKHR VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_COLLECTION_FUCHSIA_EXT, // kVulkanObjectTypeBufferCollectionFUCHSIA VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, // kVulkanObjectTypeMicromapEXT @@ -244,6 +250,8 @@ const VkObjectType get_object_type_enum[] = { VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV, // kVulkanObjectTypeAccelerationStructureNV VK_OBJECT_TYPE_PERFORMANCE_CONFIGURATION_INTEL, // kVulkanObjectTypePerformanceConfigurationINTEL VK_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NV, // kVulkanObjectTypeIndirectCommandsLayoutNV + VK_OBJECT_TYPE_CUDA_MODULE_NV, // kVulkanObjectTypeCudaModuleNV + VK_OBJECT_TYPE_CUDA_FUNCTION_NV, // kVulkanObjectTypeCudaFunctionNV VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR, // kVulkanObjectTypeAccelerationStructureKHR VK_OBJECT_TYPE_BUFFER_COLLECTION_FUCHSIA, // kVulkanObjectTypeBufferCollectionFUCHSIA VK_OBJECT_TYPE_MICROMAP_EXT, // kVulkanObjectTypeMicromapEXT diff --git a/loader/loader.rc b/loader/loader.rc index 74a665931..431a85a65 100644 --- a/loader/loader.rc +++ b/loader/loader.rc @@ -22,8 +22,8 @@ #include "winres.h" // All set through CMake -#define VER_FILE_VERSION 1, 3, 268, 0 -#define VER_FILE_DESCRIPTION_STR "1.3.268.Dev Build" +#define VER_FILE_VERSION 1, 3, 269, 0 +#define VER_FILE_DESCRIPTION_STR "1.3.269.Dev Build" #define VER_FILE_VERSION_STR "Vulkan Loader - Dev Build" #define VER_COPYRIGHT_STR "Copyright (C) 2015-2023" diff --git a/scripts/helper_file_generator.py b/scripts/helper_file_generator.py index 41685114f..78076302b 100644 --- a/scripts/helper_file_generator.py +++ b/scripts/helper_file_generator.py @@ -176,10 +176,7 @@ def beginFeature(self, interface, emit): if interface.tag != 'extension': return name = self.featureName - nameElem = interface[0][1] - name_define = nameElem.get('name') - if 'EXTENSION_NAME' not in name_define: - print("Error in vk.xml file -- extension name is not available") + name_define = next(enum.get('name') for enum in interface.findall('require/enum') if enum.get('name').endswith('_EXTENSION_NAME')) requires = interface.get('requires') if requires is not None: required_extensions = requires.split(',') @@ -426,7 +423,7 @@ def to_key(regex, raw_key): return re.search(regex, raw_key).group(1).lower().re object_types_header += 'const VkDebugReportObjectTypeEXT get_debug_report_enum[] = {\n' object_types_header += ' VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, // kVulkanObjectTypeUnknown\n' - dbg_re = '^VK_DEBUG_REPORT_OBJECT_TYPE_(.*)_EXT$' + dbg_re = '^VK_DEBUG_REPORT_OBJECT_TYPE_(.*?)(_EXT)?$' dbg_map = {to_key(dbg_re, dbg) : dbg for dbg in self.debug_report_object_types} dbg_default = 'VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT' for object_type in type_list: diff --git a/scripts/known_good.json b/scripts/known_good.json index bc6334e2f..a904333dc 100644 --- a/scripts/known_good.json +++ b/scripts/known_good.json @@ -6,7 +6,7 @@ "sub_dir": "Vulkan-Headers", "build_dir": "Vulkan-Headers/build", "install_dir": "Vulkan-Headers/build/install", - "commit": "v1.3.268" + "commit": "v1.3.269" }, { "name": "googletest",