build: API parameterization changes
authorDaniel Rakos <daniel.rakos@rastergrid.com>
Fri, 5 Jan 2024 17:02:09 +0000 (18:02 +0100)
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>
Fri, 5 Jan 2024 18:47:54 +0000 (12:47 -0600)
19 files changed:
CMakeLists.txt
loader/CMakeLists.txt
loader/generated/vk_layer_dispatch_table.h
loader/generated/vk_loader_extensions.c
loader/generated/vk_loader_extensions.h
loader/loader.c
loader/terminator.c
loader/trampoline.c
loader/vk_loader_platform.h
scripts/CMakeLists.txt
scripts/generate_source.py
scripts/known_good.json
scripts/loader_extension_generator.py
scripts/loader_genvk.py
tests/framework/icd/test_icd.cpp
tests/framework/shim/shim.h
tests/framework/shim/windows_shim.cpp
tests/loader_handle_validation_tests.cpp
tests/loader_regression_tests.cpp

index 3618446aed7076e2d108f0438430c924f7ea5ed3..e1af66d2992f44f16279b4262e92fb7142f1f192 100644 (file)
@@ -1,6 +1,8 @@
 # ~~~
 # Copyright (c) 2014-2023 Valve Corporation
 # Copyright (c) 2014-2023 LunarG, Inc.
+# Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# 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.
@@ -18,6 +20,10 @@ cmake_minimum_required(VERSION 3.17.2)
 
 project(VULKAN_LOADER VERSION 1.3.274 LANGUAGES C)
 
+# This variable enables downstream users to customize the target API
+# variant (e.g. Vulkan SC)
+set(API_TYPE "vulkan")
+
 add_subdirectory(scripts)
 
 set(CMAKE_C_STANDARD 99)
@@ -209,7 +215,7 @@ if(LOADER_CODEGEN)
     add_custom_target(loader_codegen
         COMMAND Python3::Interpreter ${PROJECT_SOURCE_DIR}/scripts/generate_source.py
             "${VULKAN_HEADERS_INSTALL_DIR}/${CMAKE_INSTALL_DATADIR}/vulkan/registry"
-            --generated-version ${VulkanHeaders_VERSION} --incremental
+            --generated-version ${VulkanHeaders_VERSION} --incremental --api ${API_TYPE}
     )
 endif()
 
index f495761ee5f90f5acbef4140326fb8e82b856f07..622937b2a46300d19507cac7b75cb9a84149336f 100644 (file)
@@ -3,6 +3,7 @@
 # Copyright (c) 2014-2023 Valve Corporation
 # Copyright (c) 2014-2023 LunarG, Inc.
 # Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# 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.
@@ -328,7 +329,7 @@ if(WIN32)
                 SHARED
                 ${NORMAL_LOADER_SRCS}
                 ${LOADER_UNKNOWN_CHAIN_LIBRARY}
-                ${CMAKE_CURRENT_SOURCE_DIR}/vulkan-1.def
+                ${CMAKE_CURRENT_SOURCE_DIR}/${API_TYPE}-1.def
                 ${RC_FILE_LOCATION})
 
     target_link_libraries(vulkan PRIVATE loader_specific_options loader-opt)
