realitix / vulkan

The ultimate Python binding for Vulkan API
Apache License 2.0
505 stars 46 forks source link

pyvulkan gives VkErrorExtensionNotPresent error, but extension is present. #90

Open hrbigelow opened 6 months ago

hrbigelow commented 6 months ago

Hi,

I've noticed that there are several situations where I get a VkErrorExtensionNotPresent from pyvulkan, yet I believe the extension is actually present in my Vulkan SDK. I had a look at the api.xml and I think there might be a bug in the parser. In any case, here is any example of the bug. Wondering if you could comment if this is indeed a bug in this repo or I'm misreading it. Thank very much!

import vulkan as vk

ext = [vk.VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME,
       vk.VK_KHR_TIMELINE_SEMAPHORE_EXTENSION_NAME]

info = vk.VkInstanceCreateInfo(
    pNext=None,
    flags=0,
    pApplicationInfo=None,
    enabledLayerCount=0,
    ppEnabledLayerNames=[],
    enabledExtensionCount=len(ext),
    ppEnabledExtensionNames=ext)

instance = vk.vkCreateInstance(info, None)

I get:

Traceback (most recent call last):
  File "/home/henry/ai/glass-imaging/image-generator/image_gen/tests/instance_extension.py", line 14, in <module>
    instance = vk.vkCreateInstance(info, None)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/henry/miniconda3/envs/vulkan/lib/python3.12/site-packages/vulkan/_vulkan.py", line 11045, in vkCreateInstance
    raise exception_codes[result]
vulkan._vulkan.VkErrorExtensionNotPresent

Yet, I see:

$ vulkaninfo
==========
VULKANINFO
==========

Vulkan Instance Version: 1.3.280

...
Device Extensions: count = 133
       VK_KHR_timeline_semaphore                   : extension revision 2
...
VkPhysicalDeviceVulkan12Features:
---------------------------------
         timelineSemaphore                                  = true