vulkan: use transfer queue for uploads
This commit is contained in:
parent
88a528d3bf
commit
3ab5f6981f
6 changed files with 424 additions and 86 deletions
|
|
@ -58,10 +58,41 @@ pub struct VulkanImage {
|
|||
pub(super) image: Image,
|
||||
pub(super) is_undefined: Cell<bool>,
|
||||
pub(super) contents_are_undefined: Cell<bool>,
|
||||
pub(super) queue_state: Cell<QueueState>,
|
||||
pub(super) ty: VulkanImageMemory,
|
||||
pub(super) bridge: Option<VulkanFramebufferBridge>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
|
||||
pub enum QueueState {
|
||||
Acquired { family: QueueFamily },
|
||||
Releasing,
|
||||
Released { to: QueueFamily },
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
|
||||
pub enum QueueFamily {
|
||||
Gfx,
|
||||
Transfer,
|
||||
}
|
||||
|
||||
impl QueueState {
|
||||
pub fn acquire(self, new: QueueFamily) -> QueueTransfer {
|
||||
match self {
|
||||
QueueState::Acquired { family } if family == new => QueueTransfer::Unnecessary,
|
||||
QueueState::Released { to } if to == new => QueueTransfer::Possible,
|
||||
_ => QueueTransfer::Impossible,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
|
||||
pub enum QueueTransfer {
|
||||
Unnecessary,
|
||||
Possible,
|
||||
Impossible,
|
||||
}
|
||||
|
||||
pub enum VulkanImageMemory {
|
||||
DmaBuf(VulkanDmaBufImage),
|
||||
Internal(VulkanShmImage),
|
||||
|
|
@ -384,6 +415,9 @@ impl VulkanDmaBufImageTemplate {
|
|||
format: self.dmabuf.format,
|
||||
is_undefined: Cell::new(true),
|
||||
contents_are_undefined: Cell::new(false),
|
||||
queue_state: Cell::new(QueueState::Acquired {
|
||||
family: QueueFamily::Gfx,
|
||||
}),
|
||||
bridge,
|
||||
}))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue