Closed Radagan closed 2 years ago
I ran into these warnings too. I think they have to do with Vulkan on the mac M1 being somewhat in an early phase. For the validation layer warnings, there are a few things to do. First, in the window.h
file, or wherever you've included glfw, add #define VK_ENABLE_BETA_EXTENSIONS
right before #include <GLFW/glfw3.h>
. This is necessary to address the portability subset issue since the required extensions currently aren't included in the Vulkan core. Now in device.h
, go to the private device_extensions
char vector, which currently contains VK_KHR_SWAPCHAIN_EXTENSION_NAME
, and add to it
VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME
.
This depends on another extension, VK_KHR_get_physical_device_properties2
. Go to the GetRequiredExtension()
function in the device.cpp
file and here, after initialization of the extensions
char vector, add
extensions.push_back(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME)
This should address the first warning. Now, while still in the GetRequiredExtension()
, also add
extensions.push_back(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME)
Then go to CreateInstance()
in device.cpp
and after you initialize the VkInstanceCreateInfo create_info
struct, specify a flags member,
create_info.flags = VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR
.
This should take care of the second warning. Not sure about the EXC_BAD_ACCESS question.
@jefferycoulter Thank you very much for your reply! As a follow on question, my development team is a mix of M1 and Intel macs (and also Windows 11), how would I configure the project to work correctly for both? Do I need to detect the architecture and fence these changes to only M1 macs or is there a cleaner way?
Also, thank you very much for these amazing videos! I'm way farther along than I expected to be and that's thanks to you!
I haven't tried running on Windows with the above additions yet, but I think everything should still work on Windows and mac Intel so probably you don't need to do anything. If you only want to include these additions for mac M1, then probably the easiest approach would be to add something like #ifdef __arm64__
before the additional code. I'm not sure whether a second macro would be required for Windows, it will depend on whether you're using visual studio, but you can find a list and try some different ones here: https://sourceforge.net/p/predef/wiki/Architectures/
Also, I'm not the creator of this series, just another viewer. I ran into the same warnings and happened to see your question as I was trying to figure out how to resolve it. Best of luck!
@jefferycoulter Thank you. Best of luck to you as well!
First off, thank you so much for these videos! I've been following along very well, but I've been getting these validation layer warnings and I'm not sure what to do with them. Ideas?
Also, after making the changes for Lesson 5, I'm getting a "EXC_BAD_ACCESS (code=1, address=0x30)" when trying to create the pipeline. I'm wondering if it is related to these validation warnings or something I messed up in following along.
All advice most appreciated!