KhronosGroup / KTX-Software

KTX (Khronos Texture) Library and Tools
Other
877 stars 229 forks source link

No `ktx` tool writes KTXwriterScParams metadata. #758

Closed MarkCallow closed 1 year ago

MarkCallow commented 1 year ago

I've only just noticed this. Something else I missed during project review.

@aqnuep I don't expect you do fix this but please give me a clue as to how to capture the relevant options (names and values) to a std::string in cxxopts to become the value of KTXwriterScParams. The options to be captured are those in compress_utils.h, encode_utils.h and the ASTC options in ktx create.

The information is incredibly useful when looking at an existing .ktx2 file to see exactly how it was compressed.

aqnuep commented 1 year ago

Hi @MarkCallow, what you suggest makes some sense, and something that would not be difficult to add.

However, section 5.6 of the spec defining KTXwriterScParams says the following:

KTX file writers may, and are strongly encouraged to, identify any
non-default Basis Universal encoding and supercompression options
specified when the file is created by including a value with the key

This parameter is supposed to only store super-compression parameters (BasisU, Zstd, Zlib), but ASTC is not a super-compression, hence I'm not sure whether it would make a lot of sense to include its parameters there. Maybe it's worth clarifying the spec if this attribute is meant to capture all sorts of compression/encoding related parameters.

MarkCallow commented 1 year ago

I will clarify the spec. That was written before the ASTC encoder was added and the metadata originally added before UASTC hence its now rather inappropriate name. Supporting UASTC was rectified by amending the original language to "Basis Universal".

The intent when I came up with the idea, and the intent today, is to capture information about encoding that can not be determined from examining the header and format information. I was fed up trying to create meaningful and short file names to indicate the information.