1
0
Fork 0
forked from wry/wry

vulkan: handle exported sync file being -1

This commit is contained in:
Julian Orth 2025-09-08 12:33:55 +02:00
parent b99f2b928a
commit 435b96f92e
4 changed files with 45 additions and 57 deletions

View file

@ -41,12 +41,16 @@ impl VulkanDevice {
}
impl VulkanFence {
pub fn export_sync_file(&self) -> Result<SyncFile, VulkanError> {
pub fn export_sync_file(&self) -> Result<Option<SyncFile>, VulkanError> {
let info = FenceGetFdInfoKHR::default()
.fence(self.fence)
.handle_type(ExternalFenceHandleTypeFlags::SYNC_FD);
let res = unsafe { self.device.external_fence_fd.get_fence_fd(&info) };
res.map_err(VulkanError::ExportSyncFile)
.map(|fd| SyncFile(Rc::new(OwnedFd::new(fd))))
let fd = res.map_err(VulkanError::ExportSyncFile)?;
if fd == -1 {
Ok(None)
} else {
Ok(Some(SyncFile(Rc::new(OwnedFd::new(fd)))))
}
}
}