cmakevulkanvalidation-layers

Vulkan Validation Layer: loader_create_instance_chain: Failed to find 'vkGetInstanceProcAddr'


I followed this guide to create a very basic Vulkan program, and for some reason, even when completely copying the code from the guide (and not using my own version which is slightly different and modified to my needs) I still receive the following two validation layer errors upon starting the program:

validation layer: loader_create_instance_chain: Failed to find 'vkGetInstanceProcAddr' in layer 
C:\ProgramData\obs-studio-hook\.\graphics-hook32.dll

validation layer: loader_create_device_chain: Failed to find 'vkGetInstanceProcAddr' in layer 
C:\ProgramData\obs-studio-hook\.\graphics-hook32.dll.  Skipping layer.

And I still can't figure out what this error is all about, and I couldn't find proper information online regarding this specific error.

The one clue I have, and it's a big one - I am working with CLion which means I need a CMakeLists.txt file for building the entire project and its dependencies, and in the guide they don't show how to do it properly.

Now, my CMakeLists.txt file looks like this:

# This CMakeLists.txt file is not optimized and is probably full of bad practices.
# But it works.
# - Need to make sure no unnecessary binaries are linked
# - Need to make sure local variables like ${PROJECT_NAME} are used wherever they can
cmake_minimum_required(VERSION 3.17)
project(Sandbox)
add_executable(Sandbox main.cpp)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17")

set(glm_DIR "path/to/Libraries/glm/cmake/glm")
find_package(glm REQUIRED)
target_link_libraries(Sandbox glm::glm)

find_package(Vulkan)  # Probably confirmed to be elegant
target_link_libraries(Sandbox Vulkan::Vulkan)

include_directories("path/to/Libraries/stb")
include_directories("path/to/Libraries/tinyobjloader")

set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
# This probably causes the glfw folder to appear in the project window
add_subdirectory("path/to/Libraries/glfw-3.3.2" build)
target_link_libraries(Sandbox glfw)

It is important to know that I am new to cmake, working on Windows 10 and that the program runs properly (the actual window looks good, only the console is alarming).

If anyone could please help with this, it would be greatly appreciated. Also, any optimizations to the CMakeLists.txt would be great!

Thanks in advance!


Solution

  • Those errors aren't triggered by your application, but rather by implicit layers installed by OBS Studio. Applications can register their own implicit layers globally, and these are then loaded as soon as you run a Vulkan application. If one of those layers is flawed, you'll get validation layer errors in your own application, even if your application is perfectly fine.

    The easiest way to disable these is the recently released Vulkan Configurator from the LunarG SDK. Without the SDK you can disable implicit layers by setting their value to 1 in the registry under HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Khronos\Vulkan\ImplicitLayers.