Skip to content
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

ver 1.3.280.0 failed for 'VK_ERROR_INCOMPATIBLE_DRIVER' on macOS 14.3.1 #2192

Closed
CheneyER08 opened this issue Mar 23, 2024 · 3 comments
Closed

Comments

@CheneyER08
Copy link

CheneyER08 commented Mar 23, 2024

OS: macOS 14.3.1
GPU: Apple Silicon M1 Max
Vulkan SDK: 1.3.280.0

It works well on my Windows PC. On macOS, it build successfully, but execute failed for VK_ERROR_INCOMPATIBLE_DRIVER while creating VkInstance. I have tried Cmake and Xcode projects.

Below is my CMakeLists.txt

cmake_minimum_required(VERSION 3.27)
project(Tutorials LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
if (NOT DEFINED ENV{VULKAN_SDK})
        set(ENV{VULKAN_SDK} "/Users/cheneyshue/VulkanSDK/1.3.280.0/macOS")
        set(ENV{VK_ICD_FILENAMES} "$ENV{VULKAN_SDK}/share/vulkan/icd.d/MoltenVK_icd.json")
        set(ENV{VK_LAYER_PATH} "$ENV{VULKAN_SDK}/share/vulkan/explicit_layer.d")
        include_directories("$ENV{VULKAN_SDK}/include")
        find_library(VulkanLib NAMES vulkan PATHS "$ENV{VULKAN_SDK}/lib")
endif ()
add_executable(Tutorials main.cpp
        VulkanApp.cpp
        VulkanApp.h)
target_link_libraries(Tutorials ${VulkanLib})

Below is my code to create VkInstance

    VkApplicationInfo appInfo {
            .sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
            .pApplicationName = "Vulkan Tutorials",
            .applicationVersion = VK_MAKE_VERSION(1, 0, 0),
            .pEngineName = "No Engine",
            .engineVersion = VK_MAKE_VERSION(1, 0, 0),
            .apiVersion = VK_API_VERSION_1_0
    };
    VkInstanceCreateInfo createInfo {
            .sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
            .flags = VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR,
            .pApplicationInfo = &appInfo,
            .enabledLayerCount = 0,
            .ppEnabledLayerNames = {},
            .enabledExtensionCount = 0,
            .ppEnabledExtensionNames = {}
    };

    VkResult result = vkCreateInstance(&createInfo, nullptr, &instance);

Below is the statements to execute built binary.

source /Users/cheneyshue/VulkanSDK/1.3.280.0/setup-env.sh
./Tutorials

BTW, the vkcube and vulkanCapsViewer can execute well on my macOS.

@richard-lunarg
Copy link
Collaborator

richard-lunarg commented Mar 23, 2024

You are missing the portability instance extension required on macOs. Some recommended reading here that will help smooth the way for you:
https://www.lunarg.com/news-insights/white-papers/the-state-of-vulkan-on-apple-devices-updated/

@CheneyER08
Copy link
Author

You are missing the portability instance extension required on macOs. Some recommended reading here that will help smooth the way for you: https://www.lunarg.com/news-insights/white-papers/the-state-of-vulkan-on-apple-devices-updated/

Thanks. It works after add portability extension.

@rgaufman
Copy link

I fixed the problem by installing molten-vk with:

brew install molten-vk

Thank you for the heads up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants