Avoid SIMD functions if they're not defined.

This commit is contained in:
Pavel Krajcevski 2012-09-13 16:57:10 -04:00
parent a850cf0103
commit 47fbfa1615

View file

@ -34,12 +34,16 @@ static CompressionFunc ChooseFuncFromSettings(const SCompressionSettings &s) {
case eCompressionFormat_BPTC: case eCompressionFormat_BPTC:
{ {
BC7C::SetQualityLevel(s.iQuality); BC7C::SetQualityLevel(s.iQuality);
#ifdef HAS_SSE_41
if(s.bUseSIMD) { if(s.bUseSIMD) {
return BC7C::CompressImageBC7SIMD; return BC7C::CompressImageBC7SIMD;
} }
else { else {
#endif
return BC7C::CompressImageBC7; return BC7C::CompressImageBC7;
#ifdef HAS_SSE_41
} }
#endif
} }
break; break;
} }
@ -54,7 +58,16 @@ CompressedImage * CompressImage(
const ImageFile &img, const ImageFile &img,
const SCompressionSettings &settings const SCompressionSettings &settings
) { ) {
// Make sure that platform supports SSE if they chose this
// option...
#ifndef HAS_SSE_41
if(settings.bUseSIMD) {
ReportError("Platform does not support SIMD!\n");
return NULL;
}
#endif
const unsigned int dataSz = img.GetWidth() * img.GetHeight() * 4; const unsigned int dataSz = img.GetWidth() * img.GetHeight() * 4;
// Allocate data based on the compression method // Allocate data based on the compression method