]> git.tdb.fi Git - libs/gl.git/blob - source/backends/vulkan/device_backend.h
Check the flat qualifier from the correct member
[libs/gl.git] / source / backends / vulkan / device_backend.h
1 #ifndef MSP_GL_DEVICE_BACKEND_H_
2 #define MSP_GL_DEVICE_BACKEND_H_
3
4 #include <msp/core/noncopyable.h>
5 #include <msp/core/refptr.h>
6 #include <msp/graphics/vulkancontext.h>
7 #include "descriptorpool.h"
8 #include "destroyqueue.h"
9 #include "handles.h"
10 #include "memoryallocator.h"
11 #include "pipelinecache.h"
12 #include "synchronizer.h"
13 #include "transferqueue.h"
14
15 namespace Msp {
16 namespace GL {
17
18 struct VulkanFunctions;
19
20 constexpr unsigned MAX_FRAMES_IN_FLIGHT = 3;
21
22 class VulkanDevice: public NonCopyable
23 {
24 protected:
25         Graphics::VulkanContext context;
26         VkDevice device;
27         VkQueue graphics_queue;
28         RefPtr<VulkanFunctions> functions;
29         MemoryAllocator allocator;
30         DestroyQueue destroy_queue;
31         Synchronizer synchronizer;
32         TransferQueue transfer_queue;
33         PipelineCache pipeline_cache;
34         DescriptorPool descriptor_pool;
35         unsigned n_frames_in_flight = 3;
36
37         VulkanDevice(Graphics::Window &, const Graphics::VulkanOptions &);
38         ~VulkanDevice();
39
40         static Graphics::VulkanOptions create_default_options();
41
42         void fill_info();
43
44         Graphics::VulkanContext &get_context() { return context; }
45
46 public:
47         const VulkanFunctions &get_functions() const { return *functions; }
48         MemoryAllocator &get_allocator() { return allocator; }
49         DestroyQueue &get_destroy_queue() { return destroy_queue; }
50         Synchronizer &get_synchronizer() { return synchronizer; }
51         TransferQueue &get_transfer_queue() { return transfer_queue; }
52         PipelineCache &get_pipeline_cache() { return pipeline_cache; }
53         DescriptorPool &get_descriptor_pool() { return descriptor_pool; }
54         unsigned get_n_frames_in_flight() const { return n_frames_in_flight; }
55 };
56
57 using DeviceBackend = VulkanDevice;
58 using DeviceOptions = Graphics::VulkanOptions;
59
60 } // namespace GL
61 } // namespace Msp
62
63 #endif