-
Notifications
You must be signed in to change notification settings - Fork 172
vkGetDeviceProcAddr allows returning of non-device functions #2323
Comments
I believe tests against this behaviour should be added to the CTS. |
@polarina It is not neccessarily obvious from the spec that implementations are not allowed to return a function pointer. It only clearly says that you are not allowed to use the given function pointer with a |
While I definitely agree that the behavior you're describing seems a little strange, my reading of the spec makes me think this is intended. The spec gives the following table to describe the behavior of
The fourth row of that table suggests to me that every core Vulkan command should be accessible through
That note is completely impossible to adhere to for any instance commands, which looks like a contradiction in the spec to me (though you can still call the commands with a parent object, rather than a child). I think that the intent of the spec is that My feeling is that I'm not willing to change the behavior of the loader (and the same goes for validation layers) without at least a clarification from the spec. If you want to get a change or clarification in this behavior, then feel free to submit an issue to the spec repo. If the spec (or the spec authors) unambiguously state that instance commands should not be accessible via I'm going to close this issue for now because I don't think there's anything actionable right now. If either the spec changes or if you can find something to unambiguously state that getting instance level commands from |
Thanks for your feedback. I understand your position and the specification isn't exactly clear. I filed a spec ticket for reference: KhronosGroup/Vulkan-Docs#655 |
Please don't change the loader in a way that breaks existing shipping games like Wolfenstein. This might require bug for bug compatibility. I will check our code and fix this, but it probably won't be patched for Doom/Wolf. |
Thanks, I'll try to keep an eye on the spec issue. I definitely agree with @Novum that we can't break compatibility. That means that if we get a response that |
@lenny-lunarg Actually, either way it is undefined behaviour of those apps. Either they are calling Receiving function pointer you are not permited to use is pointless, and perhaps so not a worry for compatibility. |
Yeah, no, this is not remotely comparable to that xkcd. Fixing this by returning NULL would break Doom and Wolf New Order to run. For no good reason besides being anal about the spec. |
@Novum Just sayin', it is their bug regardles of how the spec issue is resolved. There's no compatibility issue as far as spec analness goes (unless you count that it "breaks someones workflow who uses a bug\undefined value"). The Loader code should not be responsible for forever supporting some external non-compliant code. |
And even then I'm not at all sure that the spec outlaws this behavior. Regardless, we'll make sure compatibility is preserved. |
…broken games. Doom and Wolfenstein II use vkGetDeviceProcAddr to load all their function pointers, while they are supposed to use vkGetInstanceProcAddr for the instance ones. This is in violation of the Vulkan spec, but so far the loader allows this, but Khronos is thinking about fixing the spec and potentially the loader. KhronosGroup/Vulkan-LoaderAndValidationLayers#2323
…broken games. Doom and Wolfenstein II use vkGetDeviceProcAddr to load all their function pointers, while they are supposed to use vkGetInstanceProcAddr for the instance ones. This is in violation of the Vulkan spec, but so far the loader allows this, but Khronos is thinking about fixing the spec and potentially the loader. KhronosGroup/Vulkan-LoaderAndValidationLayers#2323
…broken games. Doom and Wolfenstein II use vkGetDeviceProcAddr to load all their function pointers, while they are supposed to use vkGetInstanceProcAddr for the instance ones. This is in violation of the Vulkan spec, but so far the loader allows this, but Khronos is thinking about fixing the spec and potentially the loader. KhronosGroup/Vulkan-LoaderAndValidationLayers#2323
…broken games. Doom and Wolfenstein II use vkGetDeviceProcAddr to load all their function pointers, while they are supposed to use vkGetInstanceProcAddr for the instance ones. This is in violation of the Vulkan spec, but so far the loader allows this, but Khronos is thinking about fixing the spec and potentially the loader. KhronosGroup/Vulkan-LoaderAndValidationLayers#2323
…broken games. Doom and Wolfenstein II use vkGetDeviceProcAddr to load all their function pointers, while they are supposed to use vkGetInstanceProcAddr for the instance ones. This is in violation of the Vulkan spec, but so far the loader allows this, but Khronos is thinking about fixing the spec and potentially the loader. KhronosGroup/Vulkan-LoaderAndValidationLayers#2323
…broken games. Doom and Wolfenstein II use vkGetDeviceProcAddr to load all their function pointers, while they are supposed to use vkGetInstanceProcAddr for the instance ones. This is in violation of the Vulkan spec, but so far the loader allows this, but Khronos is thinking about fixing the spec and potentially the loader. KhronosGroup/Vulkan-LoaderAndValidationLayers#2323
…broken games. Doom and Wolfenstein II use vkGetDeviceProcAddr to load all their function pointers, while they are supposed to use vkGetInstanceProcAddr for the instance ones. This is in violation of the Vulkan spec, but so far the loader allows this, but Khronos is thinking about fixing the spec and potentially the loader. KhronosGroup/Vulkan-LoaderAndValidationLayers#2323
…broken games. Doom and Wolfenstein II use vkGetDeviceProcAddr to load all their function pointers, while they are supposed to use vkGetInstanceProcAddr for the instance ones. This is in violation of the Vulkan spec, but so far the loader allows this, but Khronos is thinking about fixing the spec and potentially the loader. KhronosGroup/Vulkan-LoaderAndValidationLayers#2323
…broken games. Doom and Wolfenstein II use vkGetDeviceProcAddr to load all their function pointers, while they are supposed to use vkGetInstanceProcAddr for the instance ones. This is in violation of the Vulkan spec, but so far the loader allows this, but Khronos is thinking about fixing the spec and potentially the loader. KhronosGroup/Vulkan-LoaderAndValidationLayers#2323
…broken games. Doom and Wolfenstein II use vkGetDeviceProcAddr to load all their function pointers, while they are supposed to use vkGetInstanceProcAddr for the instance ones. This is in violation of the Vulkan spec, but so far the loader allows this, but Khronos is thinking about fixing the spec and potentially the loader. KhronosGroup/Vulkan-LoaderAndValidationLayers#2323
…broken games. Doom and Wolfenstein II use vkGetDeviceProcAddr to load all their function pointers, while they are supposed to use vkGetInstanceProcAddr for the instance ones. This is in violation of the Vulkan spec, but so far the loader allows this, but Khronos is thinking about fixing the spec and potentially the loader. KhronosGroup/Vulkan-LoaderAndValidationLayers#2323
…broken games. Doom and Wolfenstein II use vkGetDeviceProcAddr to load all their function pointers, while they are supposed to use vkGetInstanceProcAddr for the instance ones. This is in violation of the Vulkan spec, but so far the loader allows this, but Khronos is thinking about fixing the spec and potentially the loader. KhronosGroup/Vulkan-LoaderAndValidationLayers#2323
Just an update on this issue. The issue on the spec repo got closed with the result being that That being said, I looked into this issue and there are a few things that I found:
As a result, we came to the conclusion that this will be resolved via driver fixes. I'm leaving this issue closed, since there's nothing to do in the loader. That being said, this will get fixed as a result of driver updates, but I can't give a time frame for that, since it's up to the vendors. |
…broken games. Doom and Wolfenstein II use vkGetDeviceProcAddr to load all their function pointers, while they are supposed to use vkGetInstanceProcAddr for the instance ones. This is in violation of the Vulkan spec, but so far the loader allows this, but Khronos is thinking about fixing the spec and potentially the loader. KhronosGroup/Vulkan-LoaderAndValidationLayers#2323
…broken games. Doom and Wolfenstein II use vkGetDeviceProcAddr to load all their function pointers, while they are supposed to use vkGetInstanceProcAddr for the instance ones. This is in violation of the Vulkan spec, but so far the loader allows this, but Khronos is thinking about fixing the spec and potentially the loader. KhronosGroup/Vulkan-LoaderAndValidationLayers#2323
…broken games. Doom and Wolfenstein II use vkGetDeviceProcAddr to load all their function pointers, while they are supposed to use vkGetInstanceProcAddr for the instance ones. This is in violation of the Vulkan spec, but so far the loader allows this, but Khronos is thinking about fixing the spec and potentially the loader. KhronosGroup/Vulkan-LoaderAndValidationLayers#2323
…broken games. Doom and Wolfenstein II use vkGetDeviceProcAddr to load all their function pointers, while they are supposed to use vkGetInstanceProcAddr for the instance ones. This is in violation of the Vulkan spec, but so far the loader allows this, but Khronos is thinking about fixing the spec and potentially the loader. KhronosGroup/Vulkan-LoaderAndValidationLayers#2323
…ommands af5f232 addressed this for extension commands, but the spec mandates this behavior also for core API commands. From the Vulkan spec, Table 2. vkGetDeviceProcAddr behavior: device pname return ---------------------------------------------------------- (..) device core device-level command fp (...) See that it specifically states "device-level". Since the vk.xml file doesn't state if core commands are instance or device level, we identify device level commands as the ones that take a VkDevice, VkQueue or VkCommandBuffer as their first parameter. Fixes test failures in new work-in-progress CTS tests. Also see the public issue: KhronosGroup/Vulkan-LoaderAndValidationLayers#2323 v2: - Include reference to github issue (Emil) - Add a comment clarifying the story behind this behavior (Emil) - Rebased on top of Vulkan 1.1 changes. Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
…ommands af5f232 addressed this for extension commands, but the spec mandates this behavior also for core API commands. From the Vulkan spec, Table 2. vkGetDeviceProcAddr behavior: device pname return ---------------------------------------------------------- (..) device core device-level command fp (...) See that it specifically states "device-level". Since the vk.xml file doesn't state if core commands are instance or device level, we identify device level commands as the ones that take a VkDevice, VkQueue or VkCommandBuffer as their first parameter. Fixes test failures in new work-in-progress CTS tests. Also see the public issue: KhronosGroup/Vulkan-LoaderAndValidationLayers#2323 v2: - Include reference to github issue (Emil) - Rebased on top of Vulkan 1.1 changes. v3: - Remove the not in the condition and switch the then/else cases (Jason) Reviewed-by: Emil Velikov <emil.velikov@collabora.com> (v1)
…broken games. Doom and Wolfenstein II use vkGetDeviceProcAddr to load all their function pointers, while they are supposed to use vkGetInstanceProcAddr for the instance ones. This is in violation of the Vulkan spec, but so far the loader allows this, but Khronos is thinking about fixing the spec and potentially the loader. KhronosGroup/Vulkan-LoaderAndValidationLayers#2323
When working on a Vulkan ICD implementation for Wine, I encountered issues related to vkGetDeviceProcAddr. The call is intended to load functions for device or children of device. I noticed Doom and Wolfenstein 2 both used vkGetDeviceProcAddr to load also instance functions (e.g. vkGetPhysicalDeviceSurfaceSupportKHR). Doing some further testing it appears any instance function can be returned (vkCreateDevice, vkDestroyInstance,..)
This behaviour is not correct. I'm not sure if the loader's vkGetDeviceProcAddr can be fixed as 2 major titles as I pointed out already rely on the broken behaviour. My feeling is that at minimum some validation layers / conformance tests should warn developers about this.
The text was updated successfully, but these errors were encountered: