Skip to content

Commit

Permalink
Vulkan >=301 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinPulec committed Nov 12, 2024
1 parent eeeeae5 commit 2c070b9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/video_display/vulkan/vulkan_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,11 @@ void VulkanInstance::init(std::vector<const char*>& required_extensions, bool en
}

if (enable_validation) {
#if VK_HEADER_VERSION >= 301
dynamic_dispatcher = std::make_unique<vk::detail::DispatchLoaderDynamic>((VkInstance) instance, vkGetInstanceProcAddr);
#else
dynamic_dispatcher = std::make_unique<vk::DispatchLoaderDynamic>((VkInstance) instance, vkGetInstanceProcAddr);
#endif
init_validation_layers_error_messenger();
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/video_display/vulkan/vulkan_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,11 @@ struct SwapchainImage {

class VulkanContext {
vk::Instance instance;
#if VK_HEADER_VERSION >= 301
std::unique_ptr<vk::detail::DispatchLoaderDynamic> dynamic_dispatcher{};
#else
std::unique_ptr<vk::DispatchLoaderDynamic> dynamic_dispatcher{};
#endif
vk::DebugUtilsMessengerEXT messenger;
uint32_t vulkan_version{};

Expand Down Expand Up @@ -221,7 +225,11 @@ inline void cout_msg([[maybe_unused]] LogLevel log_level, std::string_view msg)

class VulkanInstance {
vk::Instance instance{};
#if VK_HEADER_VERSION >= 301
std::unique_ptr<vk::detail::DispatchLoaderDynamic> dynamic_dispatcher = nullptr;
#else
std::unique_ptr<vk::DispatchLoaderDynamic> dynamic_dispatcher = nullptr;
#endif
vk::DebugUtilsMessengerEXT messenger{};
uint32_t vulkan_version = VK_API_VERSION_1_1;

Expand Down

0 comments on commit 2c070b9

Please sign in to comment.