diff options
Diffstat (limited to 'stockton-render/src/draw/texture')
-rw-r--r-- | stockton-render/src/draw/texture/load.rs | 2 | ||||
-rw-r--r-- | stockton-render/src/draw/texture/loader.rs | 14 | ||||
-rw-r--r-- | stockton-render/src/draw/texture/repo.rs | 8 | ||||
-rw-r--r-- | stockton-render/src/draw/texture/resolver.rs | 4 |
4 files changed, 12 insertions, 16 deletions
diff --git a/stockton-render/src/draw/texture/load.rs b/stockton-render/src/draw/texture/load.rs index e278fa2..1f33ad5 100644 --- a/stockton-render/src/draw/texture/load.rs +++ b/stockton-render/src/draw/texture/load.rs @@ -112,7 +112,7 @@ where unsafe { device - .bind_image_memory(&block.memory(), block.range().start, &mut image_ref) + .bind_image_memory(block.memory(), block.range().start, &mut image_ref) .context("Error binding memory to image")?; } diff --git a/stockton-render/src/draw/texture/loader.rs b/stockton-render/src/draw/texture/loader.rs index ebb2bcc..e6c19db 100644 --- a/stockton-render/src/draw/texture/loader.rs +++ b/stockton-render/src/draw/texture/loader.rs @@ -234,7 +234,7 @@ impl<R: TextureResolver> TextureLoader<R> { let props = MemProps::DEVICE_LOCAL; DynamicAllocator::new( - find_memory_type_id(&adapter, type_mask, props) + find_memory_type_id(adapter, type_mask, props) .ok_or(TextureLoaderError::NoMemoryTypes) .context("Couldn't create tex memory allocator")?, props, @@ -249,7 +249,7 @@ impl<R: TextureResolver> TextureLoader<R> { let (staging_memory_type, mut staging_allocator) = { let props = MemProps::CPU_VISIBLE | MemProps::COHERENT; - let t = find_memory_type_id(&adapter, u32::MAX, props) + let t = find_memory_type_id(adapter, u32::MAX, props) .ok_or(TextureLoaderError::NoMemoryTypes) .context("Couldn't create staging memory allocator")?; ( @@ -557,7 +557,7 @@ impl<R: TextureResolver> TextureLoader<R> { staging_memory_type, obcpa, img_data, - &config, + config, )?; buf.begin_primary(CommandBufferFlags::ONE_TIME_SUBMIT); @@ -590,8 +590,8 @@ impl<R: TextureResolver> TextureLoader<R> { image_layers: LAYERS, image_offset: Offset { x: 0, y: 0, z: 0 }, image_extent: Extent { - width: width, - height: height, + width, + height, depth: 1, }, }), @@ -678,9 +678,9 @@ impl<R: TextureResolver> TextureLoader<R> { read(&*self.blank_image).deactivate(&mut device, &mut *self.tex_allocator); // Destroy fences - let vec: Vec<_> = self.buffers.drain(..).collect(); - vec.into_iter() + self.buffers + .drain(..) .map(|(f, _)| device.destroy_fence(f)) .for_each(|_| {}); diff --git a/stockton-render/src/draw/texture/repo.rs b/stockton-render/src/draw/texture/repo.rs index 2df7bd3..e427eef 100644 --- a/stockton-render/src/draw/texture/repo.rs +++ b/stockton-render/src/draw/texture/repo.rs @@ -12,7 +12,6 @@ use std::{ array::IntoIter, collections::HashMap, iter::empty, - marker::PhantomData, mem::ManuallyDrop, sync::{ mpsc::{channel, Receiver, Sender}, @@ -33,17 +32,15 @@ use log::debug; /// Whenever a texture is needed, the whole block its in is loaded. pub const BLOCK_SIZE: usize = 8; -pub struct TextureRepo<'a> { +pub struct TextureRepo { joiner: ManuallyDrop<JoinHandle<Result<TextureLoaderRemains>>>, ds_layout: Arc<RwLock<DescriptorSetLayoutT>>, req_send: Sender<LoaderRequest>, resp_recv: Receiver<TexturesBlock<DynamicBlock>>, blocks: HashMap<BlockRef, Option<TexturesBlock<DynamicBlock>>>, - - _a: PhantomData<&'a ()>, } -impl<'a> TextureRepo<'a> { +impl TextureRepo { pub fn new<R: 'static + TextureResolver + Send + Sync>( device_lock: Arc<RwLock<DeviceT>>, family: QueueFamilyId, @@ -114,7 +111,6 @@ impl<'a> TextureRepo<'a> { blocks: HashMap::new(), req_send, resp_recv, - _a: PhantomData::default(), }) } diff --git a/stockton-render/src/draw/texture/resolver.rs b/stockton-render/src/draw/texture/resolver.rs index 1ecb7a0..1dbc62d 100644 --- a/stockton-render/src/draw/texture/resolver.rs +++ b/stockton-render/src/draw/texture/resolver.rs @@ -1,7 +1,7 @@ //! Resolves a texture in a BSP File to an image use crate::draw::texture::image::LoadableImage; -use stockton_levels::prelude::HasTextures; +use stockton_levels::{parts::IsTexture, prelude::HasTextures}; use std::{ mem::drop, @@ -37,7 +37,7 @@ impl<'a, T: HasTextures> TextureResolver for FsResolver<'a, T> { fn resolve(&mut self, tex: u32) -> Option<Self::Image> { let map = self.map_lock.read().unwrap(); let tex = map.get_texture(tex)?; - let path = self.path.join(&tex.name); + let path = self.path.join(&tex.name()); drop(tex); drop(map); |