From 93b77d28c78c4da928186aa05467be2359445176 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1ty=C3=A1s=20Cs=C3=A1sz=C3=A1r?= Date: Fri, 7 Jul 2023 12:32:53 +0200 Subject: [PATCH] Resolve PR comments --- tests/cts | 2 +- tools/ktx/command_create.cpp | 49 ++++++++++++++++++++++++++---------- 2 files changed, 37 insertions(+), 14 deletions(-) diff --git a/tests/cts b/tests/cts index 98ca94bbef..7dae4c5b20 160000 --- a/tests/cts +++ b/tests/cts @@ -1 +1 @@ -Subproject commit 98ca94bbefd35ae32407b42684873fb25e971b50 +Subproject commit 7dae4c5b2077f1646e3e3e766d408af18469f0a4 diff --git a/tools/ktx/command_create.cpp b/tools/ktx/command_create.cpp index 4c401002e9..95d74a853a 100644 --- a/tools/ktx/command_create.cpp +++ b/tools/ktx/command_create.cpp @@ -72,10 +72,19 @@ struct OptionsCreate { ("format", "KTX format enum that specifies the image data format." " The enum names are matching the VkFormats without the VK_FORMAT_ prefix." " The VK_FORMAT_ prefix is ignored if present." - " If the --encode option is used it specifies the format created from the" - " the input files before the encoding step." - " If the format is an ASTC format the ASTC encoder specific options become valid," + "\nWhen used with --encode it specifies the format of the input files before the encoding step." + " In this case it must be one of:" + "\n R8_UNORM" + "\n R8_SRGB" + "\n R8G8_UNORM" + "\n R8G8_SRGB" + "\n R8G8B8_UNORM" + "\n R8G8B8_SRGB" + "\n R8G8B8A8_UNORM" + "\n R8G8B8A8_SRGB" + "\nIf the format is an ASTC format the ASTC encoder specific options become valid," " otherwise they are ignored." + "\nThe format will be used to verify and load all input files into a texture before encoding." " Case insensitive. Required.", cxxopts::value(), "") ("1d", "Create a 1D texture. If not set the texture will be a 2D or 3D texture.") ("cubemap", "Create a cubemap texture. If not set the texture will be a 2D or 3D texture.") @@ -623,11 +632,22 @@ Create a KTX2 file from various input files.
--format <enum>
KTX format enum that specifies the image data format. The enum names are matching the VkFormats without the VK_FORMAT_ prefix. - The VK_FORMAT_ prefix is ignored if present. - If the --encode option is used it specifies the format created from the - the input files before the encoding step. + The VK_FORMAT_ prefix is ignored if present.
+ When used with --encode it specifies the format of the input files before the encoding step. + In this case it must be one of: +
    +
  • R8_UNORM
  • +
  • R8_SRGB
  • +
  • R8G8_UNORM
  • +
  • R8G8_SRGB
  • +
  • R8G8B8_UNORM
  • +
  • R8G8B8_SRGB
  • +
  • R8G8B8A8_UNORM
  • +
  • R8G8B8A8_SRGB
  • +
If the format is an ASTC format the ASTC encoder specific options become valid, - otherwise they are ignored. + otherwise they are ignored.
+ The format will be used to verify and load all input files into a texture before encoding.
Case insensitive. Required.
--astc-mode <ldr | hdr>
@@ -2129,7 +2149,7 @@ void CommandCreate::checkSpecsMatch(const ImageInput& currentFile, const ImageSp if (currentFormat.transfer() != firstFormat.transfer()) { if (options.assignOETF.has_value()) { warning("Input image \"{}\" has different transfer function ({}) than the first image ({})" - " but will be threaded identically as specified by the --assign-oetf option.", + " but will be treated identically as specified by the --assign-oetf option.", currentFile.filename(), toString(currentFormat.transfer()), toString(firstFormat.transfer())); } else if (options.convertOETF.has_value()) { warning("Input image \"{}\" has different transfer function ({}) than the first image ({})" @@ -2137,7 +2157,8 @@ void CommandCreate::checkSpecsMatch(const ImageInput& currentFile, const ImageSp " function specified by the --convert-oetf option.", currentFile.filename(), toString(currentFormat.transfer()), toString(firstFormat.transfer())); } else { - fatal(rc::INVALID_FILE, "Input image \"{}\" has different transfer function ({}) than the first image ({}).", + fatal(rc::INVALID_FILE, "Input image \"{}\" has different transfer function ({}) than the first image ({})." + " Use --assign-oetf or --convert-oetf to specify handling and stop this error.", currentFile.filename(), toString(currentFormat.transfer()), toString(firstFormat.transfer())); } } @@ -2147,7 +2168,7 @@ void CommandCreate::checkSpecsMatch(const ImageInput& currentFile, const ImageSp auto firstGamma = firstFormat.oeGamma() != -1 ? std::to_string(firstFormat.oeGamma()) : "no gamma"; if (options.assignOETF.has_value()) { warning("Input image \"{}\" has different gamma ({}) than the first image ({})" - " but will be threaded identically as specified by the --assign-oetf option.", + " but will be treated identically as specified by the --assign-oetf option.", currentFile.filename(), currentGamma, firstGamma); } else if (options.convertOETF.has_value()) { warning("Input image \"{}\" has different gamma ({}) than the first image ({})" @@ -2155,7 +2176,8 @@ void CommandCreate::checkSpecsMatch(const ImageInput& currentFile, const ImageSp " function specified by the --convert-oetf option.", currentFile.filename(), currentGamma, firstGamma); } else { - fatal(rc::INVALID_FILE, "Input image \"{}\" has different gamma ({}) than the first image ({}).", + fatal(rc::INVALID_FILE, "Input image \"{}\" has different gamma ({}) than the first image ({})." + " Use --assign-oetf or --convert-oetf to specify handling and stop this error.", currentFile.filename(), currentGamma, firstGamma); } } @@ -2163,7 +2185,7 @@ void CommandCreate::checkSpecsMatch(const ImageInput& currentFile, const ImageSp if (currentFormat.primaries() != firstFormat.primaries()) { if (options.assignPrimaries.has_value()) { warning("Input image \"{}\" has different primaries ({}) than the first image ({})" - " but will be threaded identically as specified by the --assign-primaries option.", + " but will be treated identically as specified by the --assign-primaries option.", currentFile.filename(), toString(currentFormat.primaries()), toString(firstFormat.primaries())); } else if (options.convertPrimaries.has_value()) { warning("Input image \"{}\" has different primaries ({}) than the first image ({})" @@ -2171,7 +2193,8 @@ void CommandCreate::checkSpecsMatch(const ImageInput& currentFile, const ImageSp " specified by the --convert-primaries option.", currentFile.filename(), toString(currentFormat.primaries()), toString(firstFormat.primaries())); } else { - fatal(rc::INVALID_FILE, "Input image \"{}\" has different primaries ({}) than the first image ({}).", + fatal(rc::INVALID_FILE, "Input image \"{}\" has different primaries ({}) than the first image ({})." + " Use --assign-primaries or --convert-primaries to specify handling and stop this error.", currentFile.filename(), toString(currentFormat.primaries()), toString(firstFormat.primaries())); } }