Vulkan-Loader icon indicating copy to clipboard operation
Vulkan-Loader copied to clipboard

vkEnumerateInstanceExtensionProperties is incorrectly implemented

Open DaKvasNV opened this issue 9 months ago • 5 comments

Environment:

  • OS: Windows
  • GPU and driver version: NVIDIA GEFORCE RTX 3090
  • SDK or header version if building from repo: 1.3.280.0
  • Options enabled (synchronization, best practices, etc.):

Describe the Issue vkEnumerateInstanceExtensionProperties is a "pre-instance function" (https://vulkan.lunarg.com/doc/view/1.3.280.0/windows/loader_and_layer_interface.html#user-content-pre-instance-functions), and therefore requires special handling via Vk...Chain in order to be properly layered. Because this is not properly implemented, VVL's EnumerateInstanceExtensionProperties() function does not appear to ever get executed.

For example, calling: vkEnumerateInstanceExtensionProperties(NULL, NULL, NULL) will not report the VUID-vkEnumerateInstanceExtensionProperties-pPropertyCount-parameter validation error.

It's also worth noting that if an app calls vkEnumerateInstanceExtensionProperties() prior to vkCreateInstance(), the VkLayer_khronos_validation.dll does not get loaded, as would be expected if the function was correctly layered.

Lastly, the chassis.cpp::EnumerateInstanceExtensionProperties() implementation does not correctly handle the case when pLayerName == NULL

This set of issues likely applies to the other "pre-instance functions".

Expected behavior

  1. Calls to vkEnumerateInstanceExtensionProperties() prior to vkCreateInstance() would load VkLayer_khronos_validation.dll and run validation checks
  2. Calling vkEnumerateInstanceExtensionProperties(NULL, NULL, NULL) should report VUID-vkEnumerateInstanceExtensionProperties-pPropertyCount-parameter validation error.
  3. Calling vkEnumerateInstanceExtensionProperties(NULL, &count, NULL) should result in VVL calling down the chain so that extensions provided by the Vulkan implementation or by implicitly enabled layers are returned (per vkEnumerateInstanceExtensionProperties's spec)

Valid Usage ID VUID-vkEnumerateInstanceExtensionProperties-* don't get reported

Additional context It's worth noting that according to the vulkan spec, VVL is not actually allowed layer the pre-instance functions: In order to intercept the pre-instance functions, several conditions must be met: ... The layer must be implicit. I'm not sure how VVL is expected to reconcile that, but thought it would be worth mentioning.

DaKvasNV avatar May 14 '24 22:05 DaKvasNV