]> git.tdb.fi Git - libs/gui.git/blob - source/graphics/vulkancontext.cpp
Add a class for creating Vulkan graphics contexts
[libs/gui.git] / source / graphics / vulkancontext.cpp
1 #include <msp/strings/format.h>
2 #include "vulkancontext.h"
3 #include "window.h"
4
5 namespace Msp {
6 namespace Graphics {
7
8 vulkan_error::vulkan_error(unsigned code, const char *function):
9         runtime_error(format("%s failed: %s", function, get_error_message(code)))
10 { }
11
12
13 VulkanContext::VulkanContext(Window &w, const VulkanOptions &opts):
14         display(w.get_display()),
15         window(w)
16 {
17         platform_init(opts);
18 }
19
20 #ifndef WITH_VULKAN
21 void VulkanContext::platform_init(const VulkanOptions &)
22 {
23         throw runtime_error("no Vulkan support");
24 }
25
26 VulkanContext::~VulkanContext()
27 { }
28
29 void (*VulkanContext::_get_function(const std::string &) const)()
30 {
31         return 0;
32 }
33 #endif
34
35 } // namespace Graphics
36 } // namespace Msp