1
0
Fork 0
forked from wry/wry

render: add support for more formats

This commit is contained in:
Julian Orth 2024-04-03 21:18:44 +02:00
parent 9d78231cac
commit 551dafcce8
13 changed files with 348 additions and 491 deletions

View file

@ -120,13 +120,16 @@ impl VulkanRenderer {
data: &[Cell<u8>],
for_download: bool,
) -> Result<Rc<VulkanImage>, VulkanError> {
let Some(shm_info) = &format.shm_info else {
return Err(VulkanError::UnsupportedShmFormat(format.name));
};
if width <= 0 || height <= 0 || stride <= 0 {
return Err(VulkanError::NonPositiveImageSize);
}
let width = width as u32;
let height = height as u32;
let stride = stride as u32;
if stride % format.bpp != 0 || stride / format.bpp < width {
if stride % shm_info.bpp != 0 || stride / shm_info.bpp < width {
return Err(VulkanError::InvalidStride);
}
let vk_format = self