forked from KhronosGroup/Vulkan-Loader
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor codegen scripts to use vulkan_object.py
Requires hardcoding a few things to make it work, most notably: * Missing Extension Requires Depends information * Missing aliases for handles On the whole, the codegen outputs *almost* identical files from before, making the refactor not able to introduce issues into the output. The changes that do occur to remove duplicated if statements from aliased handles or for comments and whitespace.
- Loading branch information
1 parent
809941a
commit 99f2462
Showing
9 changed files
with
1,590 additions
and
2,390 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,9 @@ | |
// See loader_extension_generator.py for modifications | ||
|
||
/* | ||
* Copyright (c) 2015-2022 The Khronos Group Inc. | ||
* Copyright (c) 2015-2022 Valve Corporation | ||
* Copyright (c) 2015-2022 LunarG, Inc. | ||
* Copyright (c) 2015-2025 The Khronos Group Inc. | ||
* Copyright (c) 2015-2025 Valve Corporation | ||
* Copyright (c) 2015-2025 LunarG, Inc. | ||
* Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
* Copyright (c) 2023-2023 RasterGrid Kft. | ||
* | ||
|
@@ -22,6 +22,7 @@ | |
* | ||
* Author: Mark Lobodzinski <[email protected]> | ||
* Author: Mark Young <[email protected]> | ||
* Author: Charles Giessen <[email protected]> | ||
*/ | ||
|
||
// clang-format off | ||
|
@@ -858,7 +859,11 @@ typedef struct VkLayerDispatchTable_ { | |
PFN_vkCmdCopyAccelerationStructureNV CmdCopyAccelerationStructureNV; | ||
PFN_vkCmdTraceRaysNV CmdTraceRaysNV; | ||
PFN_vkCreateRayTracingPipelinesNV CreateRayTracingPipelinesNV; | ||
|
||
// ---- VK_KHR_ray_tracing_pipeline extension commands | ||
PFN_vkGetRayTracingShaderGroupHandlesKHR GetRayTracingShaderGroupHandlesKHR; | ||
|
||
// ---- VK_NV_ray_tracing extension commands | ||
PFN_vkGetRayTracingShaderGroupHandlesNV GetRayTracingShaderGroupHandlesNV; | ||
PFN_vkGetAccelerationStructureHandleNV GetAccelerationStructureHandleNV; | ||
PFN_vkCmdWriteAccelerationStructuresPropertiesNV CmdWriteAccelerationStructuresPropertiesNV; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,9 @@ | |
// See loader_extension_generator.py for modifications | ||
|
||
/* | ||
* Copyright (c) 2015-2022 The Khronos Group Inc. | ||
* Copyright (c) 2015-2022 Valve Corporation | ||
* Copyright (c) 2015-2022 LunarG, Inc. | ||
* Copyright (c) 2015-2025 The Khronos Group Inc. | ||
* Copyright (c) 2015-2025 Valve Corporation | ||
* Copyright (c) 2015-2025 LunarG, Inc. | ||
* Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
* Copyright (c) 2023-2023 RasterGrid Kft. | ||
* | ||
|
@@ -22,6 +22,7 @@ | |
* | ||
* Author: Mark Lobodzinski <[email protected]> | ||
* Author: Mark Young <[email protected]> | ||
* Author: Charles Giessen <[email protected]> | ||
*/ | ||
|
||
// clang-format off | ||
|
@@ -896,7 +897,11 @@ VKAPI_ATTR void VKAPI_CALL loader_init_device_extension_dispatch_table(struct lo | |
table->CmdCopyAccelerationStructureNV = (PFN_vkCmdCopyAccelerationStructureNV)gdpa(dev, "vkCmdCopyAccelerationStructureNV"); | ||
table->CmdTraceRaysNV = (PFN_vkCmdTraceRaysNV)gdpa(dev, "vkCmdTraceRaysNV"); | ||
table->CreateRayTracingPipelinesNV = (PFN_vkCreateRayTracingPipelinesNV)gdpa(dev, "vkCreateRayTracingPipelinesNV"); | ||
|
||
// ---- VK_KHR_ray_tracing_pipeline extension commands | ||
table->GetRayTracingShaderGroupHandlesKHR = (PFN_vkGetRayTracingShaderGroupHandlesKHR)gdpa(dev, "vkGetRayTracingShaderGroupHandlesKHR"); | ||
|
||
// ---- VK_NV_ray_tracing extension commands | ||
table->GetRayTracingShaderGroupHandlesNV = (PFN_vkGetRayTracingShaderGroupHandlesNV)gdpa(dev, "vkGetRayTracingShaderGroupHandlesNV"); | ||
table->GetAccelerationStructureHandleNV = (PFN_vkGetAccelerationStructureHandleNV)gdpa(dev, "vkGetAccelerationStructureHandleNV"); | ||
table->CmdWriteAccelerationStructuresPropertiesNV = (PFN_vkCmdWriteAccelerationStructuresPropertiesNV)gdpa(dev, "vkCmdWriteAccelerationStructuresPropertiesNV"); | ||
|
@@ -1540,19 +1545,23 @@ VKAPI_ATTR void VKAPI_CALL loader_init_instance_extension_dispatch_table(VkLayer | |
void init_extension_device_proc_terminator_dispatch(struct loader_device *dev) { | ||
struct loader_device_terminator_dispatch* dispatch = &dev->loader_dispatch.extension_terminator_dispatch; | ||
PFN_vkGetDeviceProcAddr gpda = (PFN_vkGetDeviceProcAddr)dev->phys_dev_term->this_icd_term->dispatch.GetDeviceProcAddr; | ||
|
||
// ---- VK_KHR_swapchain extension commands | ||
if (dev->driver_extensions.khr_swapchain_enabled) | ||
dispatch->CreateSwapchainKHR = (PFN_vkCreateSwapchainKHR)gpda(dev->icd_device, "vkCreateSwapchainKHR"); | ||
if (dev->driver_extensions.khr_swapchain_enabled) | ||
dispatch->GetDeviceGroupSurfacePresentModesKHR = (PFN_vkGetDeviceGroupSurfacePresentModesKHR)gpda(dev->icd_device, "vkGetDeviceGroupSurfacePresentModesKHR"); | ||
|
||
// ---- VK_KHR_display_swapchain extension commands | ||
if (dev->driver_extensions.khr_display_swapchain_enabled) | ||
dispatch->CreateSharedSwapchainsKHR = (PFN_vkCreateSharedSwapchainsKHR)gpda(dev->icd_device, "vkCreateSharedSwapchainsKHR"); | ||
|
||
// ---- VK_EXT_debug_marker extension commands | ||
if (dev->driver_extensions.ext_debug_marker_enabled) | ||
dispatch->DebugMarkerSetObjectTagEXT = (PFN_vkDebugMarkerSetObjectTagEXT)gpda(dev->icd_device, "vkDebugMarkerSetObjectTagEXT"); | ||
if (dev->driver_extensions.ext_debug_marker_enabled) | ||
dispatch->DebugMarkerSetObjectNameEXT = (PFN_vkDebugMarkerSetObjectNameEXT)gpda(dev->icd_device, "vkDebugMarkerSetObjectNameEXT"); | ||
|
||
// ---- VK_EXT_debug_utils extension commands | ||
if (dev->driver_extensions.ext_debug_utils_enabled) | ||
dispatch->SetDebugUtilsObjectNameEXT = (PFN_vkSetDebugUtilsObjectNameEXT)gpda(dev->icd_device, "vkSetDebugUtilsObjectNameEXT"); | ||
|
@@ -1571,6 +1580,7 @@ void init_extension_device_proc_terminator_dispatch(struct loader_device *dev) { | |
if (dev->driver_extensions.ext_debug_utils_enabled) | ||
dispatch->CmdInsertDebugUtilsLabelEXT = (PFN_vkCmdInsertDebugUtilsLabelEXT)gpda(dev->icd_device, "vkCmdInsertDebugUtilsLabelEXT"); | ||
#if defined(VK_USE_PLATFORM_WIN32_KHR) | ||
|
||
// ---- VK_EXT_full_screen_exclusive extension commands | ||
if (dev->driver_extensions.ext_full_screen_exclusive_enabled && (dev->driver_extensions.khr_device_group_enabled || dev->driver_extensions.version_1_1_enabled)) | ||
dispatch->GetDeviceGroupSurfacePresentModes2EXT = (PFN_vkGetDeviceGroupSurfacePresentModes2EXT)gpda(dev->icd_device, "vkGetDeviceGroupSurfacePresentModes2EXT"); | ||
|
@@ -1579,13 +1589,15 @@ void init_extension_device_proc_terminator_dispatch(struct loader_device *dev) { | |
|
||
// These are prototypes for functions that need their trampoline called in all circumstances. | ||
// They are used in loader_lookup_device_dispatch_table but are defined afterwards. | ||
|
||
// ---- VK_EXT_debug_marker extension commands | ||
VKAPI_ATTR VkResult VKAPI_CALL DebugMarkerSetObjectTagEXT( | ||
VkDevice device, | ||
const VkDebugMarkerObjectTagInfoEXT* pTagInfo); | ||
VKAPI_ATTR VkResult VKAPI_CALL DebugMarkerSetObjectNameEXT( | ||
VkDevice device, | ||
const VkDebugMarkerObjectNameInfoEXT* pNameInfo); | ||
|
||
// ---- VK_EXT_debug_utils extension commands | ||
VKAPI_ATTR VkResult VKAPI_CALL SetDebugUtilsObjectNameEXT( | ||
VkDevice device, | ||
|
@@ -2778,7 +2790,11 @@ VKAPI_ATTR void* VKAPI_CALL loader_lookup_device_dispatch_table(const VkLayerDis | |
if (!strcmp(name, "CmdCopyAccelerationStructureNV")) return (void *)table->CmdCopyAccelerationStructureNV; | ||
if (!strcmp(name, "CmdTraceRaysNV")) return (void *)table->CmdTraceRaysNV; | ||
if (!strcmp(name, "CreateRayTracingPipelinesNV")) return (void *)table->CreateRayTracingPipelinesNV; | ||
|
||
// ---- VK_KHR_ray_tracing_pipeline extension commands | ||
if (!strcmp(name, "GetRayTracingShaderGroupHandlesKHR")) return (void *)table->GetRayTracingShaderGroupHandlesKHR; | ||
|
||
// ---- VK_NV_ray_tracing extension commands | ||
if (!strcmp(name, "GetRayTracingShaderGroupHandlesNV")) return (void *)table->GetRayTracingShaderGroupHandlesNV; | ||
if (!strcmp(name, "GetAccelerationStructureHandleNV")) return (void *)table->GetAccelerationStructureHandleNV; | ||
if (!strcmp(name, "CmdWriteAccelerationStructuresPropertiesNV")) return (void *)table->CmdWriteAccelerationStructuresPropertiesNV; | ||
|
@@ -6713,6 +6729,9 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateRayTracingPipelinesNV( | |
return disp->CreateRayTracingPipelinesNV(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines); | ||
} | ||
|
||
|
||
// ---- VK_KHR_ray_tracing_pipeline extension trampoline/terminators | ||
|
||
VKAPI_ATTR VkResult VKAPI_CALL GetRayTracingShaderGroupHandlesKHR( | ||
VkDevice device, | ||
VkPipeline pipeline, | ||
|
@@ -6730,6 +6749,9 @@ VKAPI_ATTR VkResult VKAPI_CALL GetRayTracingShaderGroupHandlesKHR( | |
return disp->GetRayTracingShaderGroupHandlesKHR(device, pipeline, firstGroup, groupCount, dataSize, pData); | ||
} | ||
|
||
|
||
// ---- VK_NV_ray_tracing extension trampoline/terminators | ||
|
||
VKAPI_ATTR VkResult VKAPI_CALL GetRayTracingShaderGroupHandlesNV( | ||
VkDevice device, | ||
VkPipeline pipeline, | ||
|
@@ -11467,10 +11489,14 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *na | |
*addr = (void *)CreateRayTracingPipelinesNV; | ||
return true; | ||
} | ||
|
||
// ---- VK_KHR_ray_tracing_pipeline extension commands | ||
if (!strcmp("vkGetRayTracingShaderGroupHandlesKHR", name)) { | ||
*addr = (void *)GetRayTracingShaderGroupHandlesKHR; | ||
return true; | ||
} | ||
|
||
// ---- VK_NV_ray_tracing extension commands | ||
if (!strcmp("vkGetRayTracingShaderGroupHandlesNV", name)) { | ||
*addr = (void *)GetRayTracingShaderGroupHandlesNV; | ||
return true; | ||
|
@@ -13006,6 +13032,9 @@ const char *const LOADER_INSTANCE_EXTENSIONS[] = { | |
#if defined(VK_USE_PLATFORM_WAYLAND_KHR) | ||
VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME, | ||
#endif // VK_USE_PLATFORM_WAYLAND_KHR | ||
#if defined(VK_USE_PLATFORM_ANDROID_KHR) | ||
VK_KHR_ANDROID_SURFACE_EXTENSION_NAME, | ||
#endif // VK_USE_PLATFORM_ANDROID_KHR | ||
#if defined(VK_USE_PLATFORM_WIN32_KHR) | ||
VK_KHR_WIN32_SURFACE_EXTENSION_NAME, | ||
#endif // VK_USE_PLATFORM_WIN32_KHR | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,9 @@ | |
// See loader_extension_generator.py for modifications | ||
|
||
/* | ||
* Copyright (c) 2015-2022 The Khronos Group Inc. | ||
* Copyright (c) 2015-2022 Valve Corporation | ||
* Copyright (c) 2015-2022 LunarG, Inc. | ||
* Copyright (c) 2015-2025 The Khronos Group Inc. | ||
* Copyright (c) 2015-2025 Valve Corporation | ||
* Copyright (c) 2015-2025 LunarG, Inc. | ||
* Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
* Copyright (c) 2023-2023 RasterGrid Kft. | ||
* | ||
|
@@ -22,6 +22,7 @@ | |
* | ||
* Author: Mark Lobodzinski <[email protected]> | ||
* Author: Mark Young <[email protected]> | ||
* Author: Charles Giessen <[email protected]> | ||
*/ | ||
|
||
// clang-format off | ||
|
@@ -502,14 +503,18 @@ struct loader_instance_extension_enables { | |
// Functions that required a terminator need to have a separate dispatch table which contains their corresponding | ||
// device function. This is used in the terminators themselves. | ||
struct loader_device_terminator_dispatch { | ||
|
||
// ---- VK_KHR_swapchain extension commands | ||
PFN_vkCreateSwapchainKHR CreateSwapchainKHR; | ||
PFN_vkGetDeviceGroupSurfacePresentModesKHR GetDeviceGroupSurfacePresentModesKHR; | ||
|
||
// ---- VK_KHR_display_swapchain extension commands | ||
PFN_vkCreateSharedSwapchainsKHR CreateSharedSwapchainsKHR; | ||
|
||
// ---- VK_EXT_debug_marker extension commands | ||
PFN_vkDebugMarkerSetObjectTagEXT DebugMarkerSetObjectTagEXT; | ||
PFN_vkDebugMarkerSetObjectNameEXT DebugMarkerSetObjectNameEXT; | ||
|
||
// ---- VK_EXT_debug_utils extension commands | ||
PFN_vkSetDebugUtilsObjectNameEXT SetDebugUtilsObjectNameEXT; | ||
PFN_vkSetDebugUtilsObjectTagEXT SetDebugUtilsObjectTagEXT; | ||
|
@@ -520,6 +525,7 @@ struct loader_device_terminator_dispatch { | |
PFN_vkCmdEndDebugUtilsLabelEXT CmdEndDebugUtilsLabelEXT; | ||
PFN_vkCmdInsertDebugUtilsLabelEXT CmdInsertDebugUtilsLabelEXT; | ||
#if defined(VK_USE_PLATFORM_WIN32_KHR) | ||
|
||
// ---- VK_EXT_full_screen_exclusive extension commands | ||
PFN_vkGetDeviceGroupSurfacePresentModes2EXT GetDeviceGroupSurfacePresentModes2EXT; | ||
#endif // VK_USE_PLATFORM_WIN32_KHR | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,9 @@ | |
|
||
/*************************************************************************** | ||
* | ||
* Copyright (c) 2015-2017 The Khronos Group Inc. | ||
* Copyright (c) 2015-2017 Valve Corporation | ||
* Copyright (c) 2015-2017 LunarG, Inc. | ||
* Copyright (c) 2015-2025 The Khronos Group Inc. | ||
* Copyright (c) 2015-2025 Valve Corporation | ||
* Copyright (c) 2015-2025 LunarG, Inc. | ||
* Copyright (c) 2015-2017 Google Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
|
@@ -27,6 +27,7 @@ | |
* Author: Tobin Ehlis <[email protected]> | ||
* Author: Chris Forbes <[email protected]> | ||
* Author: John Zulauf<[email protected]> | ||
* Author: Charles Giessen<[email protected]> | ||
* | ||
****************************************************************************/ | ||
|
||
|
@@ -346,12 +347,8 @@ static inline VkObjectType convertDebugReportObjectToCoreObject(VkDebugReportObj | |
return VK_OBJECT_TYPE_CU_MODULE_NVX; | ||
} else if (debug_report_obj == VK_DEBUG_REPORT_OBJECT_TYPE_CU_FUNCTION_NVX_EXT) { | ||
return VK_OBJECT_TYPE_CU_FUNCTION_NVX; | ||
} else if (debug_report_obj == VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR_EXT) { | ||
return VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR; | ||
} else if (debug_report_obj == VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR_EXT) { | ||
return VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR; | ||
} else if (debug_report_obj == VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_KHR_EXT) { | ||
return VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_KHR; | ||
} else if (debug_report_obj == VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT_EXT) { | ||
return VK_OBJECT_TYPE_VALIDATION_CACHE_EXT; | ||
} else if (debug_report_obj == VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV_EXT) { | ||
|
@@ -440,12 +437,8 @@ static inline VkDebugReportObjectTypeEXT convertCoreObjectToDebugReportObject(Vk | |
return VK_DEBUG_REPORT_OBJECT_TYPE_CU_MODULE_NVX_EXT; | ||
} else if (core_report_obj == VK_OBJECT_TYPE_CU_FUNCTION_NVX) { | ||
return VK_DEBUG_REPORT_OBJECT_TYPE_CU_FUNCTION_NVX_EXT; | ||
} else if (core_report_obj == VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR) { | ||
return VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR_EXT; | ||
} else if (core_report_obj == VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR) { | ||
return VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR_EXT; | ||
} else if (core_report_obj == VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_KHR) { | ||
return VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_KHR_EXT; | ||
} else if (core_report_obj == VK_OBJECT_TYPE_VALIDATION_CACHE_EXT) { | ||
return VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT_EXT; | ||
} else if (core_report_obj == VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV) { | ||
|
Oops, something went wrong.