pmse_render/vulkan/
vulkan_host.rs1use std::sync::Arc;
3
4use vulkano::{
5 command_buffer::allocator::{
6 StandardCommandBufferAllocator, StandardCommandBufferAllocatorCreateInfo,
7 },
8 device::{physical::PhysicalDevice, Device, Queue},
9 memory::allocator::StandardMemoryAllocator,
10 swapchain::Surface,
11};
12
13#[derive(Debug, Clone)]
15pub struct PmseRenderHost {
16 p: Arc<PhysicalDevice>,
18 d: Arc<Device>,
20 q: Arc<Queue>,
22 ma: Arc<StandardMemoryAllocator>,
24 s: Arc<Surface>,
26}
27
28impl PmseRenderHost {
29 pub(crate) fn new(
30 p: Arc<PhysicalDevice>,
31 d: Arc<Device>,
32 q: Arc<Queue>,
33 ma: Arc<StandardMemoryAllocator>,
34 s: Arc<Surface>,
35 ) -> Self {
36 Self { p, d, q, ma, s }
37 }
38
39 pub fn p(&self) -> &Arc<PhysicalDevice> {
41 &self.p
42 }
43
44 pub fn d(&self) -> &Arc<Device> {
46 &self.d
47 }
48
49 pub fn q(&self) -> &Arc<Queue> {
51 &self.q
52 }
53
54 pub fn ma(&self) -> &Arc<StandardMemoryAllocator> {
56 &self.ma
57 }
58
59 pub fn s(&self) -> &Arc<Surface> {
61 &self.s
62 }
63
64 pub fn ca(&self) -> StandardCommandBufferAllocator {
66 StandardCommandBufferAllocator::new(
67 self.d.clone(),
68 StandardCommandBufferAllocatorCreateInfo::default(),
69 )
70 }
71}