diff --git a/src/game/mod.rs b/src/game/mod.rs index 5f25573..df3c69c 100644 --- a/src/game/mod.rs +++ b/src/game/mod.rs @@ -166,9 +166,7 @@ impl TestGame { assert!(is_dxt1); println!("Texture width: {}, height: {}, bytes: {}", tex_width, tex_height, tex_byte_count); - let data_start: usize = 124; - let data_end: usize = data_start + tex_byte_count as usize; - renderer.upload_texture(&tex_bytes[data_start..data_end], tex_width, tex_height, vulkano::format::Format::BC1_RGBASrgbBlock, renderer.device.clone()); + renderer.upload_texture(&tex_bytes, tex_width, tex_height, vulkano::format::Format::BC1_RGBUnormBlock, renderer.device.clone()); self.texture_index_counter += 1; if self.log_config.mesh_load_info { diff --git a/src/vulkan/mesh.rs b/src/vulkan/mesh.rs index ad72996..488d389 100644 --- a/src/vulkan/mesh.rs +++ b/src/vulkan/mesh.rs @@ -43,7 +43,7 @@ pub fn load_mesh(mesh_path: &str, print_status: bool) -> Result<(Vec, D start_time = Some(SystemTime::now()); println!("Loading mesh file {}", mesh_path); } - let (document, buffers, textures) = gltf::import(mesh_path)?; + let (document, buffers, _textures) = gltf::import(mesh_path)?; let mut meshes = vec![]; if print_status { println!("Mesh file loaded after {} seconds, processing...", start_time.unwrap().elapsed().unwrap().as_secs()); } diff --git a/src/vulkan/mod.rs b/src/vulkan/mod.rs index 145c020..085727b 100644 --- a/src/vulkan/mod.rs +++ b/src/vulkan/mod.rs @@ -2,8 +2,6 @@ use std::sync::Arc; use std::time::SystemTime; use cgmath::{Matrix4, SquareMatrix}; -use image::{ImageBuffer, Rgb, Rgba}; -use image::buffer::ConvertBuffer; use vulkano::{buffer::{BufferUsage, CpuAccessibleBuffer}, command_buffer::SubpassContents, image::MipmapsCount}; use vulkano::command_buffer::{AutoCommandBuffer, AutoCommandBufferBuilder, DynamicState}; use vulkano::descriptor::DescriptorSet; @@ -434,9 +432,7 @@ impl VulkanRenderer { } pub fn upload_texture(self: &mut Self, bytes: &[u8], width: u32, height: u32, format: Format, device: Arc) { - // Format buffer on cpu for upload let dimensions = Dimensions::Dim2d { width, height }; - let (image_view, future) = ImmutableImage::from_iter(bytes.iter().cloned(), dimensions, MipmapsCount::One, format, self.queue.clone()).unwrap(); future.flush().unwrap();