mirror of
https://github.com/yuzu-emu/FasTC.git
synced 2025-01-09 03:05:39 +00:00
Add command line flags to choose between whether or not to use PVRTexLib or FasTC
This commit is contained in:
parent
219777687f
commit
ce7bb8e891
|
@ -101,6 +101,7 @@ int main(int argc, char **argv) {
|
||||||
bool bUseSIMD = false;
|
bool bUseSIMD = false;
|
||||||
bool bSaveLog = false;
|
bool bSaveLog = false;
|
||||||
bool bUseAtomics = false;
|
bool bUseAtomics = false;
|
||||||
|
bool bUsePVRTexLib = false;
|
||||||
ECompressionFormat format = eCompressionFormat_BPTC;
|
ECompressionFormat format = eCompressionFormat_BPTC;
|
||||||
|
|
||||||
bool knowArg = false;
|
bool knowArg = false;
|
||||||
|
@ -129,6 +130,9 @@ int main(int argc, char **argv) {
|
||||||
} else {
|
} else {
|
||||||
if(!strcmp(argv[fileArg], "PVRTC")) {
|
if(!strcmp(argv[fileArg], "PVRTC")) {
|
||||||
format = eCompressionFormat_PVRTC;
|
format = eCompressionFormat_PVRTC;
|
||||||
|
} else if(!strcmp(argv[fileArg], "PVRTCLib")) {
|
||||||
|
format = eCompressionFormat_PVRTC;
|
||||||
|
bUsePVRTexLib = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,6 +239,7 @@ int main(int argc, char **argv) {
|
||||||
settings.iQuality = quality;
|
settings.iQuality = quality;
|
||||||
settings.iNumCompressions = numCompressions;
|
settings.iNumCompressions = numCompressions;
|
||||||
settings.iJobSize = numJobs;
|
settings.iJobSize = numJobs;
|
||||||
|
settings.bUsePVRTexLib = bUsePVRTexLib;
|
||||||
if(bSaveLog) {
|
if(bSaveLog) {
|
||||||
settings.logStream = &logStream;
|
settings.logStream = &logStream;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -105,12 +105,26 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||||
bool bUseSIMD = false;
|
bool bUseSIMD = false;
|
||||||
bool bSaveLog = false;
|
bool bSaveLog = false;
|
||||||
bool bUseAtomics = false;
|
bool bUseAtomics = false;
|
||||||
|
bool bUsePVRTexLib = false;
|
||||||
ECompressionFormat format = eCompressionFormat_BPTC;
|
ECompressionFormat format = eCompressionFormat_BPTC;
|
||||||
|
|
||||||
bool knowArg = false;
|
bool knowArg = false;
|
||||||
do {
|
do {
|
||||||
knowArg = false;
|
knowArg = false;
|
||||||
|
|
||||||
|
if(strcmp(argv[fileArg], "-n") == 0) {
|
||||||
|
fileArg++;
|
||||||
|
|
||||||
|
if(fileArg == argc || (numCompressions = atoi(argv[fileArg])) < 0) {
|
||||||
|
PrintUsage();
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
fileArg++;
|
||||||
|
knowArg = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if(strcmp(argv[fileArg], "-f") == 0) {
|
if(strcmp(argv[fileArg], "-f") == 0) {
|
||||||
fileArg++;
|
fileArg++;
|
||||||
|
|
||||||
|
@ -120,6 +134,9 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||||
} else {
|
} else {
|
||||||
if(!strcmp(argv[fileArg], "PVRTC")) {
|
if(!strcmp(argv[fileArg], "PVRTC")) {
|
||||||
format = eCompressionFormat_PVRTC;
|
format = eCompressionFormat_PVRTC;
|
||||||
|
} else if(!strcmp(argv[fileArg], "PVRTCLib")) {
|
||||||
|
format = eCompressionFormat_PVRTC;
|
||||||
|
bUsePVRTexLib = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,19 +145,6 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strcmp(argv[fileArg], "-n") == 0) {
|
|
||||||
fileArg++;
|
|
||||||
|
|
||||||
if(fileArg == argc || (numCompressions = atoi(argv[fileArg])) < 0) {
|
|
||||||
PrintUsage();
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
fileArg++;
|
|
||||||
knowArg = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(strcmp(argv[fileArg], "-l") == 0) {
|
if(strcmp(argv[fileArg], "-l") == 0) {
|
||||||
fileArg++;
|
fileArg++;
|
||||||
bSaveLog = true;
|
bSaveLog = true;
|
||||||
|
@ -200,6 +204,7 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||||
knowArg = true;
|
knowArg = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
} while(knowArg && fileArg < argc);
|
} while(knowArg && fileArg < argc);
|
||||||
|
|
||||||
if(fileArg == argc) {
|
if(fileArg == argc) {
|
||||||
|
@ -238,10 +243,12 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||||
settings.iQuality = quality;
|
settings.iQuality = quality;
|
||||||
settings.iNumCompressions = numCompressions;
|
settings.iNumCompressions = numCompressions;
|
||||||
settings.iJobSize = numJobs;
|
settings.iJobSize = numJobs;
|
||||||
if(bSaveLog)
|
settings.bUsePVRTexLib = bUsePVRTexLib;
|
||||||
|
if(bSaveLog) {
|
||||||
settings.logStream = &logStream;
|
settings.logStream = &logStream;
|
||||||
else
|
} else {
|
||||||
settings.logStream = NULL;
|
settings.logStream = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
CompressedImage *ci = CompressImage(&img, settings);
|
CompressedImage *ci = CompressImage(&img, settings);
|
||||||
if(NULL == ci) {
|
if(NULL == ci) {
|
||||||
|
@ -268,8 +275,8 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
delete ci;
|
delete ci;
|
||||||
if(bSaveLog)
|
if(bSaveLog) {
|
||||||
logFile.close();
|
logFile.close();
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,6 +86,11 @@ struct SCompressionSettings {
|
||||||
// in the platform and compiler will provide synchronization.
|
// in the platform and compiler will provide synchronization.
|
||||||
bool bUseAtomics;
|
bool bUseAtomics;
|
||||||
|
|
||||||
|
// This flag instructs the infrastructure to use the compression routine from
|
||||||
|
// PVRTexLib. If no such lib is found during configuration then this flag is
|
||||||
|
// ignored. The quality being used is the fastest compression quality.
|
||||||
|
bool bUsePVRTexLib;
|
||||||
|
|
||||||
// This is the output stream with which we should output the logs for the
|
// This is the output stream with which we should output the logs for the
|
||||||
// compression functions.
|
// compression functions.
|
||||||
std::ostream *logStream;
|
std::ostream *logStream;
|
||||||
|
|
|
@ -73,6 +73,15 @@ static void CompressPVRTC(const CompressionJob &cj) {
|
||||||
PVRTCC::Compress(cj);
|
PVRTCC::Compress(cj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void CompressPVRTCLib(const CompressionJob &cj) {
|
||||||
|
#ifdef PVRTEXLIB_FOUND
|
||||||
|
PVRTCC::CompressPVRLib(cj);
|
||||||
|
#else
|
||||||
|
fprintf(stderr, "WARNING: PVRTexLib not found, defaulting to FasTC implementation.\n");
|
||||||
|
PVRTCC::Compress(cj);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
SCompressionSettings:: SCompressionSettings()
|
SCompressionSettings:: SCompressionSettings()
|
||||||
: format(eCompressionFormat_BPTC)
|
: format(eCompressionFormat_BPTC)
|
||||||
, bUseSIMD(false)
|
, bUseSIMD(false)
|
||||||
|
@ -122,7 +131,11 @@ static CompressionFunc ChooseFuncFromSettings(const SCompressionSettings &s) {
|
||||||
|
|
||||||
case eCompressionFormat_PVRTC:
|
case eCompressionFormat_PVRTC:
|
||||||
{
|
{
|
||||||
return CompressPVRTC;
|
if(s.bUsePVRTexLib) {
|
||||||
|
return CompressPVRTCLib;
|
||||||
|
} else {
|
||||||
|
return CompressPVRTC;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue