Skip to content

Commit 44e1bcd

Browse files
committed
Fixing some bugs related to changing the default from -tex_array to -individual:
- If -output_file is specified and there's more than 1 input, it errors out as this would overwrite the output file multiple times - Tex types cubemap/3D default to tex_array mode
1 parent 19111ce commit 44e1bcd

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

basisu_tool.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -706,9 +706,15 @@ class command_line_params
706706
m_individual = false;
707707
}
708708
else if (strcasecmp(pType, "3d") == 0)
709+
{
709710
m_comp_params.m_tex_type = basist::cBASISTexTypeVolume;
711+
m_individual = false;
712+
}
710713
else if (strcasecmp(pType, "cubemap") == 0)
714+
{
711715
m_comp_params.m_tex_type = basist::cBASISTexTypeCubemapArray;
716+
m_individual = false;
717+
}
712718
else if (strcasecmp(pType, "video") == 0)
713719
{
714720
m_comp_params.m_tex_type = basist::cBASISTexTypeVideoFrames;
@@ -1074,6 +1080,16 @@ static bool compress_mode(command_line_params &opts)
10741080
const size_t total_files = (opts.m_individual ? opts.m_input_filenames.size() : 1U);
10751081
bool result = true;
10761082

1083+
if ((opts.m_individual) && (opts.m_output_filename.size()))
1084+
{
1085+
if (total_files > 1)
1086+
{
1087+
error_printf("-output_file specified in individual mode, but multiple input files have been specified which would cause the output file to be written multiple times.\n");
1088+
delete pGlobal_codebook_data; pGlobal_codebook_data = nullptr;
1089+
return false;
1090+
}
1091+
}
1092+
10771093
for (size_t file_index = 0; file_index < total_files; file_index++)
10781094
{
10791095
if (opts.m_individual)
@@ -1102,8 +1118,8 @@ static bool compress_mode(command_line_params &opts)
11021118
params.m_source_filenames = opts.m_input_filenames;
11031119
params.m_source_alpha_filenames = opts.m_input_alpha_filenames;
11041120
}
1105-
1106-
if ((opts.m_output_filename.size()) && (!opts.m_individual))
1121+
1122+
if (opts.m_output_filename.size())
11071123
params.m_out_filename = opts.m_output_filename;
11081124
else
11091125
{

0 commit comments

Comments
 (0)