From 6d22ebb4fc8da473aab7d7753b40d6ce04def6d1 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 26 May 2017 01:02:19 +0300 Subject: Fix compilation without simd support. --- src/resources/dye/dyepalette.cpp | 38 ++++++++++++++++++--------- src/resources/dye/dyepalette.h | 55 +++++++++++++++++++++------------------- 2 files changed, 55 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/resources/dye/dyepalette.cpp b/src/resources/dye/dyepalette.cpp index b8346058f..75e4c567b 100644 --- a/src/resources/dye/dyepalette.cpp +++ b/src/resources/dye/dyepalette.cpp @@ -44,18 +44,23 @@ #include "debug.h" +#ifdef SIMD_SUPPORTED DyeFunctionPtr DyePalette::funcReplaceSColor = nullptr; DyeFunctionPtr DyePalette::funcReplaceSColorSse2 = nullptr; DyeFunctionPtr DyePalette::funcReplaceSColorAvx2 = nullptr; -DyeFunctionPtr DyePalette::funcReplaceSOGLColor = nullptr; -DyeFunctionPtr DyePalette::funcReplaceSOGLColorSse2 = nullptr; -DyeFunctionPtr DyePalette::funcReplaceSOGLColorAvx2 = nullptr; DyeFunctionPtr DyePalette::funcReplaceAColor = nullptr; DyeFunctionPtr DyePalette::funcReplaceAColorSse2 = nullptr; DyeFunctionPtr DyePalette::funcReplaceAColorAvx2 = nullptr; + +#ifdef USE_OPENGL +DyeFunctionPtr DyePalette::funcReplaceSOGLColor = nullptr; +DyeFunctionPtr DyePalette::funcReplaceSOGLColorSse2 = nullptr; +DyeFunctionPtr DyePalette::funcReplaceSOGLColorAvx2 = nullptr; DyeFunctionPtr DyePalette::funcReplaceAOGLColor = nullptr; DyeFunctionPtr DyePalette::funcReplaceAOGLColorSse2 = nullptr; DyeFunctionPtr DyePalette::funcReplaceAOGLColorAvx2 = nullptr; +#endif // USE_OPENGL +#endif // SIMD_SUPPORTED DyePalette::DyePalette(const std::string &restrict description, const uint8_t blockSize) : @@ -251,30 +256,36 @@ void DyePalette::initFunctions() funcReplaceSColor = &DyePalette::replaceSColorAvx2; funcReplaceSColorAvx2 = &DyePalette::replaceSColorAvx2; funcReplaceSColorSse2 = &DyePalette::replaceSColorSse2; - funcReplaceSOGLColor = &DyePalette::replaceSOGLColorAvx2; - funcReplaceSOGLColorAvx2 = &DyePalette::replaceSOGLColorAvx2; - funcReplaceSOGLColorSse2 = &DyePalette::replaceSOGLColorSse2; funcReplaceAColor = &DyePalette::replaceAColorAvx2; funcReplaceAColorAvx2 = &DyePalette::replaceAColorAvx2; funcReplaceAColorSse2 = &DyePalette::replaceAColorSse2; + +#ifdef USE_OPENGL + funcReplaceSOGLColor = &DyePalette::replaceSOGLColorAvx2; + funcReplaceSOGLColorAvx2 = &DyePalette::replaceSOGLColorAvx2; + funcReplaceSOGLColorSse2 = &DyePalette::replaceSOGLColorSse2; funcReplaceAOGLColor = &DyePalette::replaceAOGLColorAvx2; funcReplaceAOGLColorAvx2 = &DyePalette::replaceAOGLColorAvx2; funcReplaceAOGLColorSse2 = &DyePalette::replaceAOGLColorSse2; +#endif // USE_OPENGL } else if (flags & Cpu::FEATURE_SSE2) { funcReplaceSColor = &DyePalette::replaceSColorSse2; funcReplaceSColorAvx2 = &DyePalette::replaceSColorSse2; funcReplaceSColorSse2 = &DyePalette::replaceSColorSse2; - funcReplaceSOGLColor = &DyePalette::replaceSOGLColorSse2; - funcReplaceSOGLColorAvx2 = &DyePalette::replaceSOGLColorSse2; - funcReplaceSOGLColorSse2 = &DyePalette::replaceSOGLColorSse2; funcReplaceAColor = &DyePalette::replaceAColorSse2; funcReplaceAColorAvx2 = &DyePalette::replaceAColorSse2; funcReplaceAColorSse2 = &DyePalette::replaceAColorSse2; + +#ifdef USE_OPENGL + funcReplaceSOGLColor = &DyePalette::replaceSOGLColorSse2; + funcReplaceSOGLColorAvx2 = &DyePalette::replaceSOGLColorSse2; + funcReplaceSOGLColorSse2 = &DyePalette::replaceSOGLColorSse2; funcReplaceAOGLColor = &DyePalette::replaceAOGLColorSse2; funcReplaceAOGLColorAvx2 = &DyePalette::replaceAOGLColorSse2; funcReplaceAOGLColorSse2 = &DyePalette::replaceAOGLColorSse2; +#endif // USE_OPENGL } else #endif // SIMD_SUPPORTED @@ -282,14 +293,17 @@ void DyePalette::initFunctions() funcReplaceSColor = &DyePalette::replaceSColorDefault; funcReplaceSColorAvx2 = &DyePalette::replaceSColorDefault; funcReplaceSColorSse2 = &DyePalette::replaceSColorDefault; - funcReplaceSOGLColor = &DyePalette::replaceSOGLColorDefault; - funcReplaceSOGLColorAvx2 = &DyePalette::replaceSOGLColorDefault; - funcReplaceSOGLColorSse2 = &DyePalette::replaceSOGLColorDefault; funcReplaceAColor = &DyePalette::replaceAColorDefault; funcReplaceAColorAvx2 = &DyePalette::replaceAColorDefault; funcReplaceAColorSse2 = &DyePalette::replaceAColorDefault; + +#ifdef USE_OPENGL + funcReplaceSOGLColor = &DyePalette::replaceSOGLColorDefault; + funcReplaceSOGLColorAvx2 = &DyePalette::replaceSOGLColorDefault; + funcReplaceSOGLColorSse2 = &DyePalette::replaceSOGLColorDefault; funcReplaceAOGLColor = &DyePalette::replaceAOGLColorDefault; funcReplaceAOGLColorAvx2 = &DyePalette::replaceAOGLColorDefault; funcReplaceAOGLColorSse2 = &DyePalette::replaceAOGLColorDefault; +#endif // USE_OPENGL } } diff --git a/src/resources/dye/dyepalette.h b/src/resources/dye/dyepalette.h index 06473ec69..80e5f53c2 100644 --- a/src/resources/dye/dyepalette.h +++ b/src/resources/dye/dyepalette.h @@ -73,6 +73,12 @@ class DyePalette final void replaceSColorDefault(uint32_t *restrict pixels, const int bufSize) const restrict2; + /** + * replace colors for SDL for A dye. + */ + void replaceAColorDefault(uint32_t *restrict pixels, + const int bufSize) const restrict2; + #ifdef SIMD_SUPPORTED /** * replace colors for SDL for S dye. @@ -87,15 +93,7 @@ class DyePalette final __attribute__ ((target ("avx2"))) void replaceSColorAvx2(uint32_t *restrict pixels, const int bufSize) const restrict2; -#endif // SIMD_SUPPORTED - /** - * replace colors for SDL for A dye. - */ - void replaceAColorDefault(uint32_t *restrict pixels, - const int bufSize) const restrict2; - -#ifdef SIMD_SUPPORTED /** * replace colors for SDL for A dye. */ @@ -118,6 +116,13 @@ class DyePalette final void replaceSOGLColorDefault(uint32_t *restrict pixels, const int bufSize) const restrict2; #ifdef SIMD_SUPPORTED + /** + * replace colors for OpenGL for A dye. + */ + __attribute__ ((target ("avx2"))) + void replaceAOGLColorAvx2(uint32_t *restrict pixels, + const int bufSize) const restrict2; + /** * replace colors for OpenGL for S dye. */ @@ -130,28 +135,21 @@ class DyePalette final __attribute__ ((target ("avx2"))) void replaceSOGLColorAvx2(uint32_t *restrict pixels, const int bufSize) const restrict2; -#endif // SIMD_SUPPORTED - /** - * replace colors for OpenGL for A dye. - */ - void replaceAOGLColorDefault(uint32_t *restrict pixels, - const int bufSize) const restrict2; - -#ifdef SIMD_SUPPORTED /** * replace colors for OpenGL for A dye. */ __attribute__ ((target ("sse2"))) void replaceAOGLColorSse2(uint32_t *restrict pixels, const int bufSize) const restrict2; +#endif // SIMD_SUPPORTED + /** * replace colors for OpenGL for A dye. */ - __attribute__ ((target ("avx2"))) - void replaceAOGLColorAvx2(uint32_t *restrict pixels, - const int bufSize) const restrict2; -#endif // SIMD_SUPPORTED + void replaceAOGLColorDefault(uint32_t *restrict pixels, + const int bufSize) const restrict2; + #endif // USE_OPENGL static unsigned int hexDecode(const signed char c) @@ -163,18 +161,23 @@ class DyePalette final static void initFunctions(); - static DyeFunctionPtr funcReplaceSColor; - static DyeFunctionPtr funcReplaceSColorSse2; - static DyeFunctionPtr funcReplaceSColorAvx2; +#ifdef SIMD_SUPPORTED +#ifdef USE_OPENGL static DyeFunctionPtr funcReplaceSOGLColor; static DyeFunctionPtr funcReplaceSOGLColorSse2; static DyeFunctionPtr funcReplaceSOGLColorAvx2; - static DyeFunctionPtr funcReplaceAColor; - static DyeFunctionPtr funcReplaceAColorSse2; - static DyeFunctionPtr funcReplaceAColorAvx2; static DyeFunctionPtr funcReplaceAOGLColor; static DyeFunctionPtr funcReplaceAOGLColorSse2; static DyeFunctionPtr funcReplaceAOGLColorAvx2; +#endif // USE_OPENGL + + static DyeFunctionPtr funcReplaceSColor; + static DyeFunctionPtr funcReplaceSColorSse2; + static DyeFunctionPtr funcReplaceSColorAvx2; + static DyeFunctionPtr funcReplaceAColor; + static DyeFunctionPtr funcReplaceAColorSse2; + static DyeFunctionPtr funcReplaceAColorAvx2; +#endif // SIMD_SUPPORTED #ifndef UNITTESTS private: -- cgit v1.2.3-60-g2f50