microsoft/DirectXTex

Make DirectX::EncodeDDSHeader public

Guekka opened this issue · 2 comments

Hello,
I'm using this library in a particular case. I'm working with a file format looking like this

custom_header
chunk1
chunk2
chunk3
chunk4

With chunk defined as

uint8_t* data;
uint8_t start_mip;
uint8_t end_mip;

Basically, the header contains texture information. And each chunk contains several mipmaps

Now, my issue is that DirectXTex does not provide way to deal with individual mipmaps.

My changes would be the following:

  • Make EncodeDDSHeader public
  • Write a new function, SaveDDSMipmapToMemory(bool fastpath, const DirectX::Image image, It &out, const DirectX::TexMetadata &metadata)
  • Make this function take an output iterator, instead of a Blob
  • Make SaveDDSToMemory use this function, and take an output iterator instead of a blob
  • Other required changes for this to work

Would you accept such a Pull Request ?

Currently, I have duplicated DirectXTex code, and customized it. But obviously, it's not ideal

Thanks

The ScratchImage structure is actually laid you exactly the way DDS files are laid out, so you can just binary write out the memory it creates. If you look at the implementation of SaveDDSTo* you'll see this pretty clearly. The GetImage method will index into the specific mip levels.

So mostly this is a request to make the functionality of EncodeDDSHeader public...

Thanks for this quick answer. About ScratchImage, got it. This will make it easier, thanks

So mostly this is a request to make the functionality of EncodeDDSHeader public...
Exactly