KhronosGroup / KhronosGroup/glTF-IBL-Sampler

Vulkan 1.3.216+ fails on MacOS with 'Failed to create Vulkan instance 4294967287'

Open
#29 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
170
Forks
28
PR merge metrics
No merged PRs in 30d

Description

I had some errors creating the Vulkan instance on MacOS. The error message was:
```
Failed to create Vulkan instance 4294967287
```
I think that error code should be printed as a signed integer instead, so it's just `-9`, which lines up more nicely with the negative value of errors in `VkResult`.

In this case it's `VK_ERROR_INCOMPATIBLE_DRIVER`, and after a bit of searching I fixed it by adding the following code at [this line](https://github.com/KhronosGroup/glTF-IBL-Sampler/blob/4248407b4e4d49bec54f42e62b2743ca483dbc89/lib/source/vkHelper.cpp#L78):
```cpp
static const char *VK_EXTENSION_NAMES[1] = {
VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME,
};
createInfo.ppEnabledExtensionNames = VK_EXTENSION_NAMES;
createInfo.enabledExtensionCount = 1;

createInfo.flags |= VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR;
```

I believe the reason is that Vulkan now [requires this extension](https://vulkan.lunarg.com/doc/view/1.3.216.0/mac/release_notes.html#user-content-portability-enumeration-requirement) on MacOS. An ideal fix would probably verify if the extension is available, and maybe whether it's on MacOS, but I'm not very familiar with how to do any of these things idiomatically.

I hope the above fix will help someone else in this situation, or maybe someone more familiar with this can apply the patch idiomatically :)

Thanks!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in lib/source/vkHelper.cpp around line 78 and inspect how the Vulkan instance is created and errors are reported. Check the available portability extension and the proposed instance flags on macOS with Vulkan 1.3.216+, then run the sampler to verify instance creation succeeds without the reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.