From 182d87015faed846e7959d27e25584e291acba64 Mon Sep 17 00:00:00 2001 From: Rylie Pavlik Date: Wed, 5 Jun 2024 11:51:28 -0500 Subject: [PATCH] scripts, a/vk: Fix calling functions using their Vulkan 1.0 name rather than promoted name Part-of: --- doc/changes/compositor/mr.2233.md | 1 + scripts/generate_vk_helpers.py | 24 ++++++++++++++++++---- src/xrt/auxiliary/vk/vk_function_loaders.c | 6 +++--- src/xrt/auxiliary/vk/vk_helpers.h | 6 +++--- 4 files changed, 27 insertions(+), 10 deletions(-) create mode 100644 doc/changes/compositor/mr.2233.md diff --git a/doc/changes/compositor/mr.2233.md b/doc/changes/compositor/mr.2233.md new file mode 100644 index 000000000..d862fa5f9 --- /dev/null +++ b/doc/changes/compositor/mr.2233.md @@ -0,0 +1 @@ +Fix: General correctness and valid usage issues. diff --git a/scripts/generate_vk_helpers.py b/scripts/generate_vk_helpers.py index bec8282cf..fe9e84d40 100755 --- a/scripts/generate_vk_helpers.py +++ b/scripts/generate_vk_helpers.py @@ -8,6 +8,10 @@ from typing import Callable, Iterable, List, Optional def get_device_cmds(): + # NOTE: Be sure to use the Vulkan 1.0 name of functions in here! + # (so, the decorated extension version) + # If you want to alias it in the generated file, use the member_name + # keyword argument. return [ Cmd("vkDestroyDevice"), Cmd("vkDeviceWaitIdle"), @@ -194,8 +198,14 @@ def get_instance_cmds(): None, Cmd("vkEnumeratePhysicalDevices"), Cmd("vkGetPhysicalDeviceProperties"), - Cmd("vkGetPhysicalDeviceProperties2"), - Cmd("vkGetPhysicalDeviceFeatures2"), + Cmd( + "vkGetPhysicalDeviceProperties2KHR", + member_name="vkGetPhysicalDeviceProperties2", + ), + Cmd( + "vkGetPhysicalDeviceFeatures2KHR", + member_name="vkGetPhysicalDeviceFeatures2", + ), Cmd("vkGetPhysicalDeviceMemoryProperties"), Cmd("vkGetPhysicalDeviceQueueFamilyProperties"), Cmd("vkGetPhysicalDeviceSurfaceCapabilitiesKHR"), @@ -203,8 +213,14 @@ def get_instance_cmds(): Cmd("vkGetPhysicalDeviceSurfacePresentModesKHR"), Cmd("vkGetPhysicalDeviceSurfaceSupportKHR"), Cmd("vkGetPhysicalDeviceFormatProperties"), - Cmd("vkGetPhysicalDeviceFormatProperties2KHR", member_name="vkGetPhysicalDeviceFormatProperties2"), - Cmd("vkGetPhysicalDeviceImageFormatProperties2"), + Cmd( + "vkGetPhysicalDeviceFormatProperties2KHR", + member_name="vkGetPhysicalDeviceFormatProperties2", + ), + Cmd( + "vkGetPhysicalDeviceImageFormatProperties2KHR", + member_name="vkGetPhysicalDeviceImageFormatProperties2", + ), Cmd("vkGetPhysicalDeviceExternalBufferPropertiesKHR"), Cmd("vkGetPhysicalDeviceExternalFencePropertiesKHR"), Cmd("vkGetPhysicalDeviceExternalSemaphorePropertiesKHR"), diff --git a/src/xrt/auxiliary/vk/vk_function_loaders.c b/src/xrt/auxiliary/vk/vk_function_loaders.c index 29b41937f..bedab0de0 100644 --- a/src/xrt/auxiliary/vk/vk_function_loaders.c +++ b/src/xrt/auxiliary/vk/vk_function_loaders.c @@ -68,8 +68,8 @@ vk_get_instance_functions(struct vk_bundle *vk) vk->vkEnumeratePhysicalDevices = GET_INS_PROC(vk, vkEnumeratePhysicalDevices); vk->vkGetPhysicalDeviceProperties = GET_INS_PROC(vk, vkGetPhysicalDeviceProperties); - vk->vkGetPhysicalDeviceProperties2 = GET_INS_PROC(vk, vkGetPhysicalDeviceProperties2); - vk->vkGetPhysicalDeviceFeatures2 = GET_INS_PROC(vk, vkGetPhysicalDeviceFeatures2); + vk->vkGetPhysicalDeviceProperties2 = GET_INS_PROC(vk, vkGetPhysicalDeviceProperties2KHR); + vk->vkGetPhysicalDeviceFeatures2 = GET_INS_PROC(vk, vkGetPhysicalDeviceFeatures2KHR); vk->vkGetPhysicalDeviceMemoryProperties = GET_INS_PROC(vk, vkGetPhysicalDeviceMemoryProperties); vk->vkGetPhysicalDeviceQueueFamilyProperties = GET_INS_PROC(vk, vkGetPhysicalDeviceQueueFamilyProperties); vk->vkGetPhysicalDeviceSurfaceCapabilitiesKHR = GET_INS_PROC(vk, vkGetPhysicalDeviceSurfaceCapabilitiesKHR); @@ -78,7 +78,7 @@ vk_get_instance_functions(struct vk_bundle *vk) vk->vkGetPhysicalDeviceSurfaceSupportKHR = GET_INS_PROC(vk, vkGetPhysicalDeviceSurfaceSupportKHR); vk->vkGetPhysicalDeviceFormatProperties = GET_INS_PROC(vk, vkGetPhysicalDeviceFormatProperties); vk->vkGetPhysicalDeviceFormatProperties2 = GET_INS_PROC(vk, vkGetPhysicalDeviceFormatProperties2KHR); - vk->vkGetPhysicalDeviceImageFormatProperties2 = GET_INS_PROC(vk, vkGetPhysicalDeviceImageFormatProperties2); + vk->vkGetPhysicalDeviceImageFormatProperties2 = GET_INS_PROC(vk, vkGetPhysicalDeviceImageFormatProperties2KHR); vk->vkGetPhysicalDeviceExternalBufferPropertiesKHR = GET_INS_PROC(vk, vkGetPhysicalDeviceExternalBufferPropertiesKHR); vk->vkGetPhysicalDeviceExternalFencePropertiesKHR = GET_INS_PROC(vk, vkGetPhysicalDeviceExternalFencePropertiesKHR); vk->vkGetPhysicalDeviceExternalSemaphorePropertiesKHR = GET_INS_PROC(vk, vkGetPhysicalDeviceExternalSemaphorePropertiesKHR); diff --git a/src/xrt/auxiliary/vk/vk_helpers.h b/src/xrt/auxiliary/vk/vk_helpers.h index ac843fe01..6fdb53067 100644 --- a/src/xrt/auxiliary/vk/vk_helpers.h +++ b/src/xrt/auxiliary/vk/vk_helpers.h @@ -193,8 +193,8 @@ struct vk_bundle PFN_vkEnumeratePhysicalDevices vkEnumeratePhysicalDevices; PFN_vkGetPhysicalDeviceProperties vkGetPhysicalDeviceProperties; - PFN_vkGetPhysicalDeviceProperties2 vkGetPhysicalDeviceProperties2; - PFN_vkGetPhysicalDeviceFeatures2 vkGetPhysicalDeviceFeatures2; + PFN_vkGetPhysicalDeviceProperties2KHR vkGetPhysicalDeviceProperties2; + PFN_vkGetPhysicalDeviceFeatures2KHR vkGetPhysicalDeviceFeatures2; PFN_vkGetPhysicalDeviceMemoryProperties vkGetPhysicalDeviceMemoryProperties; PFN_vkGetPhysicalDeviceQueueFamilyProperties vkGetPhysicalDeviceQueueFamilyProperties; PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR vkGetPhysicalDeviceSurfaceCapabilitiesKHR; @@ -203,7 +203,7 @@ struct vk_bundle PFN_vkGetPhysicalDeviceSurfaceSupportKHR vkGetPhysicalDeviceSurfaceSupportKHR; PFN_vkGetPhysicalDeviceFormatProperties vkGetPhysicalDeviceFormatProperties; PFN_vkGetPhysicalDeviceFormatProperties2KHR vkGetPhysicalDeviceFormatProperties2; - PFN_vkGetPhysicalDeviceImageFormatProperties2 vkGetPhysicalDeviceImageFormatProperties2; + PFN_vkGetPhysicalDeviceImageFormatProperties2KHR vkGetPhysicalDeviceImageFormatProperties2; PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHR vkGetPhysicalDeviceExternalBufferPropertiesKHR; PFN_vkGetPhysicalDeviceExternalFencePropertiesKHR vkGetPhysicalDeviceExternalFencePropertiesKHR; PFN_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR vkGetPhysicalDeviceExternalSemaphorePropertiesKHR;