Reworked the speed options to make more sense

This commit is contained in:
leblane 2023-04-28 19:06:32 +03:00
parent 4a31fcd91f
commit 4c1d77f524

View file

@ -41,7 +41,7 @@ const std::map<std::string, std::tuple<std::string, int, vk::Format>> formats =
{"BC7_SRGB", {"8 bit RGBA - Good general purpose. 16 bytes per block.", 16, vk::Format::eBc7SrgbBlock}} {"BC7_SRGB", {"8 bit RGBA - Good general purpose. 16 bytes per block.", 16, vk::Format::eBc7SrgbBlock}}
}; };
const std::string usage = "Usage: TextureConverter [cube|array] <input> [input2, input3...] <output> <format> [fast|slow|veryslow]"; const std::string usage = "Usage: TextureConverter [cube|array] <input> [input2, input3...] <output> <format> [fast|normal|slow|veryslow]";
int main(int argc, char ** argv) int main(int argc, char ** argv)
{ {
@ -69,19 +69,22 @@ int main(int argc, char ** argv)
option = "none"; option = "none";
} }
std::string speed(argv[argc - 1]); std::string speedString(argv[argc - 1]);
std::string formatString; std::string formatString;
bool fastMode = true; int speed = 2;
bool verySlow = false;
if (speed == "fast" || speed == "slow" || speed == "veryslow") { if (speedString == "fast" || speedString == "normal" || speedString == "slow" || speedString == "veryslow") {
formatString = std::string(argv[argc - 2]); formatString = std::string(argv[argc - 2]);
numInputs -= 1; numInputs -= 1;
if (speed == "slow") { if (speedString == "slow") {
fastMode = false; speed = 1;
} else if (speed == "veryslow") { } else if (speedString == "veryslow") {
fastMode = false; speed = 0;
verySlow = true; } else if (speedString == "fast") {
speed = 3;
} else {
speed = 2;
} }
} else { } else {
formatString = std::string(argv[argc - 1]); formatString = std::string(argv[argc - 1]);
@ -137,7 +140,7 @@ int main(int argc, char ** argv)
} }
std::cout << "Output: " << output << std::endl; std::cout << "Output: " << output << std::endl;
std::cout << "Format: " << formatString << std::endl; std::cout << "Format: " << formatString << std::endl;
std::cout << "Speed: " << (fastMode ? "Fast" : verySlow ? "Very slow" : "Slow") << std::endl; std::cout << "Speed: " << speed << std::endl;
int isa; int isa;
isa = ISPCIsa(); isa = ISPCIsa();
@ -280,27 +283,31 @@ int main(int argc, char ** argv)
bc7_enc_settings bc7enc; bc7_enc_settings bc7enc;
if (formatString == "BC6H") { if (formatString == "BC6H") {
if (fastMode) { if (speed == 0) {
GetProfile_bc6h_veryslow(&bc6henc);
} else if (speed == 1) {
GetProfile_bc6h_slow(&bc6henc);
} else if (speed == 2) {
GetProfile_bc6h_basic(&bc6henc); GetProfile_bc6h_basic(&bc6henc);
} else { } else if (speed == 3) {
if (verySlow) { GetProfile_bc6h_fast(&bc6henc);
GetProfile_bc6h_veryslow(&bc6henc);
} else {
GetProfile_bc6h_slow(&bc6henc);
}
} }
} else { } else {
if (channels == 3) { if (channels == 3) {
if (fastMode) { if (speed == 0 || speed == 1) {
GetProfile_basic(&bc7enc);
} else {
GetProfile_slow(&bc7enc); GetProfile_slow(&bc7enc);
} else if (speed == 2) {
GetProfile_basic(&bc7enc);
} else if (speed == 3) {
GetProfile_fast(&bc7enc);
} }
} else { } else {
if (fastMode) { if (speed == 0 || speed == 1) {
GetProfile_alpha_basic(&bc7enc);
} else {
GetProfile_alpha_slow(&bc7enc); GetProfile_alpha_slow(&bc7enc);
} else if (speed == 2) {
GetProfile_alpha_basic(&bc7enc);
} else if (speed == 3) {
GetProfile_alpha_fast(&bc7enc);
} }
} }
} }
@ -476,7 +483,7 @@ int main(int argc, char ** argv)
int barWidth = 70; int barWidth = 70;
std::cout << std::setw(2) << l << " ["; std::cout << std::setw(2) << l << " [";
int pos = barWidth * progress; int pos = (int)(barWidth * progress);
for (int i = 0; i < barWidth; ++i) { for (int i = 0; i < barWidth; ++i) {
if (i < pos) std::cout << "="; if (i < pos) std::cout << "=";
else if (i == pos) std::cout << ">"; else if (i == pos) std::cout << ">";