superdump / klafsa

Texture compression tool
Other
15 stars 1 forks source link

Command line flags not working #1

Open GitGhillie opened 2 months ago

GitGhillie commented 2 months ago

Following the example from the readme I'm doing: klafsa gltf --backend toktx --codec bc7 --container ktx2 Tower.gltf

But I'm getting:

error: Found argument '--backend' which wasn't expected, or isn't valid in this context

        If you tried to supply `--backend` as a value rather than a flag, use `-- --backend`

USAGE:
    klafsa.exe gltf [OPTIONS] <FILE_PATH>

For more information try --help

Any idea on what could be going wrong here? Also, I noticed the last update was 2 years ago, so if this is not the recommended tool anymore please let me know!

GitGhillie commented 2 months ago

Changing the order seems to do the trick: klafsa --backend toktx --codec astc --container ktx2 gltf Tower.gltf

Now to figure out why none of the codecs seem to be working...

Edit: I'll continue to document my journey in case it is useful for documentation / spotting issues.

Looking at https://github.com/superdump/klafsa/blob/f328d642dc0ce49f66d22420328d8579d7f126cd/src/compressor.rs#L38 it seems that each codec requires a specific backend, which makes me wonder why there is a --backend setting. I've installed kram and am now hitting the following:

PS C:\Rust\unreal-bevy\assets\gltf> klafsa --backend kram --codec bc7 --container ktx2 gltf Tower.gltf
2024-05-20T08:37:36.413438Z  INFO klafsa::gltf: Processing Tower.gltf
0/25 [00:00:00]/[00:00:00] ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
2024-05-20T08:37:36.420321Z ERROR klafsa::gltf: T_Timbers_BaseColor.png -> bc7_ktx2\T_Timbers_BaseColor_bc7.ktx2 - Failed to execute command: Os { code: 123, kind: InvalidFilename, message: "The filename, directory name, or volume label syntax is incorrect." }
2024-05-20T08:37:36.420542Z ERROR klafsa::gltf: MI_Timbers_MetallicRoughness.png -> bc7_ktx2\MI_Timbers_MetallicRoughness_bc7.ktx2 - Failed to execute command: Os { code: 123, kind: InvalidFilename, message: "The filename, directory name, or volume label syntax is incorrect." }
...

Edit: Got it working! I needed to specify the path: klafsa --backend kram --codec bc7 --container ktx2 gltf ./Tower.gltf Let me know if I can help out with a PR to address some of the things I found.