Skip to content

New DDS decoder and encoder #2461

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Conversation

RunDevelopment
Copy link
Contributor

Resolves #2435
Resolves #2093

In this PR, I removed the old DDS decoder implementation and added a new decoder and encoder based on the dds crate.

Decoder: The decoder now supports a bunch more formats, cube maps, rectangle decoding, and the ability to decode as a color format of the user's choosing.

Encoder: The encoder supports a selection of DDS formats, automatic mipmap generation, dithering, compression quality, and both header formats. If the user does specify a format, the encoder will automatically pick an uncompressed that can losslessly represent the image.
Only encoding single images (with optional mipmaps) is supported. Cube maps, texture arrays, and volumes are not. They could be in the future, but I don't see the need right now.

Changes:

  • Add dds as a dependency.
  • Use dds to power a new DDS de/encoder API for image. I made all new types, so nothing from dds is re-exported/used publicly.
  • Removed old DXT implementation. This was already non-public, so I don't think this will cause any issues.

TODO:

  • Add more documentation. The DdsDecoder and DdsEncoder structs should have a lengthy doc comment explaining what they can do and how they are supposed to be used.
  • Add tests.

@RunDevelopment RunDevelopment changed the title Dds New DDS decoder and encoder May 1, 2025
@RunDevelopment RunDevelopment mentioned this pull request May 1, 2025
@RunDevelopment
Copy link
Contributor Author

I fixed the error for test_toolchains (1.70.0) in image-rs/image-dds#59, so just cargo-deny remains. It doesn't like that dds uses a newer version of zerocopy than some other dependency. I'm not sure what the best solution for that is. Should I downgrade the version to v0.7.x, or should I try to make dds work with both v0.8.x and v0.7.x? dds doesn't use a lot of zerocopy's APIs, so this might be possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DDS support Encoding DDS images?
1 participant