From 9615e7f9e538af4ad212f4f71d1364c64b18542d Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 11 Jan 2023 08:40:33 +0100 Subject: Gui: Always declare qt_memfill{32|64} as function pointers on x86 Having the declaration of a function depend on compiler flags is a fundamentally bad idea since you can compile different compilation units that all include the header with different flags. This leads to undefined symbols. Pick-to: 6.5 Fixes: QTBUG-109159 Change-Id: I0aede280988e4f10c42d5b1824ad9c96a1e10854 Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Liang Qi Reviewed-by: Thiago Macieira --- src/gui/painting/qdrawhelper.cpp | 16 +++++++++------- src/gui/painting/qdrawhelper_p.h | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 91d8c424d1..46f75add1b 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -6230,7 +6230,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = }, }; -#if !defined(__SSE2__) +#if !defined(Q_PROCESSOR_X86) void qt_memfill64(quint64 *dest, quint64 color, qsizetype count) { qt_memfill_template(dest, color, count); @@ -6297,16 +6297,15 @@ void qt_memfill16(quint16 *dest, quint16 value, qsizetype count) qt_memfill32(reinterpret_cast(dest), value32, count / 2); } -#if !defined(__SSE2__) && !defined(__ARM_NEON__) && !defined(__MIPS_DSP__) +#if defined(Q_PROCESSOR_X86) +void (*qt_memfill32)(quint32 *dest, quint32 value, qsizetype count) = nullptr; +void (*qt_memfill64)(quint64 *dest, quint64 value, qsizetype count) = nullptr; +#elif !defined(__ARM_NEON__) && !defined(__MIPS_DSP__) void qt_memfill32(quint32 *dest, quint32 color, qsizetype count) { qt_memfill_template(dest, color, count); } #endif -#ifdef __SSE2__ -decltype(qt_memfill32_sse2) *qt_memfill32 = nullptr; -decltype(qt_memfill64_sse2) *qt_memfill64 = nullptr; -#endif #ifdef QT_COMPILER_SUPPORTS_SSE4_1 template void QT_FASTCALL storeA2RGB30PMFromARGB32PM_sse4(uchar *dest, const uint *src, int index, int count, const QList *, QDitherInfo *); @@ -6319,7 +6318,10 @@ static void qInitDrawhelperFunctions() // Set up basic blend function tables. qInitBlendFunctions(); -#ifdef __SSE2__ +#if defined(Q_PROCESSOR_X86) && !defined(__SSE2__) + qt_memfill32 = qt_memfill_template; + qt_memfill64 = qt_memfill_template; +#elif defined(__SSE2__) # ifndef __AVX2__ qt_memfill32 = qt_memfill32_sse2; qt_memfill64 = qt_memfill64_sse2; diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 7d2bea3a44..85b073bfde 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -142,7 +142,7 @@ struct quint24 { void qBlendGradient(int count, const QT_FT_Span *spans, void *userData); void qBlendTexture(int count, const QT_FT_Span *spans, void *userData); -#ifdef __SSE2__ +#ifdef Q_PROCESSOR_X86 extern void (*qt_memfill64)(quint64 *dest, quint64 value, qsizetype count); extern void (*qt_memfill32)(quint32 *dest, quint32 value, qsizetype count); #else -- cgit v1.2.3