Skip to content

Commit

Permalink
Fixing some bugs related to changing the default from -tex_array to -…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
richgel999 committed Feb 12, 2022
1 parent 19111ce commit 44e1bcd
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions basisu_tool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -706,9 +706,15 @@ class command_line_params
m_individual = false;
}
else if (strcasecmp(pType, "3d") == 0)
{
m_comp_params.m_tex_type = basist::cBASISTexTypeVolume;
m_individual = false;
}
else if (strcasecmp(pType, "cubemap") == 0)
{
m_comp_params.m_tex_type = basist::cBASISTexTypeCubemapArray;
m_individual = false;
}
else if (strcasecmp(pType, "video") == 0)
{
m_comp_params.m_tex_type = basist::cBASISTexTypeVideoFrames;
Expand Down Expand Up @@ -1074,6 +1080,16 @@ static bool compress_mode(command_line_params &opts)
const size_t total_files = (opts.m_individual ? opts.m_input_filenames.size() : 1U);
bool result = true;

if ((opts.m_individual) && (opts.m_output_filename.size()))
{
if (total_files > 1)
{
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");
delete pGlobal_codebook_data; pGlobal_codebook_data = nullptr;
return false;
}
}

for (size_t file_index = 0; file_index < total_files; file_index++)
{
if (opts.m_individual)
Expand Down Expand Up @@ -1102,8 +1118,8 @@ static bool compress_mode(command_line_params &opts)
params.m_source_filenames = opts.m_input_filenames;
params.m_source_alpha_filenames = opts.m_input_alpha_filenames;
}

if ((opts.m_output_filename.size()) && (!opts.m_individual))
if (opts.m_output_filename.size())
params.m_out_filename = opts.m_output_filename;
else
{
Expand Down

0 comments on commit 44e1bcd

Please sign in to comment.