From 20a568220af48c1ff9310d22fd2644dce36bff41 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Fri, 29 Sep 2023 18:07:44 -0700 Subject: [PATCH] use plain format if image is not the right shape --- src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index fc9d48b..18dfbb9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -315,10 +315,15 @@ fn convert(file_thing:std::fs::DirEntry) -> BoxResult<()>{ Err(error::Error::new("Unknown texture format"))? }; + let format=if image.width()%4!=0||image.height()%4!=0{ + image_dds::ImageFormat::R8G8B8A8Srgb + }else{ + image_dds::ImageFormat::BC7Srgb + }; //this fails if the image dimensions are not a multiple of 4 let dds = image_dds::dds_from_image( &image, - image_dds::ImageFormat::BC7Srgb, + format, image_dds::Quality::Slow, image_dds::Mipmaps::GeneratedAutomatic, )?;