Skip to content

Commit

Permalink
Fix review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
wasimabbas-arm committed Jan 28, 2025
1 parent de906e2 commit f1b94c8
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tools/ktx/command_create.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ struct OptionsCreate {
(kNormalize, "Normalize input normals to have a unit length. Only valid for\n"
"linear normal textures with 2 or more components. For 2-component inputs\n"
"2D unit normals are calculated. Do not use these 2D unit normals\n"
"to generate X+Y normals for --normal-mode. For 4-component inputs\n"
"to generate X+Y normals with --normal-mode. For 4-component inputs\n"
"a 3D unit normal is calculated. 1.0 is used for the value of the\n"
"4th component.\n")
(kSwizzle, "KTX swizzle metadata.", cxxopts::value<std::string>(), "[rgba01]{4}")
Expand Down Expand Up @@ -798,7 +798,7 @@ Create a KTX2 file from various input files.
<dd>Normalize input normals to have a unit length. Only valid for
linear normal textures with 2 or more components. For 2-component inputs
2D unit normals are calculated. Do not use these 2D unit normals
to generate X+Y normals for --normal-mode. For 4-component inputs
to generate X+Y normals with @b --normal-mode. For 4-component inputs
a 3D unit normal is calculated. 1.0 is used for the value of the
4th component.</dd>
<dt>\--swizzle [rgba01]{4}</dt>
Expand Down Expand Up @@ -1347,8 +1347,15 @@ void CommandCreate::executeCreate() {
image->yflip();
}

if (options.normalize)
if (options.normalize) {
if (colorSpaceInfo.usedInputTransferFunction != KHR_DF_TRANSFER_LINEAR) {
fatal(rc::INVALID_FILE,
"Input file \"{}\" transfer functions is not linear. "
"Use --assign-oetf=linear or --convert-oetf=linear to avoid this error.",
fmtInFile(inputFilepath));
}
image->normalize();
}

if (options.swizzleInput)
image->swizzle(*options.swizzleInput);
Expand Down

0 comments on commit f1b94c8

Please sign in to comment.