@@ -338,7 +339,7 @@ if(WIN32)
     # msvc: vulkan-1.lib / vulkan-1.dll
     set_target_properties(vulkan
                           PROPERTIES
-                          OUTPUT_NAME vulkan-1)
+                          OUTPUT_NAME ${API_TYPE}-1)
     if(MINGW)
         # generate the same DLL with mingw
         set_target_properties(vulkan
@@ -385,6 +386,8 @@ else()
 
     target_link_libraries(vulkan PRIVATE ${CMAKE_DL_LIBS} m Threads::Threads)
 
+    set_target_properties(vulkan PROPERTIES OUTPUT_NAME ${API_TYPE})
+
     if (LOADER_ENABLE_ADDRESS_SANITIZER)
         target_compile_options(vulkan PUBLIC -fsanitize=address)
         target_link_options(vulkan PUBLIC -fsanitize=address)
@@ -506,5 +509,5 @@ if (PKG_CONFIG_FOUND)
         file(RELATIVE_PATH CMAKE_INSTALL_INCLUDEDIR_PC ${CMAKE_INSTALL_PREFIX} ${CMAKE_INSTALL_FULL_INCLUDEDIR})
     endif()
     configure_file("vulkan.pc.in" "vulkan.pc" @ONLY)
-    install(FILES "${CMAKE_CURRENT_BINARY_DIR}/vulkan.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
+    install(FILES "${CMAKE_CURRENT_BINARY_DIR}/vulkan.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig" RENAME "${API_TYPE}.pc")
 endif()
index 3aa8cb59453f839a807cd5484f309dd75b63b1cc..f40fd03c99602814312e02e254ee2251749f1215 100644 (file)
@@ -5,6 +5,8 @@
  * Copyright (c) 2015-2022 The Khronos Group Inc.
  * Copyright (c) 2015-2022 Valve Corporation
  * Copyright (c) 2015-2022 LunarG, Inc.
+ * Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+ * 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.
@@ -34,7 +36,7 @@ typedef struct VkLayerInstanceDispatchTable_ {
     // Manually add in GetPhysicalDeviceProcAddr entry
     PFN_GetPhysicalDeviceProcAddr GetPhysicalDeviceProcAddr;
 
-    // ---- Core 1_0 commands
+    // ---- Core Vulkan 1.0 commands
     PFN_vkCreateInstance CreateInstance;
     PFN_vkDestroyInstance DestroyInstance;
     PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
@@ -52,7 +54,7 @@ typedef struct VkLayerInstanceDispatchTable_ {
     PFN_vkEnumerateDeviceLayerProperties EnumerateDeviceLayerProperties;
     PFN_vkGetPhysicalDeviceSparseImageFormatProperties GetPhysicalDeviceSparseImageFormatProperties;
 
-    // ---- Core 1_1 commands
+    // ---- Core Vulkan 1.1 commands
     PFN_vkEnumerateInstanceVersion EnumerateInstanceVersion;
     PFN_vkEnumeratePhysicalDeviceGroups EnumeratePhysicalDeviceGroups;
     PFN_vkGetPhysicalDeviceFeatures2 GetPhysicalDeviceFeatures2;
@@ -66,7 +68,7 @@ typedef struct VkLayerInstanceDispatchTable_ {
     PFN_vkGetPhysicalDeviceExternalFenceProperties GetPhysicalDeviceExternalFenceProperties;
     PFN_vkGetPhysicalDeviceExternalSemaphoreProperties GetPhysicalDeviceExternalSemaphoreProperties;
 
-    // ---- Core 1_3 commands
+    // ---- Core Vulkan 1.3 commands
     PFN_vkGetPhysicalDeviceToolProperties GetPhysicalDeviceToolProperties;
 
     // ---- VK_KHR_surface extension commands
@@ -293,7 +295,7 @@ typedef struct VkLayerInstanceDispatchTable_ {
 typedef struct VkLayerDispatchTable_ {
     uint64_t magic; // Should be DEVICE_DISP_TABLE_MAGIC_NUMBER
 
-    // ---- Core 1_0 commands
+    // ---- Core Vulkan 1.0 commands
     PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
     PFN_vkDestroyDevice DestroyDevice;
     PFN_vkGetDeviceQueue GetDeviceQueue;
@@ -416,7 +418,7 @@ typedef struct VkLayerDispatchTable_ {
     PFN_vkCmdEndRenderPass CmdEndRenderPass;
     PFN_vkCmdExecuteCommands CmdExecuteCommands;
 
-    // ---- Core 1_1 commands
+    // ---- Core Vulkan 1.1 commands
     PFN_vkBindBufferMemory2 BindBufferMemory2;
     PFN_vkBindImageMemory2 BindImageMemory2;
     PFN_vkGetDeviceGroupPeerMemoryFeatures GetDeviceGroupPeerMemoryFeatures;
@@ -434,7 +436,7 @@ typedef struct VkLayerDispatchTable_ {
     PFN_vkUpdateDescriptorSetWithTemplate UpdateDescriptorSetWithTemplate;
     PFN_vkGetDescriptorSetLayoutSupport GetDescriptorSetLayoutSupport;
 
-    // ---- Core 1_2 commands
+    // ---- Core Vulkan 1.2 commands
     PFN_vkCmdDrawIndirectCount CmdDrawIndirectCount;
     PFN_vkCmdDrawIndexedIndirectCount CmdDrawIndexedIndirectCount;
     PFN_vkCreateRenderPass2 CreateRenderPass2;
@@ -449,7 +451,7 @@ typedef struct VkLayerDispatchTable_ {
     PFN_vkGetBufferOpaqueCaptureAddress GetBufferOpaqueCaptureAddress;
     PFN_vkGetDeviceMemoryOpaqueCaptureAddress GetDeviceMemoryOpaqueCaptureAddress;
 
-    // ---- Core 1_3 commands
+    // ---- Core Vulkan 1.3 commands
     PFN_vkCreatePrivateDataSlot CreatePrivateDataSlot;
     PFN_vkDestroyPrivateDataSlot DestroyPrivateDataSlot;
     PFN_vkSetPrivateData SetPrivateData;
index db54e0b920b1d57580ad5288840d597b9bcfbf9d..23b40c33a673fbd47583a166e6ce698cbff23171 100644 (file)
@@ -5,6 +5,8 @@
  * Copyright (c) 2015-2022 The Khronos Group Inc.
  * Copyright (c) 2015-2022 Valve Corporation
  * Copyright (c) 2015-2022 LunarG, Inc.
+ * Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+ * 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.
@@ -63,7 +65,7 @@ VKAPI_ATTR bool VKAPI_CALL loader_icd_init_entries(struct loader_instance* inst,
     } while (0)
 
 
-    // ---- Core 1_0
+    // ---- Core Vulkan 1.0
     LOOKUP_REQUIRED_GIPA(DestroyInstance);
     LOOKUP_REQUIRED_GIPA(EnumeratePhysicalDevices);
     LOOKUP_REQUIRED_GIPA(GetPhysicalDeviceFeatures);
@@ -77,7 +79,7 @@ VKAPI_ATTR bool VKAPI_CALL loader_icd_init_entries(struct loader_instance* inst,
     LOOKUP_REQUIRED_GIPA(EnumerateDeviceExtensionProperties);
     LOOKUP_REQUIRED_GIPA(GetPhysicalDeviceSparseImageFormatProperties);
 
-    // ---- Core 1_1
+    // ---- Core Vulkan 1.1
     LOOKUP_GIPA(EnumeratePhysicalDeviceGroups);
     LOOKUP_GIPA(GetPhysicalDeviceFeatures2);
     LOOKUP_GIPA(GetPhysicalDeviceProperties2);
@@ -90,7 +92,7 @@ VKAPI_ATTR bool VKAPI_CALL loader_icd_init_entries(struct loader_instance* inst,
     LOOKUP_GIPA(GetPhysicalDeviceExternalFenceProperties);
     LOOKUP_GIPA(GetPhysicalDeviceExternalSemaphoreProperties);
 
-    // ---- Core 1_3
+    // ---- Core Vulkan 1.3
     LOOKUP_GIPA(GetPhysicalDeviceToolProperties);
 
     // ---- VK_KHR_surface extension commands
@@ -324,7 +326,7 @@ VKAPI_ATTR void VKAPI_CALL loader_init_device_dispatch_table(struct loader_dev_d
     if (table->magic != DEVICE_DISP_TABLE_MAGIC_NUMBER) { abort(); }
     for (uint32_t i = 0; i < MAX_NUM_UNKNOWN_EXTS; i++) dev_table->ext_dispatch[i] = (PFN_vkDevExt)vkDevExtError;
 
-    // ---- Core 1_0 commands
+    // ---- Core Vulkan 1.0 commands
     table->GetDeviceProcAddr = gpa;
     table->DestroyDevice = (PFN_vkDestroyDevice)gpa(dev, "vkDestroyDevice");
     table->GetDeviceQueue = (PFN_vkGetDeviceQueue)gpa(dev, "vkGetDeviceQueue");
@@ -447,7 +449,7 @@ VKAPI_ATTR void VKAPI_CALL loader_init_device_dispatch_table(struct loader_dev_d
     table->CmdEndRenderPass = (PFN_vkCmdEndRenderPass)gpa(dev, "vkCmdEndRenderPass");
     table->CmdExecuteCommands = (PFN_vkCmdExecuteCommands)gpa(dev, "vkCmdExecuteCommands");
 
-    // ---- Core 1_1 commands
+    // ---- Core Vulkan 1.1 commands
     table->BindBufferMemory2 = (PFN_vkBindBufferMemory2)gpa(dev, "vkBindBufferMemory2");
     table->BindImageMemory2 = (PFN_vkBindImageMemory2)gpa(dev, "vkBindImageMemory2");
     table->GetDeviceGroupPeerMemoryFeatures = (PFN_vkGetDeviceGroupPeerMemoryFeatures)gpa(dev, "vkGetDeviceGroupPeerMemoryFeatures");
@@ -465,7 +467,7 @@ VKAPI_ATTR void VKAPI_CALL loader_init_device_dispatch_table(struct loader_dev_d
     table->UpdateDescriptorSetWithTemplate = (PFN_vkUpdateDescriptorSetWithTemplate)gpa(dev, "vkUpdateDescriptorSetWithTemplate");
     table->GetDescriptorSetLayoutSupport = (PFN_vkGetDescriptorSetLayoutSupport)gpa(dev, "vkGetDescriptorSetLayoutSupport");
 
-    // ---- Core 1_2 commands
+    // ---- Core Vulkan 1.2 commands
     table->CmdDrawIndirectCount = (PFN_vkCmdDrawIndirectCount)gpa(dev, "vkCmdDrawIndirectCount");
     table->CmdDrawIndexedIndirectCount = (PFN_vkCmdDrawIndexedIndirectCount)gpa(dev, "vkCmdDrawIndexedIndirectCount");
     table->CreateRenderPass2 = (PFN_vkCreateRenderPass2)gpa(dev, "vkCreateRenderPass2");
@@ -480,7 +482,7 @@ VKAPI_ATTR void VKAPI_CALL loader_init_device_dispatch_table(struct loader_dev_d
     table->GetBufferOpaqueCaptureAddress = (PFN_vkGetBufferOpaqueCaptureAddress)gpa(dev, "vkGetBufferOpaqueCaptureAddress");
     table->GetDeviceMemoryOpaqueCaptureAddress = (PFN_vkGetDeviceMemoryOpaqueCaptureAddress)gpa(dev, "vkGetDeviceMemoryOpaqueCaptureAddress");
 
-    // ---- Core 1_3 commands
+    // ---- Core Vulkan 1.3 commands
     table->CreatePrivateDataSlot = (PFN_vkCreatePrivateDataSlot)gpa(dev, "vkCreatePrivateDataSlot");
     table->DestroyPrivateDataSlot = (PFN_vkDestroyPrivateDataSlot)gpa(dev, "vkDestroyPrivateDataSlot");
     table->SetPrivateData = (PFN_vkSetPrivateData)gpa(dev, "vkSetPrivateData");
@@ -1197,7 +1199,7 @@ VKAPI_ATTR void VKAPI_CALL loader_init_device_extension_dispatch_table(struct lo
 VKAPI_ATTR void VKAPI_CALL loader_init_instance_core_dispatch_table(VkLayerInstanceDispatchTable *table, PFN_vkGetInstanceProcAddr gpa,
                                                                     VkInstance inst) {
 
-    // ---- Core 1_0 commands
+    // ---- Core Vulkan 1.0 commands
     table->DestroyInstance = (PFN_vkDestroyInstance)gpa(inst, "vkDestroyInstance");
     table->EnumeratePhysicalDevices = (PFN_vkEnumeratePhysicalDevices)gpa(inst, "vkEnumeratePhysicalDevices");
     table->GetPhysicalDeviceFeatures = (PFN_vkGetPhysicalDeviceFeatures)gpa(inst, "vkGetPhysicalDeviceFeatures");
@@ -1211,7 +1213,7 @@ VKAPI_ATTR void VKAPI_CALL loader_init_instance_core_dispatch_table(VkLayerInsta
     table->EnumerateDeviceLayerProperties = (PFN_vkEnumerateDeviceLayerProperties)gpa(inst, "vkEnumerateDeviceLayerProperties");
     table->GetPhysicalDeviceSparseImageFormatProperties = (PFN_vkGetPhysicalDeviceSparseImageFormatProperties)gpa(inst, "vkGetPhysicalDeviceSparseImageFormatProperties");
 
-    // ---- Core 1_1 commands
+    // ---- Core Vulkan 1.1 commands
     table->EnumeratePhysicalDeviceGroups = (PFN_vkEnumeratePhysicalDeviceGroups)gpa(inst, "vkEnumeratePhysicalDeviceGroups");
     table->GetPhysicalDeviceFeatures2 = (PFN_vkGetPhysicalDeviceFeatures2)gpa(inst, "vkGetPhysicalDeviceFeatures2");
     table->GetPhysicalDeviceProperties2 = (PFN_vkGetPhysicalDeviceProperties2)gpa(inst, "vkGetPhysicalDeviceProperties2");
@@ -1224,7 +1226,7 @@ VKAPI_ATTR void VKAPI_CALL loader_init_instance_core_dispatch_table(VkLayerInsta
     table->GetPhysicalDeviceExternalFenceProperties = (PFN_vkGetPhysicalDeviceExternalFenceProperties)gpa(inst, "vkGetPhysicalDeviceExternalFenceProperties");
     table->GetPhysicalDeviceExternalSemaphoreProperties = (PFN_vkGetPhysicalDeviceExternalSemaphoreProperties)gpa(inst, "vkGetPhysicalDeviceExternalSemaphoreProperties");
 
-    // ---- Core 1_3 commands
+    // ---- Core Vulkan 1.3 commands
     table->GetPhysicalDeviceToolProperties = (PFN_vkGetPhysicalDeviceToolProperties)gpa(inst, "vkGetPhysicalDeviceToolProperties");
 }
 
@@ -1524,7 +1526,7 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_device_dispatch_table(const VkLayerDis
     uint32_t api_version = VK_MAKE_API_VERSION(0, inst->app_api_version.major, inst->app_api_version.minor, inst->app_api_version.patch);
 
 
-    // ---- Core 1_0 commands
+    // ---- Core Vulkan 1.0 commands
     if (!strcmp(name, "GetDeviceProcAddr")) {
         if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_0) return NULL;
         return (void *)table->GetDeviceProcAddr;
@@ -2010,7 +2012,7 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_device_dispatch_table(const VkLayerDis
         return (void *)table->CmdExecuteCommands;
     }
 
-    // ---- Core 1_1 commands
+    // ---- Core Vulkan 1.1 commands
     if (!strcmp(name, "BindBufferMemory2")) {
         if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_1) return NULL;
         return (void *)table->BindBufferMemory2;
@@ -2076,7 +2078,7 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_device_dispatch_table(const VkLayerDis
         return (void *)table->GetDescriptorSetLayoutSupport;
     }
 
-    // ---- Core 1_2 commands
+    // ---- Core Vulkan 1.2 commands
     if (!strcmp(name, "CmdDrawIndirectCount")) {
         if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_2) return NULL;
         return (void *)table->CmdDrawIndirectCount;
@@ -2130,7 +2132,7 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_device_dispatch_table(const VkLayerDis
         return (void *)table->GetDeviceMemoryOpaqueCaptureAddress;
     }
 
-    // ---- Core 1_3 commands
+    // ---- Core Vulkan 1.3 commands
     if (!strcmp(name, "CreatePrivateDataSlot")) {
         if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_3) return NULL;
         return (void *)table->CreatePrivateDataSlot;
@@ -2955,7 +2957,7 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_instance_dispatch_table(const VkLayerI
     *found_name = true;
     name += 2;
 
-    // ---- Core 1_0 commands
+    // ---- Core Vulkan 1.0 commands
     if (!strcmp(name, "DestroyInstance")) return (void *)table->DestroyInstance;
     if (!strcmp(name, "EnumeratePhysicalDevices")) return (void *)table->EnumeratePhysicalDevices;
     if (!strcmp(name, "GetPhysicalDeviceFeatures")) return (void *)table->GetPhysicalDeviceFeatures;
@@ -2969,7 +2971,7 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_instance_dispatch_table(const VkLayerI
     if (!strcmp(name, "EnumerateDeviceLayerProperties")) return (void *)table->EnumerateDeviceLayerProperties;
     if (!strcmp(name, "GetPhysicalDeviceSparseImageFormatProperties")) return (void *)table->GetPhysicalDeviceSparseImageFormatProperties;
 
-    // ---- Core 1_1 commands
+    // ---- Core Vulkan 1.1 commands
     if (!strcmp(name, "EnumeratePhysicalDeviceGroups")) return (void *)table->EnumeratePhysicalDeviceGroups;
     if (!strcmp(name, "GetPhysicalDeviceFeatures2")) return (void *)table->GetPhysicalDeviceFeatures2;
     if (!strcmp(name, "GetPhysicalDeviceProperties2")) return (void *)table->GetPhysicalDeviceProperties2;
@@ -2982,7 +2984,7 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_instance_dispatch_table(const VkLayerI
     if (!strcmp(name, "GetPhysicalDeviceExternalFenceProperties")) return (void *)table->GetPhysicalDeviceExternalFenceProperties;
     if (!strcmp(name, "GetPhysicalDeviceExternalSemaphoreProperties")) return (void *)table->GetPhysicalDeviceExternalSemaphoreProperties;
 
-    // ---- Core 1_3 commands
+    // ---- Core Vulkan 1.3 commands
     if (!strcmp(name, "GetPhysicalDeviceToolProperties")) return (void *)table->GetPhysicalDeviceToolProperties;
 
     // ---- VK_KHR_surface extension commands
@@ -11881,7 +11883,7 @@ PFN_vkVoidFunction get_extension_device_proc_terminator(struct loader_device *de
 // pointers to "terminator functions".
 const VkLayerInstanceDispatchTable instance_disp = {
 
-    // ---- Core 1_0 commands
+    // ---- Core Vulkan 1.0 commands
     .DestroyInstance = terminator_DestroyInstance,
     .EnumeratePhysicalDevices = terminator_EnumeratePhysicalDevices,
     .GetPhysicalDeviceFeatures = terminator_GetPhysicalDeviceFeatures,
@@ -11895,7 +11897,7 @@ const VkLayerInstanceDispatchTable instance_disp = {
     .EnumerateDeviceLayerProperties = terminator_EnumerateDeviceLayerProperties,
     .GetPhysicalDeviceSparseImageFormatProperties = terminator_GetPhysicalDeviceSparseImageFormatProperties,
 
-    // ---- Core 1_1 commands
+    // ---- Core Vulkan 1.1 commands
     .EnumeratePhysicalDeviceGroups = terminator_EnumeratePhysicalDeviceGroups,
     .GetPhysicalDeviceFeatures2 = terminator_GetPhysicalDeviceFeatures2,
     .GetPhysicalDeviceProperties2 = terminator_GetPhysicalDeviceProperties2,
@@ -11908,7 +11910,7 @@ const VkLayerInstanceDispatchTable instance_disp = {
     .GetPhysicalDeviceExternalFenceProperties = terminator_GetPhysicalDeviceExternalFenceProperties,
     .GetPhysicalDeviceExternalSemaphoreProperties = terminator_GetPhysicalDeviceExternalSemaphoreProperties,
 
-    // ---- Core 1_3 commands
+    // ---- Core Vulkan 1.3 commands
     .GetPhysicalDeviceToolProperties = terminator_GetPhysicalDeviceToolProperties,
 
     // ---- VK_KHR_surface extension commands
index 7649d6cb3012cb02795ccb2c37afaa7dcd6ad609..66fd83e5bcc2f982fd57f08b5d928a54916da7b6 100644 (file)
@@ -5,6 +5,8 @@
  * Copyright (c) 2015-2022 The Khronos Group Inc.
  * Copyright (c) 2015-2022 Valve Corporation
  * Copyright (c) 2015-2022 LunarG, Inc.
+ * Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+ * 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.
@@ -208,7 +210,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceToolProperties(
 // ICD function pointer dispatch table
 struct loader_icd_term_dispatch {
 
-    // ---- Core 1_0 commands
+    // ---- Core Vulkan 1.0 commands
     PFN_vkCreateInstance CreateInstance;
     PFN_vkDestroyInstance DestroyInstance;
     PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
@@ -225,7 +227,7 @@ struct loader_icd_term_dispatch {
     PFN_vkEnumerateInstanceLayerProperties EnumerateInstanceLayerProperties;
     PFN_vkGetPhysicalDeviceSparseImageFormatProperties GetPhysicalDeviceSparseImageFormatProperties;
 
-    // ---- Core 1_1 commands
+    // ---- Core Vulkan 1.1 commands
     PFN_vkEnumerateInstanceVersion EnumerateInstanceVersion;
     PFN_vkEnumeratePhysicalDeviceGroups EnumeratePhysicalDeviceGroups;
     PFN_vkGetPhysicalDeviceFeatures2 GetPhysicalDeviceFeatures2;
@@ -239,7 +241,7 @@ struct loader_icd_term_dispatch {
     PFN_vkGetPhysicalDeviceExternalFenceProperties GetPhysicalDeviceExternalFenceProperties;
     PFN_vkGetPhysicalDeviceExternalSemaphoreProperties GetPhysicalDeviceExternalSemaphoreProperties;
 
-    // ---- Core 1_3 commands
+    // ---- Core Vulkan 1.3 commands
     PFN_vkGetPhysicalDeviceToolProperties GetPhysicalDeviceToolProperties;
 
     // ---- VK_KHR_surface extension commands
index a65b59704d50ebf8c2d6a11e17429c73951a9531..7470790aa78a7fdfbaa62cce0088525836f4c331 100644 (file)
@@ -4,6 +4,8 @@
  * Copyright (c) 2014-2023 Valve Corporation
  * Copyright (c) 2014-2023 LunarG, Inc.
  * Copyright (C) 2015 Google Inc.
+ * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+ * 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.
@@ -4720,7 +4722,7 @@ VkResult loader_create_device_chain(const VkPhysicalDevice pd, const VkDeviceCre
     VkLayerDeviceLink *layer_device_link_info;
     VkLayerDeviceCreateInfo chain_info;
     VkDeviceCreateInfo loader_create_info;
-    VkDeviceGroupDeviceCreateInfoKHR *original_device_group_create_info_struct = NULL;
+    VkDeviceGroupDeviceCreateInfo *original_device_group_create_info_struct = NULL;
     VkResult res;
 
     PFN_vkGetDeviceProcAddr fpGDPA = NULL, nextGDPA = loader_gpa_device_terminator;
@@ -4757,7 +4759,7 @@ VkResult loader_create_device_chain(const VkPhysicalDevice pd, const VkDeviceCre
     }
 
     // Before we continue, we need to find out if the KHR_device_group extension is in the enabled list.  If it is, we then
-    // need to look for the corresponding VkDeviceGroupDeviceCreateInfoKHR struct in the device list.  This is because we
+    // need to look for the corresponding VkDeviceGroupDeviceCreateInfo struct in the device list.  This is because we
     // need to replace all the incoming physical device values (which are really loader trampoline physical device values)
     // with the layer/ICD version.
     {
@@ -4765,14 +4767,14 @@ VkResult loader_create_device_chain(const VkPhysicalDevice pd, const VkDeviceCre
         VkBaseOutStructure *pPrev = (VkBaseOutStructure *)&loader_create_info;
         while (NULL != pNext) {
             if (VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO == pNext->sType) {
-                VkDeviceGroupDeviceCreateInfoKHR *cur_struct = (VkDeviceGroupDeviceCreateInfoKHR *)pNext;
+                VkDeviceGroupDeviceCreateInfo *cur_struct = (VkDeviceGroupDeviceCreateInfo *)pNext;
                 if (0 < cur_struct->physicalDeviceCount && NULL != cur_struct->pPhysicalDevices) {
-                    VkDeviceGroupDeviceCreateInfoKHR *temp_struct = loader_stack_alloc(sizeof(VkDeviceGroupDeviceCreateInfoKHR));
+                    VkDeviceGroupDeviceCreateInfo *temp_struct = loader_stack_alloc(sizeof(VkDeviceGroupDeviceCreateInfo));
                     VkPhysicalDevice *phys_dev_array = NULL;
                     if (NULL == temp_struct) {
                         return VK_ERROR_OUT_OF_HOST_MEMORY;
                     }
-                    memcpy(temp_struct, cur_struct, sizeof(VkDeviceGroupDeviceCreateInfoKHR));
+                    memcpy(temp_struct, cur_struct, sizeof(VkDeviceGroupDeviceCreateInfo));
                     phys_dev_array = loader_stack_alloc(sizeof(VkPhysicalDevice) * cur_struct->physicalDeviceCount);
                     if (NULL == phys_dev_array) {
                         return VK_ERROR_OUT_OF_HOST_MEMORY;
@@ -4787,7 +4789,7 @@ VkResult loader_create_device_chain(const VkPhysicalDevice pd, const VkDeviceCre
                     }
                     temp_struct->pPhysicalDevices = phys_dev_array;
 
-                    original_device_group_create_info_struct = (VkDeviceGroupDeviceCreateInfoKHR *)pPrev->pNext;
+                    original_device_group_create_info_struct = (VkDeviceGroupDeviceCreateInfo *)pPrev->pNext;
 
                     // Replace the old struct in the pNext chain with this one.
                     pPrev->pNext = (VkBaseOutStructure *)temp_struct;
@@ -4938,13 +4940,13 @@ VkResult loader_create_device_chain(const VkPhysicalDevice pd, const VkDeviceCre
         }
         dev->chain_device = created_device;
 
-        // Because we changed the pNext chain to use our own VkDeviceGroupDeviceCreateInfoKHR, we need to fixup the chain to
-        // point back at the original VkDeviceGroupDeviceCreateInfoKHR.
+        // Because we changed the pNext chain to use our own VkDeviceGroupDeviceCreateInfo, we need to fixup the chain to
+        // point back at the original VkDeviceGroupDeviceCreateInfo.
         VkBaseOutStructure *pNext = (VkBaseOutStructure *)loader_create_info.pNext;
         VkBaseOutStructure *pPrev = (VkBaseOutStructure *)&loader_create_info;
         while (NULL != pNext) {
             if (VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO == pNext->sType) {
-                VkDeviceGroupDeviceCreateInfoKHR *cur_struct = (VkDeviceGroupDeviceCreateInfoKHR *)pNext;
+                VkDeviceGroupDeviceCreateInfo *cur_struct = (VkDeviceGroupDeviceCreateInfo *)pNext;
                 if (0 < cur_struct->physicalDeviceCount && NULL != cur_struct->pPhysicalDevices) {
                     pPrev->pNext = (VkBaseOutStructure *)original_device_group_create_info_struct;
                 }
@@ -5378,12 +5380,14 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance(const VkInstanceCreateI
 
         // Create an instance, substituting the version to 1.0 if necessary
         VkApplicationInfo icd_app_info;
+        const uint32_t api_variant = 0;
+        const uint32_t api_version_1_0 = VK_API_VERSION_1_0;
         uint32_t icd_version_nopatch =
-            VK_MAKE_API_VERSION(0, VK_API_VERSION_MAJOR(icd_version), VK_API_VERSION_MINOR(icd_version), 0);
+            VK_MAKE_API_VERSION(api_variant, VK_API_VERSION_MAJOR(icd_version), VK_API_VERSION_MINOR(icd_version), 0);
         uint32_t requested_version = (pCreateInfo == NULL || pCreateInfo->pApplicationInfo == NULL)
-                                         ? VK_API_VERSION_1_0
+                                         ? api_version_1_0
                                          : pCreateInfo->pApplicationInfo->apiVersion;
-        if ((requested_version != 0) && (icd_version_nopatch == VK_API_VERSION_1_0)) {
+        if ((requested_version != 0) && (icd_version_nopatch == api_version_1_0)) {
             if (icd_create_info.pApplicationInfo == NULL) {
                 memset(&icd_app_info, 0, sizeof(icd_app_info));
             } else {
@@ -5582,7 +5586,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDevice(VkPhysicalDevice physical
     struct loader_extension_list icd_exts;
 
     VkBaseOutStructure *caller_dgci_container = NULL;
-    VkDeviceGroupDeviceCreateInfoKHR *caller_dgci = NULL;
+    VkDeviceGroupDeviceCreateInfo *caller_dgci = NULL;
 
     if (NULL == dev) {
         loader_log(icd_term->this_instance, VULKAN_LOADER_WARN_BIT, 0,
@@ -5733,7 +5737,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDevice(VkPhysicalDevice physical
                 }
 
                 case VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO: {
-                    const VkDeviceGroupDeviceCreateInfoKHR *group_info = pNext;
+                    const VkDeviceGroupDeviceCreateInfo *group_info = pNext;
 
                     if (icd_term->dispatch.EnumeratePhysicalDeviceGroups == NULL &&
                         icd_term->dispatch.EnumeratePhysicalDeviceGroupsKHR == NULL) {
@@ -5844,7 +5848,7 @@ out:
         loader_destroy_generic_list(icd_term->this_instance, (struct loader_generic_list *)&icd_exts);
     }
 
-    // Restore pNext pointer to old VkDeviceGroupDeviceCreateInfoKHX
+    // Restore pNext pointer to old VkDeviceGroupDeviceCreateInfo
     // in the chain to maintain consistency for the caller.
     if (caller_dgci_container != NULL) {
         caller_dgci_container->pNext = (VkBaseOutStructure *)caller_dgci;
@@ -6782,7 +6786,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumeratePhysicalDeviceGroups(
     struct loader_icd_term *icd_term;
     uint32_t total_count = 0;
     uint32_t cur_icd_group_count = 0;
-    VkPhysicalDeviceGroupPropertiesKHR **new_phys_dev_groups = NULL;
+    VkPhysicalDeviceGroupProperties **new_phys_dev_groups = NULL;
     struct loader_physical_device_group_term *local_phys_dev_groups = NULL;
     PFN_vkEnumeratePhysicalDeviceGroups fpEnumeratePhysicalDeviceGroups = NULL;
     struct loader_icd_physical_devices *sorted_phys_dev_array = NULL;
@@ -6792,6 +6796,8 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumeratePhysicalDeviceGroups(
     // internal value for those physical devices.
     icd_term = inst->icd_terms;
     for (uint32_t icd_idx = 0; NULL != icd_term; icd_term = icd_term->next, icd_idx++) {
+        cur_icd_group_count = 0;
+
         // Get the function pointer to use to call into the ICD. This could be the core or KHR version
         if (inst->enabled_known_extensions.khr_device_group_creation) {
             fpEnumeratePhysicalDeviceGroups = icd_term->dispatch.EnumeratePhysicalDeviceGroupsKHR;
@@ -6799,7 +6805,6 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumeratePhysicalDeviceGroups(
             fpEnumeratePhysicalDeviceGroups = icd_term->dispatch.EnumeratePhysicalDeviceGroups;
         }
 
-        cur_icd_group_count = 0;
         if (NULL == fpEnumeratePhysicalDeviceGroups) {
             // Treat each ICD's GPU as it's own group if the extension isn't supported
             res = icd_term->dispatch.EnumeratePhysicalDevices(icd_term->instance, &cur_icd_group_count, NULL);
@@ -6937,7 +6942,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumeratePhysicalDeviceGroups(
                     VkPhysicalDeviceGroupProperties *tmp_group_props =
                         loader_stack_alloc(count_this_time * sizeof(VkPhysicalDeviceGroupProperties));
                     for (uint32_t group = 0; group < count_this_time; group++) {
-                        tmp_group_props[group].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHR;
+                        tmp_group_props[group].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES;
                         uint32_t cur_index = group + cur_icd_group_count;
                         if (*pPhysicalDeviceGroupCount > cur_index) {
                             tmp_group_props[group].pNext = pPhysicalDeviceGroupProperties[cur_index].pNext;
@@ -7059,8 +7064,8 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumeratePhysicalDeviceGroups(
             }
             // If this physical device group isn't in the old buffer, create it
             if (group_properties != NULL && NULL == new_phys_dev_groups[idx]) {
-                new_phys_dev_groups[idx] = (VkPhysicalDeviceGroupPropertiesKHR *)loader_instance_heap_alloc(
-                    inst, sizeof(VkPhysicalDeviceGroupPropertiesKHR), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
+                new_phys_dev_groups[idx] = (VkPhysicalDeviceGroupProperties *)loader_instance_heap_alloc(
+                    inst, sizeof(VkPhysicalDeviceGroupProperties), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
                 if (NULL == new_phys_dev_groups[idx]) {
                     loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0,
                                "terminator_EnumeratePhysicalDeviceGroups:  Failed to allocate physical device group Terminator "
@@ -7070,7 +7075,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumeratePhysicalDeviceGroups(
                     res = VK_ERROR_OUT_OF_HOST_MEMORY;
                     goto out;
                 }
-                memcpy(new_phys_dev_groups[idx], group_properties, sizeof(VkPhysicalDeviceGroupPropertiesKHR));
+                memcpy(new_phys_dev_groups[idx], group_properties, sizeof(VkPhysicalDeviceGroupProperties));
             }
 
             ++idx;
index 656f35bd1f8526424cc4ff543a198e40f032b259..2218289a8d6a10242142ef410e897f07041a0b07 100644 (file)
@@ -4,6 +4,8 @@
  * Copyright (c) 2014-2021 Valve Corporation
  * Copyright (c) 2014-2021 LunarG, Inc.
  * Copyright (C) 2015 Google Inc.
+ * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+ * 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.
@@ -282,8 +284,8 @@ VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceFormatProperties2(VkPhysi
 }
 
 VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceImageFormatProperties2(
-    VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2KHR *pImageFormatInfo,
-    VkImageFormatProperties2KHR *pImageFormatProperties) {
+    VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo,
+    VkImageFormatProperties2 *pImageFormatProperties) {
     struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice;
     struct loader_icd_term *icd_term = phys_dev_term->this_icd_term;
     const struct loader_instance *inst = icd_term->this_instance;
@@ -323,7 +325,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceImageFormatProperties
 
 VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceQueueFamilyProperties2(VkPhysicalDevice physicalDevice,
                                                                               uint32_t *pQueueFamilyPropertyCount,
-                                                                              VkQueueFamilyProperties2KHR *pQueueFamilyProperties) {
+                                                                              VkQueueFamilyProperties2 *pQueueFamilyProperties) {
     struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice;
     struct loader_icd_term *icd_term = phys_dev_term->this_icd_term;
     const struct loader_instance *inst = icd_term->this_instance;
index cc660d63241b92f2599dbabf77d021d34251d21b..f8e24a77ce937943014a5931ca3b05abe5ca7d70 100644 (file)
@@ -4,6 +4,8 @@
  * Copyright (c) 2015-2023 Valve Corporation
  * Copyright (c) 2015-2023 LunarG, Inc.
  * Copyright (C) 2015 Google Inc.
+ * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+ * 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.
@@ -622,14 +624,15 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCr
         }
     }
 
-    // Make sure the application provided API version has 0 for its variant
+    // Make sure the application provided API version has the correct variant
     if (NULL != pCreateInfo->pApplicationInfo) {
         uint32_t variant_version = VK_API_VERSION_VARIANT(pCreateInfo->pApplicationInfo->apiVersion);
-        if (0 != variant_version) {
+        const uint32_t expected_variant = 0;
+        if (expected_variant != variant_version) {
             loader_log(ptr_instance, VULKAN_LOADER_WARN_BIT, 0,
                        "vkCreateInstance: The API Variant specified in pCreateInfo->pApplicationInfo.apiVersion is %d instead of "
-                       "the expected value of 0.",
-                       variant_version);
+                       "the expected value of %d.",
+                       variant_version, expected_variant);
         }
     }
 
@@ -2790,7 +2793,7 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalBufferProper
 }
 
 LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalSemaphoreProperties(
-    VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfoKHR *pExternalSemaphoreInfo,
+    VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo *pExternalSemaphoreInfo,
     VkExternalSemaphoreProperties *pExternalSemaphoreProperties) {
     VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
     if (VK_NULL_HANDLE == unwrapped_phys_dev) {
index afb0f5634ada90b778d28deb157fbc8079883c36..1f804744d514ec6c2270e047c936bf8152519cd9 100644 (file)
@@ -3,6 +3,8 @@
  * Copyright (c) 2015-2022 The Khronos Group Inc.
  * Copyright (c) 2015-2022 Valve Corporation
  * Copyright (c) 2015-2022 LunarG, Inc.
+ * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+ * 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.
@@ -184,10 +186,13 @@ typedef pthread_cond_t loader_platform_thread_cond;
 #define VK_ELAYERS_INFO_RELATIVE_DIR ""
 #define VK_ILAYERS_INFO_RELATIVE_DIR ""
 
-#define VK_DRIVERS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan\\Drivers"
-#define VK_ELAYERS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan\\ExplicitLayers"
-#define VK_ILAYERS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan\\ImplicitLayers"
-#define VK_SETTINGS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan\\LoaderSettings"
+#define VK_VARIANT_REG_STR ""
+#define VK_VARIANT_REG_STR_W L""
+
+#define VK_DRIVERS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan" VK_VARIANT_REG_STR "\\Drivers"
+#define VK_ELAYERS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan" VK_VARIANT_REG_STR "\\ExplicitLayers"
+#define VK_ILAYERS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan" VK_VARIANT_REG_STR "\\ImplicitLayers"
+#define VK_SETTINGS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan" VK_VARIANT_REG_STR "\\LoaderSettings"
 
 #define PRINTF_SIZE_T_SPECIFIER "%Iu"
 
@@ -426,12 +431,12 @@ static inline char *loader_strncpy(char *dest, size_t dest_sz, const char *src,
 static inline const char *LoaderPnpDriverRegistry() {
     BOOL is_wow;
     IsWow64Process(GetCurrentProcess(), &is_wow);
-    return is_wow ? "VulkanDriverNameWow" : "VulkanDriverName";
+    return is_wow ? "Vulkan" VK_VARIANT_REG_STR "DriverNameWow" : "Vulkan" VK_VARIANT_REG_STR "DriverName";
 }
 static inline const wchar_t *LoaderPnpDriverRegistryWide() {
     BOOL is_wow;
     IsWow64Process(GetCurrentProcess(), &is_wow);
-    return is_wow ? L"VulkanDriverNameWow" : L"VulkanDriverName";
+    return is_wow ? L"Vulkan" VK_VARIANT_REG_STR_W L"DriverNameWow" : L"Vulkan" VK_VARIANT_REG_STR_W L"DriverName";
 }
 
 // Get the key for the plug 'n play explicit layer registry
@@ -439,12 +444,12 @@ static inline const wchar_t *LoaderPnpDriverRegistryWide() {
 static inline const char *LoaderPnpELayerRegistry() {
     BOOL is_wow;
     IsWow64Process(GetCurrentProcess(), &is_wow);
-    return is_wow ? "VulkanExplicitLayersWow" : "VulkanExplicitLayers";
+    return is_wow ? "Vulkan" VK_VARIANT_REG_STR "ExplicitLayersWow" : "Vulkan" VK_VARIANT_REG_STR "ExplicitLayers";
 }
 static inline const wchar_t *LoaderPnpELayerRegistryWide() {
     BOOL is_wow;
     IsWow64Process(GetCurrentProcess(), &is_wow);
-    return is_wow ? L"VulkanExplicitLayersWow" : L"VulkanExplicitLayers";
+    return is_wow ? L"Vulkan" VK_VARIANT_REG_STR_W L"ExplicitLayersWow" : L"Vulkan" VK_VARIANT_REG_STR_W L"ExplicitLayers";
 }
 
 // Get the key for the plug 'n play implicit layer registry
@@ -452,12 +457,12 @@ static inline const wchar_t *LoaderPnpELayerRegistryWide() {
 static inline const char *LoaderPnpILayerRegistry() {
     BOOL is_wow;
     IsWow64Process(GetCurrentProcess(), &is_wow);
-    return is_wow ? "VulkanImplicitLayersWow" : "VulkanImplicitLayers";
+    return is_wow ? "Vulkan" VK_VARIANT_REG_STR "ImplicitLayersWow" : "Vulkan" VK_VARIANT_REG_STR "ImplicitLayers";
 }
 static inline const wchar_t *LoaderPnpILayerRegistryWide() {
     BOOL is_wow;
     IsWow64Process(GetCurrentProcess(), &is_wow);
-    return is_wow ? L"VulkanImplicitLayersWow" : L"VulkanImplicitLayers";
+    return is_wow ? L"Vulkan" VK_VARIANT_REG_STR_W L"ImplicitLayersWow" : L"Vulkan" VK_VARIANT_REG_STR_W L"ImplicitLayers";
 }
 
 // File IO
index 4783c81d8c8514c60e11e08eaa8b547ddd948a65..22fe9b2925c9d3dd5f352314742ccb64db0b7abc 100644 (file)
@@ -48,6 +48,8 @@ if (UPDATE_DEPS)
     endif()
     list(APPEND update_dep_command "--config")
     list(APPEND update_dep_command "${_build_type}")
+    list(APPEND update_dep_command "--api")
+    list(APPEND update_dep_command "${API_TYPE}")
 
     set(UPDATE_DEPS_DIR_SUFFIX "${_build_type}")
     if (CMAKE_CROSSCOMPILING)
index 5a7b65c7ac5f2b1b74a3bbba85c5ba7cbbde7cf8..e301ff43f4516451f65b4ce582f9050694815338 100755 (executable)
@@ -3,6 +3,8 @@
 # Copyright (c) 2019 Valve Corporation
 # Copyright (c) 2019 LunarG, Inc.
 # Copyright (c) 2019 Google Inc.
+# Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# 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.
@@ -32,6 +34,10 @@ import re
 def main(argv):
     parser = argparse.ArgumentParser(description='Generate source code for this repository')
     parser.add_argument('registry', metavar='REGISTRY_PATH', help='path to the Vulkan-Headers registry directory')
+    parser.add_argument('--api',
+                        default='vulkan',
+                        choices=['vulkan'],
+                        help='Specify API name to generate')
     parser.add_argument('--generated-version', help='sets the header version used to generate the repo')
     group = parser.add_mutually_exclusive_group()
     group.add_argument('-i', '--incremental', action='store_true', help='only update repo files that change')
index 674b813476eaf4b292e4565324a0ae554dc87838..d80af0eac08451e646243a006e00237591aff71f 100644 (file)
@@ -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",
index 9291c7847970646487b1cfe721169b02c1f53b7b..62114f55a2765229b5c7e67f75db5a3ca9153f6a 100644 (file)
@@ -4,6 +4,8 @@
 # Copyright (c) 2015-2022 Valve Corporation
 # Copyright (c) 2015-2022 LunarG, Inc.
 # Copyright (c) 2015-2017 Google Inc.
+# Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# 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.
@@ -103,6 +105,16 @@ PRE_INSTANCE_FUNCTIONS = ['vkEnumerateInstanceExtensionProperties',
                           'vkEnumerateInstanceLayerProperties',
                           'vkEnumerateInstanceVersion']
 
+#
+# API Version
+class APIVersion:
+    def __init__(self, token, apiname = 'Vulkan', supported = True):
+        self.token = token
+        self.constant = token.replace('_VERSION_', '_API_VERSION_')
+        self.number = token[token.find('_VERSION_') + len('_VERSION_'):].replace('_', '.')
+        self.name = f'{apiname} {self.number}'
+        self.supported = supported
+
 #
 # LoaderExtensionGeneratorOptions - subclass of GeneratorOptions.
 class LoaderExtensionGeneratorOptions(GeneratorOptions):
@@ -194,6 +206,8 @@ class LoaderExtensionOutputGenerator(OutputGenerator):
         copyright += ' * Copyright (c) 2015-2022 The Khronos Group Inc.\n'
         copyright += ' * Copyright (c) 2015-2022 Valve Corporation\n'
         copyright += ' * Copyright (c) 2015-2022 LunarG, Inc.\n'
+        copyright += ' * Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n'
+        copyright += ' * Copyright (c) 2023-2023 RasterGrid Kft.\n'
         copyright += ' *\n'
         copyright += ' * Licensed under the Apache License, Version 2.0 (the "License");\n'
         copyright += ' * you may not use this file except in compliance with the License.\n'
@@ -339,6 +353,26 @@ class LoaderExtensionOutputGenerator(OutputGenerator):
             result = str(result).replace('::', '->')
         return result
 
+    #
+    # Returns an APIVersion object corresponding to the specified version token or None
+    def getAPIVersion(self, token):
+        if self.genOpts.apiname == 'vulkansc':
+            if token in ['VK_VERSION_1_0', 'VK_VERSION_1_1', 'VK_VERSION_1_2']:
+                # Vulkan 1.0-1.2 is included in Vulkan SC 1.0
+                token = 'VKSC_VERSION_1_0'
+
+            if token.startswith('VKSC_VERSION_'):
+                return APIVersion(token, 'Vulkan SC', True)
+            elif token.startswith('VK_VERSION_'):
+                # Unsupported Vulkan version
+                return APIVersion(token, 'Vulkan', False)
+            else:
+                return None
+
+        if token.startswith('VK_VERSION_'):
+            return APIVersion(token)
+        return None
+
     #
     # Determine if this API should be ignored or added to the instance or device dispatch table
     def AddCommandToDispatchList(self, extension_name, extension_type, name, cmdinfo, handle_type):
@@ -373,12 +407,17 @@ class LoaderExtensionOutputGenerator(OutputGenerator):
             cmd_params.append(self.CommandParam(type=param_type, name=param_name,
                                                 cdecl=param_cdecl))
 
+        version = self.getAPIVersion(extension_name)
+        if version and not version.supported:
+            # Skip commands in unsupported versions
+            return
+
         if handle is not None and handle_type != 'VkInstance' and handle_type != 'VkPhysicalDevice':
             # The Core Vulkan code will be wrapped in a feature called VK_VERSION_#_#
             # For example: VK_VERSION_1_0 wraps the core 1.0 Vulkan functionality
-            if 'VK_VERSION_' in extension_name:
+            if version:
                 self.core_commands.append(
-                    self.CommandData(name=name, ext_name=extension_name,
+                    self.CommandData(name=name, ext_name=version.token,
                                      ext_type='device',
                                      require=require,
                                      protect=self.featureExtraProtect,
@@ -400,9 +439,9 @@ class LoaderExtensionOutputGenerator(OutputGenerator):
         else:
             # The Core Vulkan code will be wrapped in a feature called VK_VERSION_#_#
             # For example: VK_VERSION_1_0 wraps the core 1.0 Vulkan functionality
-            if 'VK_VERSION_' in extension_name:
+            if version:
                 self.core_commands.append(
-                    self.CommandData(name=name, ext_name=extension_name,
+                    self.CommandData(name=name, ext_name=version.token,
                                      ext_type='instance',
                                      require=require,
                                      protect=self.featureExtraProtect,
@@ -535,12 +574,13 @@ class LoaderExtensionOutputGenerator(OutputGenerator):
                 commands = self.ext_commands
 
             for cur_cmd in commands:
+                version = self.getAPIVersion(cur_cmd.ext_name)
                 is_inst_handle_type = cur_cmd.name in ADD_INST_CMDS or cur_cmd.handle_type == 'VkInstance' or cur_cmd.handle_type == 'VkPhysicalDevice'
                 if is_inst_handle_type:
 
                     if cur_cmd.ext_name != cur_extension_name:
-                        if 'VK_VERSION_' in cur_cmd.ext_name:
-                            table += '\n    // ---- Core %s commands\n' % cur_cmd.ext_name[11:]
+                        if version:
+                            table += '\n    // ---- Core %s commands\n' % version.name
                         else:
                             table += '\n    // ---- %s extension commands\n' % cur_cmd.ext_name
                         cur_extension_name = cur_cmd.ext_name
@@ -578,12 +618,13 @@ class LoaderExtensionOutputGenerator(OutputGenerator):
                 commands = self.ext_commands
 
             for cur_cmd in commands:
+                version = self.getAPIVersion(cur_cmd.ext_name)
                 is_inst_handle_type = cur_cmd.name in ADD_INST_CMDS or cur_cmd.handle_type == 'VkInstance' or cur_cmd.handle_type == 'VkPhysicalDevice'
                 if not is_inst_handle_type:
 
                     if cur_cmd.ext_name != cur_extension_name:
-                        if 'VK_VERSION_' in cur_cmd.ext_name:
-                            table += '\n    // ---- Core %s commands\n' % cur_cmd.ext_name[11:]
+                        if version:
+                            table += '\n    // ---- Core %s commands\n' % version.name
                         else:
                             table += '\n    // ---- %s extension commands\n' % cur_cmd.ext_name
                         cur_extension_name = cur_cmd.ext_name
@@ -629,10 +670,11 @@ class LoaderExtensionOutputGenerator(OutputGenerator):
                 commands = self.ext_commands
 
             for cur_cmd in commands:
+                version = self.getAPIVersion(cur_cmd.ext_name)
                 if (self.ShouldPrintInIcdDispatchTable(cur_cmd, skip_commands)):
                     if cur_cmd.ext_name != cur_extension_name:
-                        if 'VK_VERSION_' in cur_cmd.ext_name:
-                            table += '\n    // ---- Core %s commands\n' % cur_cmd.ext_name[11:]
+                        if version:
+                            table += '\n    // ---- Core %s commands\n' % version.name
                         else:
                             table += '\n    // ---- %s extension commands\n' % cur_cmd.ext_name
                         cur_extension_name = cur_cmd.ext_name
@@ -691,12 +733,13 @@ class LoaderExtensionOutputGenerator(OutputGenerator):
 
             required = False
             for cur_cmd in commands:
+                version = self.getAPIVersion(cur_cmd.ext_name)
                 if (self.ShouldPrintInIcdDispatchTable(cur_cmd, skip_gipa_commands)):
 
                     if cur_cmd.ext_name != cur_extension_name:
-                        if 'VK_VERSION_' in cur_cmd.ext_name:
-                            table += '\n    // ---- Core %s\n' % cur_cmd.ext_name[11:]
-                            required = cur_cmd.ext_name == 'VK_VERSION_1_0'
+                        if version:
+                            table += '\n    // ---- Core %s\n' % version.name
+                            required = version.number == '1.0'
                         else:
                             table += '\n    // ---- %s extension commands\n' % cur_cmd.ext_name
                             required = False
@@ -733,7 +776,7 @@ class LoaderExtensionOutputGenerator(OutputGenerator):
         union = ''
         union += 'struct loader_instance_extension_enables {\n'
         for ext in extensions:
-            if ('VK_VERSION_' in ext.name or ext.name in WSI_EXT_NAMES or
+            if (self.getAPIVersion(ext.name) or ext.name in WSI_EXT_NAMES or
                 ext.type == 'device' or ext.num_commands == 0):
                 continue
 
@@ -825,11 +868,12 @@ class LoaderExtensionOutputGenerator(OutputGenerator):
                 tables += '                                                                        VkInstance inst) {\n'
 
             for cur_cmd in commands:
+                version = self.getAPIVersion(cur_cmd.ext_name)
                 is_inst_handle_type = cur_cmd.handle_type == 'VkInstance' or cur_cmd.handle_type == 'VkPhysicalDevice'
                 if ((cur_type == 'instance' and is_inst_handle_type) or (cur_type == 'device' and not is_inst_handle_type)):
                     if cur_cmd.ext_name != cur_extension_name:
-                        if 'VK_VERSION_' in cur_cmd.ext_name:
-                            tables += '\n    // ---- Core %s commands\n' % cur_cmd.ext_name[11:]
+                        if version:
+                            tables += '\n    // ---- Core %s commands\n' % version.name
                         else:
                             tables += '\n    // ---- %s extension commands\n' % cur_cmd.ext_name
                         cur_extension_name = cur_cmd.ext_name
@@ -917,13 +961,14 @@ class LoaderExtensionOutputGenerator(OutputGenerator):
                     commands = self.ext_commands
 
                 for cur_cmd in commands:
+                    version = self.getAPIVersion(cur_cmd.ext_name)
                     is_inst_handle_type = cur_cmd.handle_type == 'VkInstance' or cur_cmd.handle_type == 'VkPhysicalDevice'
                     if ((cur_type == 'instance' and is_inst_handle_type) or (cur_type == 'device' and not is_inst_handle_type)):
                         if cur_cmd.ext_name != cur_extension_name:
-                            if 'VK_VERSION_' in cur_cmd.ext_name:
-                                tables += '\n    // ---- Core %s commands\n' % cur_cmd.ext_name[11:]
+                            if version:
+                                tables += '\n    // ---- Core %s commands\n' % version.name
                                 if cur_type == 'device':
-                                    version_check = f'        if (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_{cur_cmd.ext_name[11:]}) return NULL;\n'
+                                    version_check = f'        if (dev->should_ignore_device_commands_from_newer_version && api_version < {version.constant}) return NULL;\n'
                             else:
 
                                 tables += '\n    // ---- %s extension commands\n' % cur_cmd.ext_name
@@ -1006,9 +1051,10 @@ class LoaderExtensionOutputGenerator(OutputGenerator):
                 ext_cmd.name in manual_ext_commands):
                 continue
 
+            version = self.getAPIVersion(ext_cmd.ext_name)
             if ext_cmd.ext_name != cur_extension_name:
-                if 'VK_VERSION_' in ext_cmd.ext_name:
-                    funcs += '\n// ---- Core %s trampoline/terminators\n\n' % ext_cmd.ext_name[11:]
+                if version:
+                    funcs += '\n// ---- Core %s trampoline/terminators\n\n' % version.name
                 else:
                     funcs += '\n// ---- %s extension trampoline/terminators\n\n' % ext_cmd.ext_name
                 cur_extension_name = ext_cmd.ext_name
@@ -1395,7 +1441,7 @@ class LoaderExtensionOutputGenerator(OutputGenerator):
         gpa_func += '    *addr = NULL;\n\n'
 
         for cur_cmd in self.ext_commands:
-            if ('VK_VERSION_' in cur_cmd.ext_name or
+            if (self.getAPIVersion(cur_cmd.ext_name) or
                 cur_cmd.ext_name in WSI_EXT_NAMES or
                 cur_cmd.ext_name in AVOID_EXT_NAMES or
                 cur_cmd.name in AVOID_CMD_NAMES ):
@@ -1447,7 +1493,7 @@ class LoaderExtensionOutputGenerator(OutputGenerator):
         create_func += 'void extensions_create_instance(struct loader_instance *ptr_instance, const VkInstanceCreateInfo *pCreateInfo) {\n'
         create_func += '    for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) {\n'
         for ext in entries:
-            if ('VK_VERSION_' in ext.name or ext.name in WSI_EXT_NAMES or
+            if (self.getAPIVersion(ext.name) or ext.name in WSI_EXT_NAMES or
                 ext.name in AVOID_EXT_NAMES or ext.name in AVOID_CMD_NAMES or
                 ext.type == 'device' or ext.num_commands == 0):
                 continue
@@ -1496,9 +1542,10 @@ class LoaderExtensionOutputGenerator(OutputGenerator):
         last_protect = None
         last_ext = None
         for ext_cmd in self.ext_commands:
+            version = self.getAPIVersion(ext_cmd.ext_name)
             if ext_cmd.name in DEVICE_CMDS_NEED_TERM:
-                if 'VK_VERSION_' in ext_cmd.ext_name:
-                    term_func += f'    // ---- Core {ext_cmd.ext_name[11:]} commands\n'
+                if version:
+                    term_func += f'    // ---- Core {version.name} commands\n'
                 else:
                     last_protect = ext_cmd.protect
                     if ext_cmd.protect is not None:
@@ -1535,9 +1582,10 @@ class LoaderExtensionOutputGenerator(OutputGenerator):
         last_protect = None
         last_ext = None
         for ext_cmd in self.ext_commands:
+            version = self.getAPIVersion(ext_cmd.ext_name)
             if ext_cmd.name in DEVICE_CMDS_NEED_TERM:
-                if 'VK_VERSION_' in ext_cmd.ext_name:
-                    term_func += f'    // ---- Core {ext_cmd.ext_name[11:]} commands\n'
+                if version:
+                    term_func += f'    // ---- Core {version.name} commands\n'
                 else:
                     last_protect = ext_cmd.protect
                     if ext_cmd.protect is not None:
@@ -1562,9 +1610,10 @@ class LoaderExtensionOutputGenerator(OutputGenerator):
         last_protect = None
         last_ext = None
         for ext_cmd in self.ext_commands:
+            version = self.getAPIVersion(ext_cmd.ext_name)
             if ext_cmd.name in DEVICE_CMDS_MUST_USE_TRAMP:
-                if 'VK_VERSION_' in ext_cmd.ext_name:
-                    tramp_protos += f'    // ---- Core {ext_cmd.ext_name[11:]} commands\n'
+                if version:
+                    tramp_protos += f'    // ---- Core {version.name} commands\n'
                 else:
                     last_protect = ext_cmd.protect
                     if ext_cmd.protect is not None:
@@ -1594,9 +1643,10 @@ class LoaderExtensionOutputGenerator(OutputGenerator):
         last_protect = None
         last_ext = None
         for ext_cmd in self.ext_commands:
+            version = self.getAPIVersion(ext_cmd.ext_name)
             if ext_cmd.name in DEVICE_CMDS_NEED_TERM:
-                if 'VK_VERSION_' in ext_cmd.ext_name:
-                    term_func += f'    // ---- Core {ext_cmd.ext_name[11:]} commands\n'
+                if version:
+                    term_func += f'    // ---- Core {version.name} commands\n'
                 else:
                     last_protect = ext_cmd.protect
                     if ext_cmd.protect is not None:
@@ -1640,11 +1690,11 @@ class LoaderExtensionOutputGenerator(OutputGenerator):
                 commands = self.ext_commands
 
             for cur_cmd in commands:
-
+                version = self.getAPIVersion(cur_cmd.ext_name)
                 if cur_cmd.handle_type == 'VkInstance' or cur_cmd.handle_type == 'VkPhysicalDevice':
                     if cur_cmd.ext_name != cur_extension_name:
-                        if 'VK_VERSION_' in cur_cmd.ext_name:
-                            table += '\n    // ---- Core %s commands\n' % cur_cmd.ext_name[11:]
+                        if version:
+                            table += '\n    // ---- Core %s commands\n' % version.name
                         else:
                             table += '\n    // ---- %s extension commands\n' % cur_cmd.ext_name
                         cur_extension_name = cur_cmd.ext_name
@@ -1685,7 +1735,7 @@ class LoaderExtensionOutputGenerator(OutputGenerator):
         table += '// before passing the list of extensions to the application.\n'
         table += 'const char *const LOADER_INSTANCE_EXTENSIONS[] = {\n'
         for ext in extensions:
-            if ext.type == 'device' or 'VK_VERSION_' in ext.name:
+            if ext.type == 'device' or self.getAPIVersion(ext.name):
                 continue
 
             if ext.protect is not None:
index 3489599a20ac432d5f64949551e619516b867d7e..1cdd6d88944198f092e7c28de6124818c4a34b51 100644 (file)
@@ -1,6 +1,8 @@
 #!/usr/bin/python3
 #
 # Copyright (c) 2013-2019 The Khronos Group Inc.
+# Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# 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.
@@ -47,8 +49,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
@@ -126,11 +134,11 @@ def makeGenOpts(args):
             filename          = 'vk_dispatch_table_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,
@@ -150,11 +158,11 @@ def makeGenOpts(args):
             filename          = 'vk_layer_dispatch_table.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,
@@ -174,11 +182,11 @@ def makeGenOpts(args):
             filename          = 'vk_loader_extensions.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,
@@ -198,11 +206,11 @@ def makeGenOpts(args):
             filename          = 'vk_loader_extensions.c',
             directory         = directory,
             genpath           = None,
-            apiname           = 'vulkan',
+            apiname           = apiname,
             profile           = None,
             versions          = featuresPat,
             emitversions      = featuresPat,
-            defaultExtensions = 'vulkan',
+            defaultExtensions = defaultExtensions,
             addExtensions     = addExtensionsPat,
             removeExtensions  = removeExtensionsPat,
             emitExtensions    = emitExtensionsPat,
@@ -222,11 +230,11 @@ def makeGenOpts(args):
             filename          = 'vk_object_types.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,
@@ -262,6 +270,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)
@@ -286,8 +295,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'],
+                        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('-extension', action='append',
                         default=[],
index d3eb0aa7ce1a2228479acae51faf5abd84e911da..a8cf1b24f560cbcee7bdac8c67cd0d8f719a3f02 100644 (file)
@@ -2,6 +2,8 @@
  * Copyright (c) 2021-2023 The Khronos Group Inc.
  * Copyright (c) 2021-2023 Valve Corporation
  * Copyright (c) 2021-2023 LunarG, Inc.
+ * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+ * Copyright (c) 2023-2023 RasterGrid Kft.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and/or associated documentation files (the "Materials"), to
@@ -831,16 +833,7 @@ VKAPI_ATTR VkResult VKAPI_CALL test_vkGetDisplayPlaneCapabilitiesKHR(VkPhysicalD
 VKAPI_ATTR VkResult VKAPI_CALL test_vkCreateDisplayPlaneSurfaceKHR(
     [[maybe_unused]] VkInstance instance, [[maybe_unused]] const VkDisplaySurfaceCreateInfoKHR* pCreateInfo,
     [[maybe_unused]] const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface) {
-    if (nullptr != pSurface) {
-        uint64_t fake_surf_handle = reinterpret_cast<uint64_t>(new uint8_t);
-        icd.surface_handles.push_back(fake_surf_handle);
-#if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__)) || defined(_M_X64) || defined(__ia64) || \
-    defined(_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
-        *pSurface = reinterpret_cast<VkSurfaceKHR>(fake_surf_handle);
-#else
-        *pSurface = fake_surf_handle;
-#endif
-    }
+    common_nondispatch_handle_creation(icd.surface_handles, pSurface);
     return VK_SUCCESS;
 }
 
index 52607f95d3b05123ed1c20d37e9eea0d89b1fefa..a3a515ac7ae73c46f1c9f354e97c0927f896e8b8 100644 (file)
@@ -49,6 +49,14 @@ enum class ManifestCategory { implicit_layer, explicit_layer, icd, settings };
 enum class GpuType { unspecified, integrated, discrete, external };
 
 #if defined(WIN32)
+#define VK_VARIANT_REG_STR ""
+#define VK_VARIANT_REG_STR_W L""
+
+#define VK_DRIVERS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan" VK_VARIANT_REG_STR "\\Drivers"
+#define VK_ELAYERS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan" VK_VARIANT_REG_STR "\\ExplicitLayers"
+#define VK_ILAYERS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan" VK_VARIANT_REG_STR "\\ImplicitLayers"
+#define VK_SETTINGS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\Vulkan" VK_VARIANT_REG_STR "\\LoaderSettings"
+
 struct RegistryEntry {
     RegistryEntry() = default;
     RegistryEntry(std::string const& name) noexcept : name(name) {}
index 65575c3cd2b12b63718d6457f72c99c9f152e5a5..8a896c1eeb4d13a8fc3a61b86c41529453278ef5 100644 (file)
@@ -82,11 +82,11 @@ NTSTATUS APIENTRY ShimQueryAdapterInfo(const LoaderQueryAdapterInfo *query_info)
     auto *reg_info = reinterpret_cast<LoaderQueryRegistryInfo *>(query_info->private_data);
 
     std::vector<std::wstring> *paths = nullptr;
-    if (reg_info->value_name[6] == L'D') {  // looking for drivers
+    if (wcsstr(reg_info->value_name, L"DriverName") != nullptr) {  // looking for drivers
         paths = &adapter.driver_paths;
-    } else if (reg_info->value_name[6] == L'I') {  // looking for implicit layers
+    } else if (wcsstr(reg_info->value_name, L"ImplicitLayers") != nullptr) {  // looking for implicit layers
         paths = &adapter.implicit_layer_paths;
-    } else if (reg_info->value_name[6] == L'E') {  // looking for explicit layers
+    } else if (wcsstr(reg_info->value_name, L"ExplicitLayers") != nullptr) {  // looking for explicit layers
         paths = &adapter.explicit_layer_paths;
     }
 
@@ -300,17 +300,13 @@ const std::string *get_path_of_created_key(HKEY hKey) {
     return nullptr;
 }
 std::vector<RegistryEntry> *get_registry_vector(std::string const &path) {
-    if (path == "HKEY_LOCAL_MACHINE\\SOFTWARE\\Khronos\\Vulkan\\Drivers") return &platform_shim.hkey_local_machine_drivers;
-    if (path == "HKEY_LOCAL_MACHINE\\SOFTWARE\\Khronos\\Vulkan\\ExplicitLayers")
-        return &platform_shim.hkey_local_machine_explicit_layers;
-    if (path == "HKEY_LOCAL_MACHINE\\SOFTWARE\\Khronos\\Vulkan\\ImplicitLayers")
-        return &platform_shim.hkey_local_machine_implicit_layers;
-    if (path == "HKEY_CURRENT_USER\\SOFTWARE\\Khronos\\Vulkan\\ExplicitLayers")
-        return &platform_shim.hkey_current_user_explicit_layers;
-    if (path == "HKEY_CURRENT_USER\\SOFTWARE\\Khronos\\Vulkan\\ImplicitLayers")
-        return &platform_shim.hkey_current_user_implicit_layers;
-    if (path == "HKEY_LOCAL_MACHINE\\SOFTWARE\\Khronos\\Vulkan\\LoaderSettings") return &platform_shim.hkey_local_machine_settings;
-    if (path == "HKEY_CURRENT_USER\\SOFTWARE\\Khronos\\Vulkan\\LoaderSettings") return &platform_shim.hkey_current_user_settings;
+    if (path == "HKEY_LOCAL_MACHINE\\" VK_DRIVERS_INFO_REGISTRY_LOC) return &platform_shim.hkey_local_machine_drivers;
+    if (path == "HKEY_LOCAL_MACHINE\\" VK_ELAYERS_INFO_REGISTRY_LOC) return &platform_shim.hkey_local_machine_explicit_layers;
+    if (path == "HKEY_LOCAL_MACHINE\\" VK_ILAYERS_INFO_REGISTRY_LOC) return &platform_shim.hkey_local_machine_implicit_layers;
+    if (path == "HKEY_CURRENT_USER\\" VK_ELAYERS_INFO_REGISTRY_LOC) return &platform_shim.hkey_current_user_explicit_layers;
+    if (path == "HKEY_CURRENT_USER\\" VK_ILAYERS_INFO_REGISTRY_LOC) return &platform_shim.hkey_current_user_implicit_layers;
+    if (path == "HKEY_LOCAL_MACHINE\\" VK_SETTINGS_INFO_REGISTRY_LOC) return &platform_shim.hkey_local_machine_settings;
+    if (path == "HKEY_CURRENT_USER\\" VK_SETTINGS_INFO_REGISTRY_LOC) return &platform_shim.hkey_current_user_settings;
     return nullptr;
 }
 LSTATUS __stdcall ShimRegQueryValueExA(HKEY, LPCSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD) {
index 24cb303bef2aebee1f150aa3e7d4b44367cf721c..7154393f947e0327ee9c98fe98df252c3e43271f 100644 (file)
@@ -803,7 +803,7 @@ TEST(LoaderHandleValidTests, BadPhysDevGetPhysDevExternSemaphoreProps) {
 
     auto bad_physical_dev = get_bad_handle<VkPhysicalDevice>();
 
-    VkPhysicalDeviceExternalSemaphoreInfoKHR info = {};
+    VkPhysicalDeviceExternalSemaphoreInfo info = {};
     info.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO;
     info.pNext = nullptr;
     VkExternalSemaphoreProperties props = {};
index 0a718cea6410e15b238a2f4071f3041893575868..407d8093e144a12efe91e7a34864e673c41db28e 100644 (file)
@@ -2,6 +2,8 @@
  * Copyright (c) 2021-2023 The Khronos Group Inc.
  * Copyright (c) 2021-2023 Valve Corporation
  * Copyright (c) 2021-2023 LunarG, Inc.
+ * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+ * Copyright (c) 2023-2023 RasterGrid Kft.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and/or associated documentation files (the "Materials"), to
@@ -1657,7 +1659,7 @@ TEST(EnumeratePhysicalDeviceGroups, OneCall) {
             ASSERT_EQ(true, found[dev]);
         }
         for (auto& group : group_props) {
-            VkDeviceGroupDeviceCreateInfoKHR group_info{};
+            VkDeviceGroupDeviceCreateInfo group_info{};
             group_info.sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO;
             group_info.physicalDeviceCount = group.physicalDeviceCount;
             group_info.pPhysicalDevices = &group.physicalDevices[0];
@@ -1675,7 +1677,7 @@ TEST(EnumeratePhysicalDeviceGroups, OneCall) {
             const VkBaseInStructure* pNext = reinterpret_cast<const VkBaseInStructure*>(dev.create_info.dev.pNext);
             while (pNext != nullptr) {
                 if (pNext->sType == VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO) {
-                    ASSERT_EQ(&group_info, reinterpret_cast<const VkDeviceGroupDeviceCreateInfoKHR*>(pNext));
+                    ASSERT_EQ(&group_info, reinterpret_cast<const VkDeviceGroupDeviceCreateInfo*>(pNext));
                 }
                 if (pNext->sType == 100000) {
                     ASSERT_EQ(&spacer_structure, pNext);
@@ -1702,8 +1704,8 @@ TEST(EnumeratePhysicalDeviceGroups, OneCall) {
 
         uint32_t group_count = static_cast<uint32_t>(driver.physical_device_groups.size());
         uint32_t returned_group_count = group_count;
-        std::vector<VkPhysicalDeviceGroupPropertiesKHR> group_props{};
-        group_props.resize(group_count, VkPhysicalDeviceGroupPropertiesKHR{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHR});
+        std::vector<VkPhysicalDeviceGroupProperties> group_props{};
+        group_props.resize(group_count, VkPhysicalDeviceGroupProperties{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES});
         ASSERT_EQ(VK_SUCCESS, vkEnumeratePhysicalDeviceGroupsKHR(inst, &returned_group_count, group_props.data()));
         ASSERT_EQ(group_count, returned_group_count);
 
@@ -1724,7 +1726,7 @@ TEST(EnumeratePhysicalDeviceGroups, OneCall) {
             ASSERT_EQ(true, found[dev]);
         }
         for (auto& group : group_props) {
-            VkDeviceGroupDeviceCreateInfoKHR group_info{};
+            VkDeviceGroupDeviceCreateInfo group_info{};
             group_info.sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO;
             group_info.physicalDeviceCount = group.physicalDeviceCount;
             group_info.pPhysicalDevices = &group.physicalDevices[0];
@@ -1794,7 +1796,7 @@ TEST(EnumeratePhysicalDeviceGroups, TwoCall) {
             ASSERT_EQ(true, found[dev]);
         }
         for (auto& group : group_props) {
-            VkDeviceGroupDeviceCreateInfoKHR group_info{};
+            VkDeviceGroupDeviceCreateInfo group_info{};
             group_info.sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO;
             group_info.physicalDeviceCount = group.physicalDeviceCount;
             group_info.pPhysicalDevices = &group.physicalDevices[0];
@@ -1822,8 +1824,8 @@ TEST(EnumeratePhysicalDeviceGroups, TwoCall) {
         ASSERT_EQ(VK_SUCCESS, vkEnumeratePhysicalDeviceGroupsKHR(inst, &returned_group_count, nullptr));
         ASSERT_EQ(group_count, returned_group_count);
 
-        std::vector<VkPhysicalDeviceGroupPropertiesKHR> group_props{};
-        group_props.resize(group_count, VkPhysicalDeviceGroupPropertiesKHR{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHR});
+        std::vector<VkPhysicalDeviceGroupProperties> group_props{};
+        group_props.resize(group_count, VkPhysicalDeviceGroupProperties{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES});
         ASSERT_EQ(VK_SUCCESS, vkEnumeratePhysicalDeviceGroupsKHR(inst, &returned_group_count, group_props.data()));
         ASSERT_EQ(group_count, returned_group_count);
 
@@ -1844,7 +1846,7 @@ TEST(EnumeratePhysicalDeviceGroups, TwoCall) {
             ASSERT_EQ(true, found[dev]);
         }
         for (auto& group : group_props) {
-            VkDeviceGroupDeviceCreateInfoKHR group_info{};
+            VkDeviceGroupDeviceCreateInfo group_info{};
             group_info.sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO;
             group_info.physicalDeviceCount = group.physicalDeviceCount;
             group_info.pPhysicalDevices = &group.physicalDevices[0];
@@ -1910,7 +1912,7 @@ TEST(EnumeratePhysicalDeviceGroups, TwoCallIncomplete) {
             ASSERT_EQ(true, found);
         }
         for (auto& group : group_props) {
-            VkDeviceGroupDeviceCreateInfoKHR group_info{};
+            VkDeviceGroupDeviceCreateInfo group_info{};
             group_info.sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO;
             group_info.physicalDeviceCount = group.physicalDeviceCount;
             group_info.pPhysicalDevices = &group.physicalDevices[0];
@@ -1934,13 +1936,13 @@ TEST(EnumeratePhysicalDeviceGroups, TwoCallIncomplete) {
         ASSERT_EQ(group_count, returned_group_count);
 
         returned_group_count = 1;
-        std::array<VkPhysicalDeviceGroupPropertiesKHR, 1> group_props{};
+        std::array<VkPhysicalDeviceGroupProperties, 1> group_props{};
         group_props[0].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES;
         ASSERT_EQ(VK_INCOMPLETE, vkEnumeratePhysicalDeviceGroupsKHR(inst, &returned_group_count, group_props.data()));
         ASSERT_EQ(1U, returned_group_count);
 
         returned_group_count = 2;
-        std::array<VkPhysicalDeviceGroupPropertiesKHR, 2> group_props_2{};
+        std::array<VkPhysicalDeviceGroupProperties, 2> group_props_2{};
         group_props_2[0].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES;
         group_props_2[1].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES;
         ASSERT_EQ(VK_SUCCESS, vkEnumeratePhysicalDeviceGroupsKHR(inst, &returned_group_count, group_props_2.data()));
@@ -1960,7 +1962,7 @@ TEST(EnumeratePhysicalDeviceGroups, TwoCallIncomplete) {
             ASSERT_EQ(true, found);
         }
         for (auto& group : group_props) {
-            VkDeviceGroupDeviceCreateInfoKHR group_info{};
+            VkDeviceGroupDeviceCreateInfo group_info{};
             group_info.sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO;
             group_info.physicalDeviceCount = group.physicalDeviceCount;
             group_info.pPhysicalDevices = &group.physicalDevices[0];
@@ -2000,7 +2002,7 @@ TEST(EnumeratePhysicalDeviceGroups, TestCoreVersusExtensionSameReturns) {
     uint32_t core_group_count = 0;
     std::vector<VkPhysicalDeviceGroupProperties> core_group_props{};
     uint32_t ext_group_count = 0;
-    std::vector<VkPhysicalDeviceGroupPropertiesKHR> ext_group_props{};
+    std::vector<VkPhysicalDeviceGroupProperties> ext_group_props{};
 
     InstWrapper inst{env.vulkan_functions};
     inst.create_info.set_api_version(1, 1, 0);
@@ -2026,7 +2028,7 @@ TEST(EnumeratePhysicalDeviceGroups, TestCoreVersusExtensionSameReturns) {
     ASSERT_EQ(ext_group_count, returned_group_count);
 
     ext_group_props.resize(returned_group_count,
-                           VkPhysicalDeviceGroupPropertiesKHR{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHR});
+                           VkPhysicalDeviceGroupProperties{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES});
     ASSERT_EQ(VK_SUCCESS, vkEnumeratePhysicalDeviceGroupsKHR(inst, &returned_group_count, ext_group_props.data()));
     ASSERT_EQ(ext_group_count, returned_group_count);
 
@@ -2051,7 +2053,7 @@ TEST(EnumeratePhysicalDeviceGroups, TestCoreVersusExtensionSameReturns) {
         }
     }
     for (auto& group : core_group_props) {
-        VkDeviceGroupDeviceCreateInfoKHR group_info{};
+        VkDeviceGroupDeviceCreateInfo group_info{};
         group_info.sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO;
         group_info.physicalDeviceCount = group.physicalDeviceCount;
         group_info.pPhysicalDevices = &group.physicalDevices[0];
@@ -2146,7 +2148,7 @@ TEST(EnumeratePhysicalDeviceGroups, CallThriceAddGroupInBetween) {
         }
     }
     for (auto& group : group_props_after) {
-        VkDeviceGroupDeviceCreateInfoKHR group_info{};
+        VkDeviceGroupDeviceCreateInfo group_info{};
         group_info.sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO;
         group_info.physicalDeviceCount = group.physicalDeviceCount;
         group_info.pPhysicalDevices = &group.physicalDevices[0];
@@ -2233,7 +2235,7 @@ TEST(EnumeratePhysicalDeviceGroups, CallTwiceRemoveGroupInBetween) {
         }
     }
     for (auto& group : group_props_after) {
-        VkDeviceGroupDeviceCreateInfoKHR group_info{};
+        VkDeviceGroupDeviceCreateInfo group_info{};
         group_info.sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO;
         group_info.physicalDeviceCount = group.physicalDeviceCount;
         group_info.pPhysicalDevices = &group.physicalDevices[0];
@@ -2319,7 +2321,7 @@ TEST(EnumeratePhysicalDeviceGroups, CallTwiceAddDeviceInBetween) {
         }
     }
     for (auto& group : group_props_after) {
-        VkDeviceGroupDeviceCreateInfoKHR group_info{};
+        VkDeviceGroupDeviceCreateInfo group_info{};
         group_info.sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO;
         group_info.physicalDeviceCount = group.physicalDeviceCount;
         group_info.pPhysicalDevices = &group.physicalDevices[0];
@@ -2416,7 +2418,7 @@ TEST(EnumeratePhysicalDeviceGroups, CallTwiceRemoveDeviceInBetween) {
         }
     }
     for (auto& group : group_props_after) {
-        VkDeviceGroupDeviceCreateInfoKHR group_info{};
+        VkDeviceGroupDeviceCreateInfo group_info{};
         group_info.sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO;
         group_info.physicalDeviceCount = group.physicalDeviceCount;
         group_info.pPhysicalDevices = &group.physicalDevices[0];
@@ -2534,7 +2536,7 @@ TEST(EnumeratePhysicalDeviceGroups, MultipleAddRemoves) {
         ASSERT_EQ(group_props_after_add_device[group].physicalDeviceCount, after_add_dev_expected_counts[group]);
     }
     for (auto& group : group_props_after_add_device) {
-        VkDeviceGroupDeviceCreateInfoKHR group_info{};
+        VkDeviceGroupDeviceCreateInfo group_info{};
         group_info.sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO;
         group_info.physicalDeviceCount = group.physicalDeviceCount;
         group_info.pPhysicalDevices = &group.physicalDevices[0];
@@ -3850,9 +3852,9 @@ TEST(DuplicateRegistryEntries, Drivers) {
     InstWrapper inst{env.vulkan_functions};
     FillDebugUtilsCreateDetails(inst.create_info, env.debug_log);
     inst.CheckCreate();
-    ASSERT_TRUE(env.debug_log.find(
-        std::string("Skipping adding of json file \"") + null_path.str() +
-        "\" from registry \"HKEY_LOCAL_MACHINE\\SOFTWARE\\Khronos\\Vulkan\\Drivers\" to the list due to duplication"));
+    ASSERT_TRUE(env.debug_log.find(std::string("Skipping adding of json file \"") + null_path.str() +
+                                   "\" from registry \"HKEY_LOCAL_MACHINE\\" VK_DRIVERS_INFO_REGISTRY_LOC
+                                   "\" to the list due to duplication"));
 }
 #endif