use plain format if image is not the right shape

This commit is contained in:
Quaternions 2023-09-29 18:07:44 -07:00
parent d670d4129e
commit 20a568220a

View File

@ -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,
)?;