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 <allan.jensen@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Ulf Hermann 2023-01-11 08:40:33 +01:00
parent a48bbbaa50
commit 9615e7f9e5
2 changed files with 10 additions and 8 deletions

View File

@ -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) void qt_memfill64(quint64 *dest, quint64 color, qsizetype count)
{ {
qt_memfill_template<quint64>(dest, color, count); qt_memfill_template<quint64>(dest, color, count);
@ -6297,16 +6297,15 @@ void qt_memfill16(quint16 *dest, quint16 value, qsizetype count)
qt_memfill32(reinterpret_cast<quint32*>(dest), value32, count / 2); qt_memfill32(reinterpret_cast<quint32*>(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) void qt_memfill32(quint32 *dest, quint32 color, qsizetype count)
{ {
qt_memfill_template<quint32>(dest, color, count); qt_memfill_template<quint32>(dest, color, count);
} }
#endif #endif
#ifdef __SSE2__
decltype(qt_memfill32_sse2) *qt_memfill32 = nullptr;
decltype(qt_memfill64_sse2) *qt_memfill64 = nullptr;
#endif
#ifdef QT_COMPILER_SUPPORTS_SSE4_1 #ifdef QT_COMPILER_SUPPORTS_SSE4_1
template<QtPixelOrder> void QT_FASTCALL storeA2RGB30PMFromARGB32PM_sse4(uchar *dest, const uint *src, int index, int count, const QList<QRgb> *, QDitherInfo *); template<QtPixelOrder> void QT_FASTCALL storeA2RGB30PMFromARGB32PM_sse4(uchar *dest, const uint *src, int index, int count, const QList<QRgb> *, QDitherInfo *);
@ -6319,7 +6318,10 @@ static void qInitDrawhelperFunctions()
// Set up basic blend function tables. // Set up basic blend function tables.
qInitBlendFunctions(); qInitBlendFunctions();
#ifdef __SSE2__ #if defined(Q_PROCESSOR_X86) && !defined(__SSE2__)
qt_memfill32 = qt_memfill_template<quint32>;
qt_memfill64 = qt_memfill_template<quint64>;
#elif defined(__SSE2__)
# ifndef __AVX2__ # ifndef __AVX2__
qt_memfill32 = qt_memfill32_sse2; qt_memfill32 = qt_memfill32_sse2;
qt_memfill64 = qt_memfill64_sse2; qt_memfill64 = qt_memfill64_sse2;

View File

@ -142,7 +142,7 @@ struct quint24 {
void qBlendGradient(int count, const QT_FT_Span *spans, void *userData); void qBlendGradient(int count, const QT_FT_Span *spans, void *userData);
void qBlendTexture(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_memfill64)(quint64 *dest, quint64 value, qsizetype count);
extern void (*qt_memfill32)(quint32 *dest, quint32 value, qsizetype count); extern void (*qt_memfill32)(quint32 *dest, quint32 value, qsizetype count);
#else #else