microsoft / DirectXTex

DirectXTex texture processing library
https://walbourn.github.io/directxtex/
MIT License
1.81k stars 447 forks source link

Expose EncodeDDSHeader from DirectXTexXboxDDS.cpp #496

Closed helviett closed 2 months ago

helviett commented 2 months ago

Right now the only way to save XDDS using DirectXTex library is this:

... // image processing, compressing, tiling, etc.
Blob out;
Xbox::SaveToDDSMemory(tiled_image, out);
write_to_file(game_asset_bundle, out.GetBufferPointer(), out.GetBufferSize());

This additional copy can be avoided if EncodeDDSHeader used inside Xbox::SaveToDDSMemory is exposed:

uint8_t dds_header[XBOX_HEADER_SIZE];
Xbox::EncodeDDSHeader(tiled_image, dds_header, XBOX_HEADER_SIZE);
write_to_file(game_asset_bundle, dds_header, XBOX_HEADER_SIZE);
write_to_file(game_asset_bundle, tiled_image.GetPointer(), tiled_image.GetSize();
walbourn commented 2 months ago

Does Xbox::SaveToDDSFile not work for your scenario?

walbourn commented 2 months ago

You want the Xbox version of https://github.com/microsoft/DirectXTex/issues/249

helviett commented 2 months ago

Does Xbox::SaveToDDSFile not work for your scenario?

No, I have already opened file that contains multiple textures.

You want the Xbox version of https://github.com/microsoft/DirectXTex/issues/249 Yes, would be nice to make EncodeDDSHeader, XBOX_HEADER_SIZE, DDS_XBOX_HEADER public. Almost every engine I saw just have to copy these structures into their sources.

walbourn commented 2 months ago

The Xbox 'extension' is specific to my Auxiliary library, but I can look at moving the Xbox structs to dds.h.