GRAPHICS: Use target pragmas instead of compiler flags to prevent ODR problems.

This commit is contained in:
elasota 2024-01-01 18:20:36 -05:00 committed by Eugene Sandulenko
parent cd2b0fd434
commit 9e374ec4ca
4 changed files with 44 additions and 6 deletions

View File

@ -20,11 +20,17 @@
*/
#include "common/scummsys.h"
#include <immintrin.h>
#include "graphics/blit/blit-alpha.h"
#include "graphics/pixelformat.h"
#include <immintrin.h>
#ifdef __GNUC__
#pragma GCC push_options
#pragma GCC target("avx2")
#endif
namespace Graphics {
class BlendBlitImpl_AVX2 : public BlendBlitImpl_Base {
@ -300,3 +306,7 @@ void BlendBlit::blitAVX2(Args &args, const TSpriteBlendMode &blendMode, const Al
}
} // End of namespace Graphics
#ifdef __GNUC__
#pragma GCC pop_options
#endif

View File

@ -22,11 +22,21 @@
#include "common/scummsys.h"
#ifdef SCUMMVM_NEON
#include <arm_neon.h>
#include "graphics/blit/blit-alpha.h"
#include "graphics/pixelformat.h"
#include <arm_neon.h>
#ifdef __GNUC__
#pragma GCC push_options
#if !defined(__aarch64__)
#pragma GCC target("fpu=neon")
#endif // !defined(__aarch64__)
#endif // __GNUC__
namespace Graphics {
class BlendBlitImpl_NEON : public BlendBlitImpl_Base {
@ -299,4 +309,9 @@ void BlendBlit::blitNEON(Args &args, const TSpriteBlendMode &blendMode, const Al
}
} // end of namespace Graphics
#ifdef __GNUC__
#pragma GCC pop_options
#endif
#endif // SCUMMVM_NEON

View File

@ -20,11 +20,22 @@
*/
#include "common/scummsys.h"
#include <immintrin.h>
#include "graphics/blit/blit-alpha.h"
#include "graphics/pixelformat.h"
#include <emmintrin.h>
#ifdef __GNUC__
#pragma GCC push_options
#ifndef __x86_64__
#pragma GCC target("sse2")
#endif
#endif
namespace Graphics {
static FORCEINLINE __m128i sse2_mul32(__m128i a, __m128i b) {
@ -301,3 +312,8 @@ void BlendBlit::blitSSE2(Args &args, const TSpriteBlendMode &blendMode, const Al
}
} // End of namespace Graphics
#ifdef __GNUC__
#pragma GCC pop_options
#endif

View File

@ -144,17 +144,14 @@ endif
ifdef SCUMMVM_NEON
MODULE_OBJS += \
blit/blit-neon.o
$(MODULE)/blit/blit-neon.o: CXXFLAGS += $(NEON_CXXFLAGS)
endif
ifdef SCUMMVM_SSE2
MODULE_OBJS += \
blit/blit-sse2.o
$(MODULE)/blit/blit-sse2.o: CXXFLAGS += -msse2
endif
ifdef SCUMMVM_AVX2
MODULE_OBJS += \
blit/blit-avx2.o
$(MODULE)/blit/blit-avx2.o: CXXFLAGS += -mavx2
endif
# Include common rules