1 #ifndef MSP_GL_DEVICE_BACKEND_H_
2 #define MSP_GL_DEVICE_BACKEND_H_
4 #include <msp/core/noncopyable.h>
5 #include <msp/graphics/vulkancontext.h>
6 #include "destroyqueue.h"
8 #include "memoryallocator.h"
9 #include "pipelinecache.h"
10 #include "synchronizer.h"
11 #include "transferqueue.h"
16 struct VulkanFunctions;
18 constexpr unsigned MAX_FRAMES_IN_FLIGHT = 3;
20 class VulkanDevice: public NonCopyable
23 Graphics::VulkanContext context;
25 VkQueue graphics_queue;
26 RefPtr<VulkanFunctions> functions;
27 MemoryAllocator allocator;
28 DestroyQueue destroy_queue;
29 Synchronizer synchronizer;
30 TransferQueue transfer_queue;
31 PipelineCache pipeline_cache;
32 unsigned n_frames_in_flight = 3;
34 VulkanDevice(Graphics::Window &, const Graphics::VulkanOptions &);
37 static Graphics::VulkanOptions create_default_options();
41 Graphics::VulkanContext &get_context() { return context; }
44 const VulkanFunctions &get_functions() const { return *functions; }
45 MemoryAllocator &get_allocator() { return allocator; }
46 DestroyQueue &get_destroy_queue() { return destroy_queue; }
47 Synchronizer &get_synchronizer() { return synchronizer; }
48 TransferQueue &get_transfer_queue() { return transfer_queue; }
49 PipelineCache &get_pipeline_cache() { return pipeline_cache; }
50 unsigned get_n_frames_in_flight() const { return n_frames_in_flight; }
53 using DeviceBackend = VulkanDevice;
54 using DeviceOptions = Graphics::VulkanOptions;