-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Instance creation fails on iOS using MoltenVK #49
Comments
Can you report which assertion failed? This should indicate where the issue is coming from. |
The following assertion failed:
|
Thank you for showing the code, this helps me a lot when understanding whats going on. It clears up how you were indeed doing the right thing from the get go, as this code looks correct. While it shouldn't be a problem, could you try not copying the Beyond that, is there any way for you to get the value of the VkResult? This may be a bug in the return type like incorrect constructor or assignment, but I don't have an iOS device in which I could run this on to reproduce. |
I did as you suggested:
Unfortunately I still end up with the same exact issue. Regarding the value of vk_result, Xcode's debugger indicates it's Here's the output of the debugger: |
I figured that the change I suggested wouldn't help. Which is good since I was reasonably confident it wasn't the problem. But better to check and find out its not. Weird, the Otherwise, i'm not sure whats causing the error. |
I was using vk-bootstrap from a 4 days old git clone, I tried your latest release too without any luck. I don't get the error, what causes it to be |
I figured you might of used the latest version, best to be sure. It not finding vulkan could be possibly the case, maybe its failing to fail properly. |
Have you had any success/failure since then? I don't have access to a iOS device in which to reproduce but I certainly am willing to see if I can set one up. |
I've been looking at it for a while last week but now I'm too busy studying, I'll probably get back to it next week. In the meantime if you have any changes in the code you'd like me to test I'll sure do it. You'd only need a Mac (or a VM, but I don't know how that would play out with Metal without GPU passthrough) in order to build and run my project on Xcode's iOS simulator, and either way macOS is needed even if you have an iOS device, so I doubt it's worth the hassle. |
Any update on the issue? |
Sadly not, I'm focused on my semester right now and I didn't manage to get a better grasp at the issue last time I tried. |
Wait, is this code being run on iOS? Then the issue is likely that vk-bootstrap is trying to load the loader and it doesn't exist. THe way around it is manually providing it with |
No, being run on MacOS in XCode targeting the M1. I can give that a go sometime and report back. |
That would be much appreciated. |
Not to worry, I totally understand. I’ll give it a try tomorrow then. |
Well this is interesting. I'm not able to reproduce this issue when targeting Apple Silicon on CMake, could this be XCode related? |
I was able to build with CMake as well, only encountered this issue in XCode. |
Is a cmake flag not being applied properly? This is indeed strange |
same issue on an M1 mac, actually; for some reason VKCube works perfectly fine though. |
I am also having this problem. When stepping through the code it seems to fail here where both khr_surface_added and added_window_exts are false. Can it not find these extensions? If I do the vulkan setup manually without using this lib everything works fine so its definitely that vk-bootstrap is failing to find these extensions for whatever reason.
|
It appears it was an issue with linking with the vulkan libs. I have solved the issue by following the correct installation guide here: https://vulkan.lunarg.com/doc/view/1.2.148.0/mac/getting_started.html Basically, I ran the following which is located in the Vullan SDK directory:
and then from your IDE terminal (I was using VSCode):
After running that, the vk-boostrap can now correctly find the vulkan libs and everything seems to be working. |
So the way vulkan finds moltenVK is by looking for the dynamic library, aka |
After discussing this issue with a user, it was found that a very old bug where IF anyone inspects their version of VkBootstrap.cpp and sees |
I have the same issue on Intel MacBook. I checked the VkBootstrap source code, but there was VK_EXT_metal_surface everywhere. CMake file of my project:
It crashes with error:
I link the library correctly. I don't understand what the problem is. UPD. I solved the issue by replacing SFML with SDL2. As it turned out, SFML was giving out a null window surface, which is why app was crashing. |
I’m also encountering the same issue with the Has anyone managed to resolve this issue ? |
I stumbled over the same issue today, attempting to build for iOS on an M1 MacBook Pro.
I think I am linking to the library. I use CMake's Passing the mentioned function-pointer address to vk-bootstrap solves the issue for me: vkb::InstanceBuilder instance_builder(vkGetInstanceProcAddr);
auto inst_ret = instance_builder.build();
// ... Thanks a lot for mentioning how to handle linking the library instead of loading it, @charles-lunarg! 🎉 |
I wonder if I can make vk-bootstrap check if there is a |
Not sure about the others who reported here, but for me, this is an iOS-only issue. On macOS, vk-bootstrap works just fine without passing |
I faced the same problem on my M1 Mac. I solved it with following steps:
And there are some other things using Vulkan on mac I noticed:
Code...
auto instance_result = builder.set_app_name("Hello Vulkan Guide")
.request_validation_layers(true)
.use_default_debug_messenger()
.enable_extension("VK_EXT_metal_surface")
.enable_extension(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME)
.require_api_version(1, 1, 0)
.build();
...
vkb::PhysicalDevice physicalDevice = selector
.set_minimum_version(1, 1)
.set_surface(_surface)
.add_desired_extension("VK_KHR_portability_subset")
.select()
.value();
|
@gloridifice All of the things you are doing aren't necessary - as in fixes for the issue have been implemented, such as KHR_metal -> EXT_metal, auto enabling portability enumeration and portability subset, and enabling VK_EXT_metal_surface automatically. So it makes me think you are using an older version of vk-bootstrap which didn't have the fixes. That said, I only did a visual inspection into the code. If you found that any of those steps were absolutely required even with tip-of-main then let me know. For example: |
Oh, yes. I'm following the vulkan guide so the version is old.
|
Ah right that might be TOO new of a version. I would suggest the version matching your sdk version (or whatever your header version is). Like 1.3.290 for example. |
I tried the version matching my sdk version. It works well. Thank you! |
When using
value()
on the instance builder, an assertion fails and the error is simplyvkb_instance:0
. The same doesn't happen under macOS even when using the same XCFramework.I've tried manually creating the instance to see if something's wrong with the library but it worked so I don't know what's going wrong here.
If you have an idea what could be causing this any help is welcome. Thanks.
The text was updated successfully, but these errors were encountered: