From e27ce3b507e5829d2812fa394d06d5e091a64d1f Mon Sep 17 00:00:00 2001 From: Quaternions Date: Thu, 21 Sep 2023 11:56:03 -0700 Subject: [PATCH] dynamic image size --- src/main.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 43811e19..564f9483 100644 --- a/src/main.rs +++ b/src/main.rs @@ -626,9 +626,13 @@ impl strafe_client::framework::Example for GraphicsData { //squid let squid_texture_view={ + let bytes = &include_bytes!("../images/squid.dds")[..]; + + let image = ddsfile::Dds::read(&mut std::io::Cursor::new(&bytes)).unwrap(); + let size = wgpu::Extent3d { - width: 1076, - height: 1076, + width: image.get_width(), + height: image.get_height(), depth_or_array_layers: 1, }; @@ -638,10 +642,6 @@ impl strafe_client::framework::Example for GraphicsData { }; let max_mips = layer_size.max_mips(wgpu::TextureDimension::D2); - let bytes = &include_bytes!("../images/squid.dds")[..]; - - let image = ddsfile::Dds::read(&mut std::io::Cursor::new(&bytes)).unwrap(); - let texture = device.create_texture_with_data( queue, &wgpu::TextureDescriptor {