HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
gfx_system_vulkan.hpp
1// Copyright Take Vos 2020.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5#pragma once
6
7#include "gfx_system.hpp"
8#include <vulkan/vulkan.hpp>
9
10namespace hi::inline v1 {
11
15class gfx_system_vulkan final : public gfx_system {
16protected:
18 vk::DispatchLoaderDynamic _loader;
19
20 vk::DebugUtilsMessengerEXT debugUtilsMessager;
21
22public:
24 vk::Instance intrinsic;
25
28
31
33 vk::PhysicalDeviceFeatures requiredFeatures;
34
36 vk::PhysicalDeviceLimits requiredLimits;
37
39 vk::ApplicationInfo applicationInfo;
40
49
50 gfx_system_vulkan(const gfx_system_vulkan &) = delete;
51 gfx_system_vulkan &operator=(const gfx_system_vulkan &) = delete;
53 gfx_system_vulkan &operator=(gfx_system_vulkan &&) = delete;
54
55 void init() noexcept(false) override;
56
57 [[nodiscard]] std::unique_ptr<gfx_surface> make_surface(os_handle instance, void *os_window) const noexcept override;
58
59 vk::DispatchLoaderDynamic loader() const noexcept
60 {
61 hi_axiom(gfx_system_mutex.recurse_lock_count());
62 return _loader;
63 }
64
65 void destroySurfaceKHR(vk::SurfaceKHR surface)
66 {
67 hi_axiom(gfx_system_mutex.recurse_lock_count());
68 intrinsic.destroySurfaceKHR(surface);
69 }
70
71 static VkBool32 debugUtilsMessageCallback(
72 VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
73 VkDebugUtilsMessageTypeFlagsEXT messageType,
74 const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData,
75 void *pUserData);
76};
77
78} // namespace hi::inline v1
STL namespace.
Definition gfx_surface.hpp:15
Graphics system.
Definition gfx_system.hpp:21
Vulkan gfx_device controller.
Definition gfx_system_vulkan.hpp:15
vk::PhysicalDeviceFeatures requiredFeatures
List of required features for each device.
Definition gfx_system_vulkan.hpp:33
vk::ApplicationInfo applicationInfo
application info passed when the instance was created.
Definition gfx_system_vulkan.hpp:39
std::vector< const char * > requiredLayers
List of extension that where requested when the instance was created.
Definition gfx_system_vulkan.hpp:30
void init() noexcept(false) override
Initialize after construction.
gfx_system_vulkan()
Create an instance of a gfx_device.
std::vector< const char * > requiredExtensions
List of extension that where requested when the instance was created.
Definition gfx_system_vulkan.hpp:27
vk::PhysicalDeviceLimits requiredLimits
List of required limits for each device.
Definition gfx_system_vulkan.hpp:36
vk::Instance intrinsic
Vulkan instance.
Definition gfx_system_vulkan.hpp:24
int recurse_lock_count() const noexcept
This function should be used in hi_axiom() to check if the lock is held by current thread.
Definition unfair_recursive_mutex.hpp:60