diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-05-05 21:15:28 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-05-05 23:52:00 +0300 |
commit | 9874a6311c6b51247caed248cfcf2d2e72095923 (patch) | |
tree | 0a1810721ddf2cb6ed4e1740e8bcf3da1cd21171 | |
parent | 55d8a832786175c5ff9c9ab2eaa31296d342490a (diff) | |
download | plus-9874a6311c6b51247caed248cfcf2d2e72095923.tar.gz plus-9874a6311c6b51247caed248cfcf2d2e72095923.tar.bz2 plus-9874a6311c6b51247caed248cfcf2d2e72095923.tar.xz plus-9874a6311c6b51247caed248cfcf2d2e72095923.zip |
Remove support for CILK plus.
-rwxr-xr-x | configure.ac | 11 | ||||
-rw-r--r-- | src/Makefile.am | 5 | ||||
-rw-r--r-- | src/game.cpp | 8 | ||||
-rw-r--r-- | src/localconsts.h | 43 | ||||
-rw-r--r-- | src/render/sdlgraphics.cpp | 10 | ||||
-rw-r--r-- | src/resources/dye/dye.cpp | 125 | ||||
-rw-r--r-- | src/resources/dye/dyepalette_replaceacolor.cpp | 42 | ||||
-rw-r--r-- | src/resources/dye/dyepalette_replaceaoglcolor.cpp | 126 | ||||
-rw-r--r-- | src/resources/dye/dyepalette_replacescolor.cpp | 39 | ||||
-rw-r--r-- | src/resources/dye/dyepalette_replacesoglcolor.cpp | 126 | ||||
-rw-r--r-- | src/resources/sdlimagehelper.cpp | 2 |
11 files changed, 10 insertions, 527 deletions
diff --git a/configure.ac b/configure.ac index 59f0519d4..7ab75e9bb 100755 --- a/configure.ac +++ b/configure.ac @@ -794,17 +794,6 @@ esac],[googleprofiler_enabled=false]) AM_CONDITIONAL(ENABLE_GOOGLE_PROFILER, test x$googleprofiler_enabled = xtrue) -# Enable cilk plus -AC_ARG_ENABLE(cilkplus, -[ --enable-cilkplus Turn on parallelisation with CilkPlus], -[case "${enableval}" in - yes) cilkplus_enabled=true ;; - no) cilkplus_enabled=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-cilkplus) ;; -esac],[cilkplus_enabled=false]) - -AM_CONDITIONAL(ENABLE_CILKPLUS, test x$cilkplus_enabled = xtrue) - # Enable gcc check plugin AC_ARG_ENABLE(checkplugin, [ --enable-checkplugin Turn on gcc check plugin], diff --git a/src/Makefile.am b/src/Makefile.am index ea67848a8..a0a7328ce 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -163,11 +163,6 @@ manaplus_SOURCES += manaplus.rc dyecmd_SOURCES += manaplus.rc endif -if ENABLE_CILKPLUS -dyecmd_CXXFLAGS += -DENABLE_CILKPLUS -fcilkplus -lcilkrts -manaplus_CXXFLAGS += -DENABLE_CILKPLUS -fcilkplus -lcilkrts -endif - dyecmd_CXXFLAGS += -DDYECMD dyecmd_SOURCES += progs/dyecmd/dyemain.cpp diff --git a/src/game.cpp b/src/game.cpp index 43e48943e..bfbaba353 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -696,7 +696,7 @@ void Game::slowLogic() whoIsOnline->slowLogic(); Being::reReadConfig(); if (killStats != nullptr) - cilk_spawn killStats->recalcStats(); + killStats->recalcStats(); if (time > mTime2 || mTime2 - time > 10) { @@ -713,15 +713,15 @@ void Game::slowLogic() #ifdef TMWA_SUPPORT if (shopWindow != nullptr) - cilk_spawn shopWindow->updateTimes(); + shopWindow->updateTimes(); if (guildManager != nullptr) guildManager->slowLogic(); #endif // TMWA_SUPPORT if (skillDialog != nullptr) - cilk_spawn skillDialog->slowLogic(); + skillDialog->slowLogic(); - cilk_spawn PacketCounters::update(); + PacketCounters::update(); // Handle network stuff if (!gameHandler->isConnected()) diff --git a/src/localconsts.h b/src/localconsts.h index a9aa48100..10ec5e110 100644 --- a/src/localconsts.h +++ b/src/localconsts.h @@ -121,25 +121,9 @@ #endif // __clang__ #endif // __native_client__ -#ifdef ENABLE_CILKPLUS -#ifdef __GNUC__ -#if GCC_VERSION < 60000 -#define BAD_CILKPLUS -#else // GCC_VERSION < 60000 -#define GOOD_CILKPLUS -#endif // GCC_VERSION < 60000 -#endif // __GNUC__ -#endif // ENABLE_CILKPLUS - -#if defined(ENABLE_CILKPLUS) && defined(BAD_CILKPLUS) -#define A_CONST -#define A_PURE -#define A_INLINE -#else // ENABLE_CILKPLUS #define A_CONST __attribute__ ((const)) #define A_PURE __attribute__ ((pure)) #define A_INLINE __attribute__ ((always_inline)) -#endif // ENABLE_CILKPLUS #ifdef __x86_64__ // gcc 4.8 look like support avx2, but need global define for enable any SIMD @@ -161,11 +145,7 @@ #endif // GCC_VERSION < 40900 #endif // __INTEL_COMPILER -#ifndef ENABLE_CILKPLUS #define A_NONNULL(...) __attribute__((nonnull (__VA_ARGS__))) -#else // ENABLE_CILKPLUS -#define A_NONNULL(...) -#endif // ENABLE_CILKPLUS #else // __GNUC__ #define A_UNUSED @@ -182,10 +162,6 @@ #define gnu_printf printf #endif // __clang__ -#ifdef ENABLE_CILKPLUS -#include <cilk/cilk.h> -#endif // ENABLE_CILKPLUS - #ifdef ADVGCC #define const2 const @@ -267,25 +243,6 @@ #endif // GCC_VERSION > 40000 #endif // __GNUC__ -#ifdef __GNUC__ -#ifdef ENABLE_CILKPLUS -#if GCC_VERSION < 40900 -#define cilk_for for -#define cilk_spawn -#define cilk_sync -#elif GCC_VERSION < 50000 -#ifdef cilk_for -#undef cilk_for -#endif // cilk_for -#define cilk_for for -#endif // GCC_VERSION < 40900 -#else // ENABLE_CILKPLUS -#define cilk_for for -#define cilk_spawn -#define cilk_sync -#endif // ENABLE_CILKPLUS -#endif // __GNUC__ - #define notfinal #ifdef ENABLE_CHECKPLUGIN diff --git a/src/render/sdlgraphics.cpp b/src/render/sdlgraphics.cpp index 4671a2042..8e77cbf1e 100644 --- a/src/render/sdlgraphics.cpp +++ b/src/render/sdlgraphics.cpp @@ -947,7 +947,7 @@ void SDLGraphics::fillRectangle(const Rect &restrict rectangle) restrict2 switch (bpp) { case 1: - cilk_for (int y = y1; y < y2; y++) + for (int y = y1; y < y2; y++) { uint8_t *const p = static_cast<uint8_t *>(mWindow->pixels) + CAST_SIZE(y * mWindow->pitch); @@ -959,7 +959,7 @@ void SDLGraphics::fillRectangle(const Rect &restrict rectangle) restrict2 } break; case 2: - cilk_for (int y = y1; y < y2; y++) + for (int y = y1; y < y2; y++) { uint8_t *const p0 = static_cast<uint8_t *>(mWindow->pixels) + CAST_SIZE(y * mWindow->pitch); @@ -980,7 +980,7 @@ void SDLGraphics::fillRectangle(const Rect &restrict rectangle) restrict2 const int cg = mColor.g * mColor.a; const int cb = mColor.b * mColor.a; - cilk_for (int y = y1; y < y2; y++) + for (int y = y1; y < y2; y++) { uint8_t *const p0 = static_cast<uint8_t *>(mWindow->pixels) + CAST_SIZE(y * mWindow->pitch); @@ -1008,7 +1008,7 @@ void SDLGraphics::fillRectangle(const Rect &restrict rectangle) restrict2 const unsigned pr = (pixel & 0xff0000) * mColor.a; const unsigned a1 = (255 - mColor.a); - cilk_for (int y = y1; y < y2; y++) + for (int y = y1; y < y2; y++) { uint8_t *const p0 = static_cast<uint8_t *>(mWindow->pixels) + y * mWindow->pitch; @@ -1071,7 +1071,7 @@ void SDLGraphics::fillRectangle(const Rect &restrict rectangle) restrict2 mOldAlpha = mColor.a; } - cilk_for (int y = y1; y < y2; y++) + for (int y = y1; y < y2; y++) { uint32_t *const p0 = reinterpret_cast<uint32_t*>( static_cast<uint8_t*>(mWindow->pixels) diff --git a/src/resources/dye/dye.cpp b/src/resources/dye/dye.cpp index 4b6c3e593..0e8f87a78 100644 --- a/src/resources/dye/dye.cpp +++ b/src/resources/dye/dye.cpp @@ -159,68 +159,6 @@ void Dye::normalDye(uint32_t *restrict pixels, if (pixels == nullptr) return; -#ifdef ENABLE_CILKPLUS - cilk_for (int ptr = 0; ptr < bufSize; ptr ++) - { - const uint32_t p = pixels[ptr]; -#if SDL_BYTEORDER == SDL_BIG_ENDIAN - const int alpha = p & 0xff000000; -#else // SDL_BYTEORDER == SDL_BIG_ENDIAN - - const int alpha = p & 0xff; -#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN - - if (alpha) - { - unsigned int color[3]; -#if SDL_BYTEORDER == SDL_BIG_ENDIAN - color[0] = (p) & 255U; - color[1] = (p >> 8U) & 255U; - color[2] = (p >> 16U) & 255U; -#else // SDL_BYTEORDER == SDL_BIG_ENDIAN - - color[0] = (p >> 24U) & 255U; - color[1] = (p >> 16U) & 255U; - color[2] = (p >> 8U) & 255U; -#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN - - const unsigned int cmax = std::max( - color[0], std::max(color[1], color[2])); - if (cmax == 0) - goto endlabel; - - const unsigned int cmin = std::min( - color[0], std::min(color[1], color[2])); - const unsigned int intensity = color[0] + color[1] + color[2]; - unsigned int i; - - if (cmin != cmax && (cmin != 0 || (intensity != cmax - && intensity != 2 * cmax))) - { - // not pure - goto endlabel; - } - - i = (color[0] != 0) | ((color[1] != 0) << 1) - | ((color[2] != 0) << 2); - - if (mDyePalettes[i - 1]) - mDyePalettes[i - 1]->getColor(cmax, color); - -#if SDL_BYTEORDER == SDL_BIG_ENDIAN - pixels[ptr] = (color[0]) | (color[1] << 8) - | (color[2] << 16) | alpha; -#else // SDL_BYTEORDER == SDL_BIG_ENDIAN - - pixels[ptr] = (color[0] << 24) | (color[1] << 16) - | (color[2] << 8) | alpha; -#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN - } -endlabel:{} - } - -#else // ENABLE_CILKPLUS - for (const uint32_t *const p_end = pixels + CAST_SIZE(bufSize); pixels != p_end; ++ pixels) @@ -279,7 +217,6 @@ endlabel:{} | (color[2] << 8) | alpha; #endif // SDL_BYTEORDER == SDL_BIG_ENDIAN } -#endif // ENABLE_CILKPLUS } void Dye::normalOGLDye(uint32_t *restrict pixels, @@ -288,67 +225,6 @@ void Dye::normalOGLDye(uint32_t *restrict pixels, if (pixels == nullptr) return; -#ifdef ENABLE_CILKPLUS - cilk_for (int ptr = 0; ptr < bufSize; ptr ++) - { - const uint32_t p = pixels[ptr]; -#if SDL_BYTEORDER == SDL_BIG_ENDIAN - const int alpha = p & 255; -#else // SDL_BYTEORDER == SDL_BIG_ENDIAN - - const int alpha = p & 0xff000000; -#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN - - if (alpha) - { - unsigned int color[3]; -#if SDL_BYTEORDER == SDL_BIG_ENDIAN - color[0] = (p >> 24U) & 255U; - color[1] = (p >> 16U) & 255U; - color[2] = (p >> 8U) & 255U; -#else // SDL_BYTEORDER == SDL_BIG_ENDIAN - - color[0] = (p) & 255U; - color[1] = (p >> 8U) & 255U; - color[2] = (p >> 16U) & 255U; -#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN - - const unsigned int cmax = std::max( - color[0], std::max(color[1], color[2])); - if (cmax == 0) - goto endlabel; - - const unsigned int cmin = std::min( - color[0], std::min(color[1], color[2])); - const unsigned int intensity = color[0] + color[1] + color[2]; - - if (cmin != cmax && (cmin != 0 || (intensity != cmax - && intensity != 2 * cmax))) - { - // not pure - goto endlabel; - } - - const unsigned int i = (color[0] != 0) | ((color[1] != 0) << 1) - | ((color[2] != 0) << 2); - - if (mDyePalettes[i - 1]) - mDyePalettes[i - 1]->getColor(cmax, color); - -#if SDL_BYTEORDER == SDL_BIG_ENDIAN - pixels[ptr] = (color[0] << 24) | (color[1] << 16) - | (color[2] << 8) | alpha; -#else // SDL_BYTEORDER == SDL_BIG_ENDIAN - - pixels[ptr] = (color[0]) | (color[1] << 8) - | (color[2] << 16) | alpha; -#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN - } -endlabel:{} - } - -#else // ENABLE_CILKPLUS - for (const uint32_t *const p_end = pixels + CAST_SIZE(bufSize); pixels != p_end; ++ pixels) @@ -407,5 +283,4 @@ endlabel:{} | (color[2] << 16) | alpha; #endif // SDL_BYTEORDER == SDL_BIG_ENDIAN } -#endif // ENABLE_CILKPLUS } diff --git a/src/resources/dye/dyepalette_replaceacolor.cpp b/src/resources/dye/dyepalette_replaceacolor.cpp index 86c4e600f..5d94d9a1f 100644 --- a/src/resources/dye/dyepalette_replaceacolor.cpp +++ b/src/resources/dye/dyepalette_replaceacolor.cpp @@ -46,47 +46,6 @@ void DyePalette::replaceAColorDefault(uint32_t *restrict pixels, if ((sz % 2) != 0u) -- it_end; -#ifdef ENABLE_CILKPLUS - cilk_for (int ptr = 0; ptr < bufSize; ptr ++) - { - uint8_t *const p = reinterpret_cast<uint8_t *>(&pixels[ptr]); - const unsigned int data = pixels[ptr]; - - STD_VECTOR<DyeColor>::const_iterator it = mColors.begin(); - while (it != it_end) - { - const DyeColor &col = *it; - ++ it; - const DyeColor &col2 = *it; - -#if SDL_BYTEORDER == SDL_BIG_ENDIAN - const unsigned int coldata = (col.value[3] << 24U) - | (col.value[2] << 16U) - | (col.value[1] << 8U) - | (col.value[0]); -#else // SDL_BYTEORDER == SDL_BIG_ENDIAN - - const unsigned int coldata = (col.value[3]) - | (col.value[2] << 8U) - | (col.value[1] << 16U) | - (col.value[0] << 24U); -#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN - - if (data == coldata) - { - p[3] = col2.value[0]; - p[2] = col2.value[1]; - p[1] = col2.value[2]; - p[0] = col2.value[3]; - break; - } - - ++ it; - } - } - -#else // ENABLE_CILKPLUS - for (const uint32_t *const p_end = pixels + CAST_SIZE(bufSize); pixels != p_end; ++pixels) @@ -125,7 +84,6 @@ void DyePalette::replaceAColorDefault(uint32_t *restrict pixels, ++ it; } } -#endif // ENABLE_CILKPLUS } #ifdef SIMD_SUPPORTED diff --git a/src/resources/dye/dyepalette_replaceaoglcolor.cpp b/src/resources/dye/dyepalette_replaceaoglcolor.cpp index 938d648eb..ec999812a 100644 --- a/src/resources/dye/dyepalette_replaceaoglcolor.cpp +++ b/src/resources/dye/dyepalette_replaceaoglcolor.cpp @@ -48,47 +48,6 @@ void DyePalette::replaceAOGLColorDefault(uint32_t *restrict pixels, if ((sz % 2) != 0u) -- it_end; -#ifdef ENABLE_CILKPLUS - cilk_for (int ptr = 0; ptr < bufSize; ptr ++) - { - uint8_t *const p = reinterpret_cast<uint8_t *>(&pixels[ptr]); - const unsigned int data = pixels[ptr]; - - STD_VECTOR<DyeColor>::const_iterator it = mColors.begin(); - while (it != it_end) - { - const DyeColor &col = *it; - ++ it; - const DyeColor &col2 = *it; - -#if SDL_BYTEORDER == SDL_BIG_ENDIAN - const unsigned int coldata = (col.value[0] << 24U) - | (col.value[1] << 16U) - | (col.value[2] << 8U) - | col.value[3]; -#else // SDL_BYTEORDER == SDL_BIG_ENDIAN - - const unsigned int coldata = (col.value[0]) - | (col.value[1] << 8U) - | (col.value[2] << 16U) - | (col.value[3] << 24U); -#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN - - if (data == coldata) - { - p[0] = col2.value[0]; - p[1] = col2.value[1]; - p[2] = col2.value[2]; - p[3] = col2.value[3]; - break; - } - - ++ it; - } - } - -#else // ENABLE_CILKPLUS - for (const uint32_t *const p_end = pixels + CAST_SIZE(bufSize); pixels != p_end; ++pixels) @@ -128,7 +87,6 @@ void DyePalette::replaceAOGLColorDefault(uint32_t *restrict pixels, ++ it; } } -#endif // ENABLE_CILKPLUS } #ifdef SIMD_SUPPORTED @@ -182,47 +140,6 @@ void DyePalette::replaceAOGLColorSse2(uint32_t *restrict pixels, } else { -#ifdef ENABLE_CILKPLUS - cilk_for (int ptr = 0; ptr < bufSize; ptr ++) - { - uint8_t *const p = reinterpret_cast<uint8_t *>(&pixels[ptr]); - const unsigned int data = pixels[ptr]; - - STD_VECTOR<DyeColor>::const_iterator it = mColors.begin(); - while (it != it_end) - { - const DyeColor &col = *it; - ++ it; - const DyeColor &col2 = *it; - -#if SDL_BYTEORDER == SDL_BIG_ENDIAN - const unsigned int coldata = (col.value[0] << 24U) - | (col.value[1] << 16U) - | (col.value[2] << 8U) - | col.value[3]; -#else // SDL_BYTEORDER == SDL_BIG_ENDIAN - - const unsigned int coldata = (col.value[0]) - | (col.value[1] << 8U) - | (col.value[2] << 16U) - | (col.value[3] << 24U); -#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN - - if (data == coldata) - { - p[0] = col2.value[0]; - p[1] = col2.value[1]; - p[2] = col2.value[2]; - p[3] = col2.value[3]; - break; - } - - ++ it; - } - } - -#else // ENABLE_CILKPLUS - for (const uint32_t *const p_end = pixels + CAST_SIZE(bufSize); pixels != p_end; ++pixels) @@ -262,7 +179,6 @@ void DyePalette::replaceAOGLColorSse2(uint32_t *restrict pixels, ++ it; } } -#endif // ENABLE_CILKPLUS } } @@ -310,47 +226,6 @@ void DyePalette::replaceAOGLColorAvx2(uint32_t *restrict pixels, } else { -#ifdef ENABLE_CILKPLUS - cilk_for (int ptr = 0; ptr < bufSize; ptr ++) - { - uint8_t *const p = reinterpret_cast<uint8_t *>(&pixels[ptr]); - const unsigned int data = pixels[ptr]; - - STD_VECTOR<DyeColor>::const_iterator it = mColors.begin(); - while (it != it_end) - { - const DyeColor &col = *it; - ++ it; - const DyeColor &col2 = *it; - -#if SDL_BYTEORDER == SDL_BIG_ENDIAN - const unsigned int coldata = (col.value[0] << 24U) - | (col.value[1] << 16U) - | (col.value[2] << 8U) - | col.value[3]; -#else // SDL_BYTEORDER == SDL_BIG_ENDIAN - - const unsigned int coldata = (col.value[0]) - | (col.value[1] << 8U) - | (col.value[2] << 16U) - | (col.value[3] << 24U); -#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN - - if (data == coldata) - { - p[0] = col2.value[0]; - p[1] = col2.value[1]; - p[2] = col2.value[2]; - p[3] = col2.value[3]; - break; - } - - ++ it; - } - } - -#else // ENABLE_CILKPLUS - for (const uint32_t *const p_end = pixels + CAST_SIZE(bufSize); pixels != p_end; ++pixels) @@ -390,7 +265,6 @@ void DyePalette::replaceAOGLColorAvx2(uint32_t *restrict pixels, ++ it; } } -#endif // ENABLE_CILKPLUS } } diff --git a/src/resources/dye/dyepalette_replacescolor.cpp b/src/resources/dye/dyepalette_replacescolor.cpp index 2899ba3f3..80b82751d 100644 --- a/src/resources/dye/dyepalette_replacescolor.cpp +++ b/src/resources/dye/dyepalette_replacescolor.cpp @@ -46,44 +46,6 @@ void DyePalette::replaceSColorDefault(uint32_t *restrict pixels, if ((sz % 2) != 0u) -- it_end; -#ifdef ENABLE_CILKPLUS - cilk_for (int ptr = 0; ptr < bufSize; ptr ++) - { - uint8_t *const p = reinterpret_cast<uint8_t *>(&pixels[ptr]); -#if SDL_BYTEORDER == SDL_BIG_ENDIAN - const unsigned int data = pixels[ptr] & 0x00ffffff; -#else // SDL_BYTEORDER == SDL_BIG_ENDIAN - - const unsigned int data = pixels[ptr] & 0xffffff00; -#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN - - STD_VECTOR<DyeColor>::const_iterator it = mColors.begin(); - while (it != it_end) - { - const DyeColor &col = *it; - ++ it; - const DyeColor &col2 = *it; - -#if SDL_BYTEORDER == SDL_BIG_ENDIAN - const unsigned int coldata = (col.value[2] << 16U) - | (col.value[1] << 8U) | (col.value[0]); -#else // SDL_BYTEORDER == SDL_BIG_ENDIAN - const unsigned int coldata = (col.value[2] << 8U) - | (col.value[1] << 16U) | (col.value[0] << 24U); -#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN - - if (data == coldata) - { - p[3] = col2.value[0]; - p[2] = col2.value[1]; - p[1] = col2.value[2]; - break; - } - ++ it; - } - } -#else // ENABLE_CILKPLUS - for (const uint32_t *const p_end = pixels + CAST_SIZE(bufSize); pixels != p_end; ++ pixels) @@ -123,7 +85,6 @@ void DyePalette::replaceSColorDefault(uint32_t *restrict pixels, ++ it; } } -#endif // ENABLE_CILKPLUS } #ifdef SIMD_SUPPORTED diff --git a/src/resources/dye/dyepalette_replacesoglcolor.cpp b/src/resources/dye/dyepalette_replacesoglcolor.cpp index 2ba19b0bf..7e435d936 100644 --- a/src/resources/dye/dyepalette_replacesoglcolor.cpp +++ b/src/resources/dye/dyepalette_replacesoglcolor.cpp @@ -48,47 +48,6 @@ void DyePalette::replaceSOGLColorDefault(uint32_t *restrict pixels, if ((sz % 2) != 0u) -- it_end; -#ifdef ENABLE_CILKPLUS - cilk_for (int ptr = 0; ptr < bufSize; ptr ++) - { - uint8_t *const p = reinterpret_cast<uint8_t *>(&pixels[ptr]); -#if SDL_BYTEORDER == SDL_BIG_ENDIAN - const unsigned int data = (pixels[ptr]) & 0xffffff00; -#else // SDL_BYTEORDER == SDL_BIG_ENDIAN - - const unsigned int data = (pixels[ptr]) & 0x00ffffff; -#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN - - STD_VECTOR<DyeColor>::const_iterator it = mColors.begin(); - while (it != it_end) - { - const DyeColor &col = *it; - ++ it; - const DyeColor &col2 = *it; - -#if SDL_BYTEORDER == SDL_BIG_ENDIAN - const unsigned int coldata = (col.value[0] << 24) - | (col.value[1] << 16) | (col.value[2] << 8); -#else // SDL_BYTEORDER == SDL_BIG_ENDIAN - - const unsigned int coldata = (col.value[0]) - | (col.value[1] << 8) | (col.value[2] << 16); -#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN - - if (data == coldata) - { - p[0] = col2.value[0]; - p[1] = col2.value[1]; - p[2] = col2.value[2]; - break; - } - - ++ it; - } - } - -#else // ENABLE_CILKPLUS - for (const uint32_t *const p_end = pixels + CAST_SIZE(bufSize); pixels != p_end; ++pixels) @@ -128,7 +87,6 @@ void DyePalette::replaceSOGLColorDefault(uint32_t *restrict pixels, ++ it; } } -#endif // ENABLE_CILKPLUS } #ifdef SIMD_SUPPORTED @@ -184,47 +142,6 @@ void DyePalette::replaceSOGLColorSse2(uint32_t *restrict pixels, } else { -#ifdef ENABLE_CILKPLUS - cilk_for (int ptr = 0; ptr < bufSize; ptr ++) - { - uint8_t *const p = reinterpret_cast<uint8_t *>(&pixels[ptr]); -#if SDL_BYTEORDER == SDL_BIG_ENDIAN - const unsigned int data = (pixels[ptr]) & 0xffffff00; -#else // SDL_BYTEORDER == SDL_BIG_ENDIAN - - const unsigned int data = (pixels[ptr]) & 0x00ffffff; -#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN - - STD_VECTOR<DyeColor>::const_iterator it = mColors.begin(); - while (it != it_end) - { - const DyeColor &col = *it; - ++ it; - const DyeColor &col2 = *it; - -#if SDL_BYTEORDER == SDL_BIG_ENDIAN - const unsigned int coldata = (col.value[0] << 24) - | (col.value[1] << 16) | (col.value[2] << 8); -#else // SDL_BYTEORDER == SDL_BIG_ENDIAN - - const unsigned int coldata = (col.value[0]) - | (col.value[1] << 8) | (col.value[2] << 16); -#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN - - if (data == coldata) - { - p[0] = col2.value[0]; - p[1] = col2.value[1]; - p[2] = col2.value[2]; - break; - } - - ++ it; - } - } - -#else // ENABLE_CILKPLUS - for (const uint32_t *const p_end = pixels + CAST_SIZE(bufSize); pixels != p_end; ++pixels) @@ -264,7 +181,6 @@ void DyePalette::replaceSOGLColorSse2(uint32_t *restrict pixels, ++ it; } } -#endif // ENABLE_CILKPLUS } } @@ -314,47 +230,6 @@ void DyePalette::replaceSOGLColorAvx2(uint32_t *restrict pixels, } else { -#ifdef ENABLE_CILKPLUS - cilk_for (int ptr = 0; ptr < bufSize; ptr ++) - { - uint8_t *const p = reinterpret_cast<uint8_t *>(&pixels[ptr]); -#if SDL_BYTEORDER == SDL_BIG_ENDIAN - const unsigned int data = (pixels[ptr]) & 0xffffff00; -#else // SDL_BYTEORDER == SDL_BIG_ENDIAN - - const unsigned int data = (pixels[ptr]) & 0x00ffffff; -#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN - - STD_VECTOR<DyeColor>::const_iterator it = mColors.begin(); - while (it != it_end) - { - const DyeColor &col = *it; - ++ it; - const DyeColor &col2 = *it; - -#if SDL_BYTEORDER == SDL_BIG_ENDIAN - const unsigned int coldata = (col.value[0] << 24) - | (col.value[1] << 16) | (col.value[2] << 8); -#else // SDL_BYTEORDER == SDL_BIG_ENDIAN - - const unsigned int coldata = (col.value[0]) - | (col.value[1] << 8) | (col.value[2] << 16); -#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN - - if (data == coldata) - { - p[0] = col2.value[0]; - p[1] = col2.value[1]; - p[2] = col2.value[2]; - break; - } - - ++ it; - } - } - -#else // ENABLE_CILKPLUS - for (const uint32_t *const p_end = pixels + CAST_SIZE(bufSize); pixels != p_end; ++pixels) @@ -394,7 +269,6 @@ void DyePalette::replaceSOGLColorAvx2(uint32_t *restrict pixels, ++ it; } } -#endif // ENABLE_CILKPLUS } } diff --git a/src/resources/sdlimagehelper.cpp b/src/resources/sdlimagehelper.cpp index 9cc9ba8f0..1d51bb4cc 100644 --- a/src/resources/sdlimagehelper.cpp +++ b/src/resources/sdlimagehelper.cpp @@ -247,7 +247,7 @@ Image *SDLImageHelper::_SDLload(SDL_Surface *tmpImage) const uint8_t ashift = fmt->Ashift; const uint8_t aloss = fmt->Aloss; const uint32_t *pixels = static_cast<uint32_t*>(tmpImage->pixels); - cilk_for (size_t i = 0; i < sz; ++ i) + for (size_t i = 0; i < sz; ++ i) { const unsigned v = (pixels[i] & amask) >> ashift; const uint8_t a = static_cast<uint8_t>((v << aloss) |