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