]> git.tdb.fi Git - libs/gui.git/blob - source/graphics/vulkancontext.h
Add decorations for things which should be exported from the library
[libs/gui.git] / source / graphics / vulkancontext.h
1 #ifndef MSP_GRAPHICS_VULKANCONTEXT_H_
2 #define MSP_GRAPHICS_VULKANCONTEXT_H_
3
4 #include <stdexcept>
5 #include <string>
6 #include "mspgui_api.h"
7
8 namespace Msp {
9 namespace Graphics {
10
11 class Display;
12 class Window;
13
14 class MSPGUI_API vulkan_error: public std::runtime_error
15 {
16 public:
17         vulkan_error(unsigned, const char *);
18
19 private:
20         static std::string get_error_message(unsigned);
21 };
22
23 struct VulkanOptions
24 {
25         bool enable_validation = false;
26         bool enable_debug_report = false;
27         bool enable_geometry_shader = false;
28         bool enable_tessellation_shader = false;
29 };
30
31 class MSPGUI_API VulkanContext
32 {
33 private:
34         struct Private;
35
36         Display &display;
37         Window &window;
38         Private *priv = nullptr;
39
40 public:
41         VulkanContext(Window &, const VulkanOptions & = VulkanOptions());
42 private:
43         void platform_init(const VulkanOptions &);
44 public:
45         ~VulkanContext();
46
47         template<typename T>
48         T get_function(const std::string &name) const
49         { return reinterpret_cast<T>(_get_function(name)); }
50
51 private:
52         void (*_get_function(const std::string &) const)();
53
54 public:
55         const Private &get_private() const { return *priv; }
56 };
57
58 } // namespace Graphics
59 } // namespace Msp
60
61 #endif