Skip to content
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

Use of the --format flag? (v4.3 alpha) #726

Closed
donmccurdy opened this issue Jul 3, 2023 · 5 comments
Closed

Use of the --format flag? (v4.3 alpha) #726

donmccurdy opened this issue Jul 3, 2023 · 5 comments
Assignees

Comments

@donmccurdy
Copy link
Contributor

donmccurdy commented Jul 3, 2023

The new --format flag is described in the CLI help text as:

KTX format enum. The enum names are matching the VkFormats without the VK_FORMAT_ prefix. If the format is an ASTC formats the ASTC encoder specific options become valid, otherwise they are ignored. Required. The VK_FORMAT_ prefix is ignored if present. Case insensitive.

From this description I'm left wondering, "KTX format enum [of what?]". If I weren't specifying --encode uastc I might assume that the source texture will be encoded into the specified format. If I were, I might assume either (a) I need to choose specify VK_FORMAT_UNDEFINED (as required for UASTC output) or (b) some enum value that abstractly describes the structure of the input data, even if the source format (e.g. PNG) uses a very different pixel data representation.

Clarification on this flag's help description would be very helpful, particularly as it is a required flag. Thanks!

@MarkCallow
Copy link
Collaborator

It is the value to be use for the vkFormat field of the KTX file's header.

Good questions. @VaderY please clarify the documentation.

@VaderDev
Copy link
Contributor

VaderDev commented Jul 4, 2023

When using with --encode the --format option specifies the format of your input files before the encoding step. When using --encode it must be one of:
R8_UNORM
R8_SRGB
R8G8_UNORM
R8G8_SRGB
R8G8B8_UNORM
R8G8B8_SRGB
R8G8B8A8_UNORM
R8G8B8A8_SRGB

The format will be used to verify and load all your input files into a texture before encoding, The VK_FORMAT_UNDEFINED value will be set by the encoders and should never be specified.

@MarkCallow
Copy link
Collaborator

This is a great explanation. Please add it to the docs.

@donmccurdy
Copy link
Contributor Author

When using with --encode the --format option specifies the format of your input files before the encoding step.

Thanks! One further question. Suppose I know the image is an ambient occlusion texture, and that the data I care about is in the R channel. I'm not sure whether the image contains other data in the G or B channels, but I'm sure those channels do not matter for my application. Could I safely choose R8_UNORM here, or do I need to determine the actual contents of the input file and specify that, instead?

@VaderDev
Copy link
Contributor

VaderDev commented Jul 4, 2023

Yes you can safely use R8_UNORM. Unused channels from the input are discarded silently.
Using the least amount of channels necessary is nearly always the best option as encoders may generate better compression or quality with less channels.

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

No branches or pull requests

4 participants