diff options
author | tcmal <me@aria.rip> | 2024-08-25 17:44:23 +0100 |
---|---|---|
committer | tcmal <me@aria.rip> | 2024-08-25 17:44:23 +0100 |
commit | c52a05e6d3977efce6bd4479aa312dc90e0452e5 (patch) | |
tree | c383c910c1467b406e332651906e081c599d6951 /stockton-render/src/draw/texture/loader.rs | |
parent | d5b9ccd3d4a6e5b35a0411688bfb7113f5c7d631 (diff) |
feat(render): proper error handling
Diffstat (limited to 'stockton-render/src/draw/texture/loader.rs')
-rw-r--r-- | stockton-render/src/draw/texture/loader.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/stockton-render/src/draw/texture/loader.rs b/stockton-render/src/draw/texture/loader.rs index 2198fe4..3d7d32e 100644 --- a/stockton-render/src/draw/texture/loader.rs +++ b/stockton-render/src/draw/texture/loader.rs @@ -147,13 +147,14 @@ impl<T: HasTextures, R: TextureResolver<I>, I: LoadableImage> TextureLoader<T, R debug!("Load finished for texture block {:?}", block.id); // Destroy staging buffers - while staging_bufs.len() > 0 { - let buf = staging_bufs.pop().unwrap(); + for buf in staging_bufs.drain(..) { buf.deactivate(&mut device, &mut self.staging_allocator); } self.buffers.push_back(assets); - self.return_channel.send(block).unwrap(); + self.return_channel + .send(block) + .context("Error returning texture block")?; } else { i += 1; } @@ -365,7 +366,11 @@ impl<T: HasTextures, R: TextureResolver<I>, I: LoadableImage> TextureLoader<T, R self.descriptor_allocator .allocate( &device, - &*self.ds_layout.read().unwrap(), + &*self + .ds_layout + .read() + .map_err(|_| LockPoisoned::Other) + .context("Error reading descriptor set layout")?, DescriptorRanges::from_bindings(&[ DescriptorSetLayoutBinding { binding: 0, @@ -668,8 +673,7 @@ impl<T: HasTextures, R: TextureResolver<I>, I: LoadableImage> TextureLoader<T, R device.destroy_fence(assets.0); // Command buffer will be freed when we reset the command pool // Destroy staging buffers - while staging_bufs.len() > 0 { - let buf = staging_bufs.pop().unwrap(); + for buf in staging_bufs.drain(..) { buf.deactivate(&mut device, &mut self.staging_allocator); } |