Discuss Scratch

robotkid828
Scratcher
100+ posts

vulkan refuses to acknowledge that VK_KHR_portability_enumeration exists

every time i think “oh maybe working with graphics wont be as bad as last time” and im wrong EVERY TIME

trying to build an app that uses vulkan (heads up: it wraps vulkan in a weird interface, among other questionable actions it does to vulkan) on an M1 macos, and it simply refuses to acknowledge the existence of VK_KHR_portability_enumeration

vulkaninfo returns:
==========
VULKANINFO
==========

Vulkan Instance Version: 1.4.328


Instance Extensions: count = 18
-------------------------------
VK_EXT_debug_report : extension revision 10
VK_EXT_debug_utils : extension revision 2
VK_EXT_headless_surface : extension revision 1
VK_EXT_layer_settings : extension revision 2
VK_EXT_metal_surface : extension revision 1
VK_EXT_surface_maintenance1 : extension revision 1
VK_EXT_swapchain_colorspace : extension revision 5
VK_KHR_device_group_creation : extension revision 1
VK_KHR_external_fence_capabilities : extension revision 1
VK_KHR_external_memory_capabilities : extension revision 1
VK_KHR_external_semaphore_capabilities : extension revision 1
VK_KHR_get_physical_device_properties2 : extension revision 2
VK_KHR_get_surface_capabilities2 : extension revision 1
VK_KHR_portability_enumeration : extension revision 1
VK_KHR_surface : extension revision 25
VK_KHR_surface_protected_capabilities : extension revision 1
VK_LUNARG_direct_driver_loading : extension revision 1
VK_MVK_macos_surface : extension revision 3

Instance Layers: count = 7
---------------------------
VK_LAYER_KHRONOS_profiles Khronos Profiles layer 1.4.328 version 1
VK_LAYER_KHRONOS_shader_object Khronos Shader object layer 1.4.328 version 1
VK_LAYER_KHRONOS_synchronization2 Khronos Synchronization2 layer 1.4.328 version 1
VK_LAYER_KHRONOS_validation Khronos Validation Layer 1.4.328 version 1
VK_LAYER_LUNARG_api_dump LunarG API dump layer 1.4.328 version 2
VK_LAYER_LUNARG_gfxreconstruct GFXReconstruct Capture Layer Version 1.0.5 1.4.328 version 4194309
VK_LAYER_LUNARG_screenshot LunarG image capture layer 1.4.328 version 1

Devices:
========
GPU0:
apiVersion = 1.4.323
driverVersion = 0.2.2208
deviceType = PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU
deviceName = Apple M1
driverID = DRIVER_ID_MOLTENVK
driverName = MoltenVK
driverInfo = 1.4.0
conformanceVersion = 1.4.2.0

however my program can only see
number of devices: 1
instance version: 1.4.323
physical device api version: 1.3.323 (not quite sure how this happened, i dont even have a 1.3.323 of anything installed)
physical device name: Apple M1
physical device driver version: 0.2.2208
instance MoltenVK version: 1.4.323
extension VK_KHR_device_group_creation
extension VK_KHR_external_fence_capabilities
extension VK_KHR_external_memory_capabilities
extension VK_KHR_external_semaphore_capabilities
extension VK_KHR_get_physical_device_properties2
extension VK_KHR_get_surface_capabilities2
extension VK_KHR_surface
extension VK_KHR_surface_protected_capabilities
extension VK_EXT_debug_report
extension VK_EXT_debug_utils
extension VK_EXT_headless_surface
extension VK_EXT_layer_settings
extension VK_EXT_metal_surface
extension VK_EXT_surface_maintenance1
extension VK_EXT_swapchain_colorspace
extension VK_MVK_macos_surface
extension VK_MVK_moltenvk
which has a notable lack of VK_KHR_portability_enumeration, despite it being listed in vulkaninfo.

these checks are done before initializing an instance (and i dont think a device is ever initialized…), but i do have the required code to enable VK_KHR_portability_enumeration:
#ifdef __APPLE__
    constexpr VkFlags ci_flags{VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR};
#else
    constexpr VkFlags ci_flags{};
#endif
...
const VkInstanceCreateInfo ci{
    .sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
    .pNext = nullptr,
    .flags = ci_flags,
    .pApplicationInfo = &application_info,
    .enabledLayerCount = layers.size(),
    .ppEnabledLayerNames = layers.data(),
    .enabledExtensionCount = extensions.size(),
    .ppEnabledExtensionNames = extensions.data(),
};
VkInstance instance;
Check(dispatch.vkCreateInstance(&ci, nullptr, &instance));
and
#ifdef __APPLE__
    if (AreExtensionsSupported(dld, std::array{VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME})) {
        extensions.push_back(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME);
    }
#endif
...
vk::Instance instance =
    std::async([&] {
        return vk::Instance::Create(available_version, layers, extensions, dld);
    }).get();
and yet it still errors with “Failed to initialize Vulkan: VK_ERROR_EXTENSION_NOT_PRESENT”

help?

(edit: should probably mention vkcube works perfectly fine)

Last edited by robotkid828 (Nov. 8, 2025 00:21:39)

robotkid828
Scratcher
100+ posts

vulkan refuses to acknowledge that VK_KHR_portability_enumeration exists

*cough* *cough* *cough* bump
also in case i cant solve this… anyone know if there are vulkan-like alternatives that would hopefully be a bit more supported than vulkan on macos?
RalphJP
Scratcher
36 posts

vulkan refuses to acknowledge that VK_KHR_portability_enumeration exists

I had a look at the Vulkan documentation, and I was as lost as you as to what the error was about… As vkcube works, try seeing how vkcube does it by looking at the source code, and working from there.

The official graphics API on mac OS is Metal. I personally don't have a mac so I can't try it, but I think it might be slightly easier than Vulkan. It will definitely be more supported by Apple.

If Metal and Vulkan are too hard, try raylib - it's almost certainly the simplest and easiest way to draw stuff on the screen. It has a high level API, but allows access to lower level features when needed via rlgl. With raylib, a window can be displayed on the screen in under 20 lines of code.

SDL3 GPU also seems promising (And uses Vulkan and Metal internally) but there is limited examples at this point in time as it's fairly new.

Also I don't think many scratchers would really know Vulkan! Maybe try asking on more Vulkan related forums for help?
Jonathan50
Scratcher
1000+ posts

vulkan refuses to acknowledge that VK_KHR_portability_enumeration exists

robotkid828 wrote:

*cough* *cough* *cough* bump
also in case i cant solve this… anyone know if there are vulkan-like alternatives that would hopefully be a bit more supported than vulkan on macos?
Never tried Vulkan yet; surely you can still use OpenGL if you choose no matter how many times Apple deprecates it (not that it's “Vulkan-like” though I guess OGL4 is a little bit moreso than OGL2 or fixed-function. I still haven't really gone past fixed-function graphics programming, not that I'm good at that in the first place)

Powered by DjangoBB