diff options
author | tcmal <me@aria.rip> | 2024-08-25 17:44:24 +0100 |
---|---|---|
committer | tcmal <me@aria.rip> | 2024-08-25 17:44:24 +0100 |
commit | 5360fe6a337145b2640ec1e5727c97fd9bbeacd9 (patch) | |
tree | 264f4cda45b001fb5049b9120d4d7b3a63c95e6f /stockton-skeleton/src/texture | |
parent | 0ddc1e39dc24cff636defbbbab974967bb5301b8 (diff) |
refactor(all): small fixes
Diffstat (limited to 'stockton-skeleton/src/texture')
-rw-r--r-- | stockton-skeleton/src/texture/load.rs | 13 | ||||
-rw-r--r-- | stockton-skeleton/src/texture/loader.rs | 16 |
2 files changed, 11 insertions, 18 deletions
diff --git a/stockton-skeleton/src/texture/load.rs b/stockton-skeleton/src/texture/load.rs index 6cb4f4d..c4d3b72 100644 --- a/stockton-skeleton/src/texture/load.rs +++ b/stockton-skeleton/src/texture/load.rs @@ -61,19 +61,6 @@ pub struct QueuedLoad<TP: MemoryPool, SP: MemoryPool> { pub staging_bufs: ArrayVec<[StagingBuffer<SP>; BLOCK_SIZE]>, } -impl<TP: MemoryPool, SP: MemoryPool> QueuedLoad<TP, SP> { - /// Break down into a tuple - pub fn dissolve( - self, - ) -> ( - (FenceT, CommandBufferT), - ArrayVec<[StagingBuffer<SP>; BLOCK_SIZE]>, - TexturesBlock<TP>, - ) { - ((self.fence, self.buf), self.staging_bufs, self.block) - } -} - /// Create a SampledImage for the given LoadableImage, and load the image data into a StagingBuffer /// Note that this doesn't queue up transferring from the buffer to the image. pub unsafe fn load_image<I, R, SP, TP>( diff --git a/stockton-skeleton/src/texture/loader.rs b/stockton-skeleton/src/texture/loader.rs index ea42c29..80d4a61 100644 --- a/stockton-skeleton/src/texture/loader.rs +++ b/stockton-skeleton/src/texture/loader.rs @@ -149,7 +149,11 @@ where .context("Error checking fence status")?; if signalled { - let (assets, mut staging_bufs, block) = self.commands_queued.remove(i).dissolve(); + let queued_load = self.commands_queued.remove(i); + let assets = (queued_load.fence, queued_load.buf); + let block = queued_load.block; + let mut staging_bufs = queued_load.staging_bufs; + debug!("Load finished for texture block {:?}", block.id); // Lock staging memory pool @@ -384,8 +388,8 @@ where let (staging_buffer, img) = load_image( &mut device, - &mut self.staging_mempool, - &mut self.tex_mempool, + &self.staging_mempool, + &self.tex_mempool, self.optimal_buffer_copy_pitch_alignment, img_data, &self.config, @@ -613,8 +617,10 @@ where if signalled { // Destroy finished ones - let (assets, mut staging_bufs, block) = - self.commands_queued.remove(i).dissolve(); + let queued_load = self.commands_queued.remove(i); + let assets = (queued_load.fence, queued_load.buf); + let block = queued_load.block; + let mut staging_bufs = queued_load.staging_bufs; device.destroy_fence(assets.0); // Command buffer will be freed when we reset the command pool |