From 47fbfa1615cffe23ea4d8dafb94d01c0a67eef14 Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Thu, 13 Sep 2012 16:57:10 -0400 Subject: [PATCH] Avoid SIMD functions if they're not defined. --- Core/src/TexComp.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Core/src/TexComp.cpp b/Core/src/TexComp.cpp index 7792d5a..d288eab 100644 --- a/Core/src/TexComp.cpp +++ b/Core/src/TexComp.cpp @@ -34,12 +34,16 @@ static CompressionFunc ChooseFuncFromSettings(const SCompressionSettings &s) { case eCompressionFormat_BPTC: { BC7C::SetQualityLevel(s.iQuality); +#ifdef HAS_SSE_41 if(s.bUseSIMD) { return BC7C::CompressImageBC7SIMD; } else { +#endif return BC7C::CompressImageBC7; +#ifdef HAS_SSE_41 } +#endif } break; } @@ -54,7 +58,16 @@ CompressedImage * CompressImage( const ImageFile &img, 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; // Allocate data based on the compression method