Dds transcode channel order fix (#19849)

# Objective

- Fix bug in dds channel order transcode
- taken from #18411

## Solution

- fix it
- improve docs a bit

## Testing

- example in linked pr
This commit is contained in:
atlv 2025-06-29 14:19:05 -04:00 committed by GitHub
parent 37aae00120
commit ec1916a240
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View File

@ -23,9 +23,9 @@ pub fn dds_buffer_to_image(
Ok(format) => (format, None), Ok(format) => (format, None),
Err(TextureError::FormatRequiresTranscodingError(TranscodeFormat::Rgb8)) => { Err(TextureError::FormatRequiresTranscodingError(TranscodeFormat::Rgb8)) => {
let format = if is_srgb { let format = if is_srgb {
TextureFormat::Bgra8UnormSrgb TextureFormat::Rgba8UnormSrgb
} else { } else {
TextureFormat::Bgra8Unorm TextureFormat::Rgba8Unorm
}; };
(format, Some(TranscodeFormat::Rgb8)) (format, Some(TranscodeFormat::Rgb8))
} }

View File

@ -1558,11 +1558,11 @@ pub enum DataFormat {
pub enum TranscodeFormat { pub enum TranscodeFormat {
Etc1s, Etc1s,
Uastc(DataFormat), Uastc(DataFormat),
// Has to be transcoded to R8Unorm for use with `wgpu`. /// Has to be transcoded from `R8UnormSrgb` to `R8Unorm` for use with `wgpu`.
R8UnormSrgb, R8UnormSrgb,
// Has to be transcoded to R8G8Unorm for use with `wgpu`. /// Has to be transcoded from `Rg8UnormSrgb` to `R8G8Unorm` for use with `wgpu`.
Rg8UnormSrgb, Rg8UnormSrgb,
// Has to be transcoded to Rgba8 for use with `wgpu`. /// Has to be transcoded from `Rgb8` to `Rgba8` for use with `wgpu`.
Rgb8, Rgb8,
} }