Fix build with gcc-14

Work-around SiC change made to qfloat16 when using native floats.

Pick-to: 6.6 6.5
Change-Id: I981505e6eff7277ad14512b56fad334be6e79016
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit dcb2186c2a3199d39af09bb81376437b55b907ef)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Allan Sandfeld Jensen 2024-02-13 14:55:24 +01:00 committed by Qt Cherry-pick Bot
parent 2332a9c67b
commit a1413a6ecd
2 changed files with 7 additions and 7 deletions

View File

@ -182,21 +182,21 @@ void tst_QColorTransform::mapRGBAFP16x4()
else else
QVERIFY(result != testColor); QVERIFY(result != testColor);
testColor = QRgbaFloat16{0.0f, 0.0f, 0.0f, 1.0f}; testColor = QRgbaFloat16{qfloat16(0.0f), qfloat16(0.0f), qfloat16(0.0f), qfloat16(1.0f)};
result = transform.map(testColor); result = transform.map(testColor);
QCOMPARE(result, testColor); QCOMPARE(result, testColor);
testColor = QRgbaFloat16{1.0f, 1.0f, 1.0f, 1.0f}; testColor = QRgbaFloat16{qfloat16(1.0f), qfloat16(1.0f), qfloat16(1.0f), qfloat16(1.0f)};
result = transform.map(testColor); result = transform.map(testColor);
QCOMPARE(result, testColor); QCOMPARE(result, testColor);
testColor = QRgbaFloat16{1.0f, 1.0f, 0.0f, 1.0f}; testColor = QRgbaFloat16{qfloat16(1.0f), qfloat16(1.0f), qfloat16(1.0f), qfloat16(1.0f)};
result = transform.map(testColor); result = transform.map(testColor);
QCOMPARE(result.alpha(), 1.0f); QCOMPARE(result.alpha(), 1.0f);
if (sharesRed) if (sharesRed)
QCOMPARE(result.red(), 1.0f); QCOMPARE(result.red(), 1.0f);
testColor = QRgbaFloat16{0.0f, 1.0f, 1.0f, 1.0f}; testColor = QRgbaFloat16{qfloat16(0.0f), qfloat16(1.0f), qfloat16(1.0f), qfloat16(1.0f)};
result = transform.map(testColor); result = transform.map(testColor);
// QRgbaFloat16 might overflow blue if we convert to a smaller gamut: // QRgbaFloat16 might overflow blue if we convert to a smaller gamut:
QCOMPARE(result.blue16(), 65535); QCOMPARE(result.blue16(), 65535);

View File

@ -6814,9 +6814,9 @@ void tst_QRhi::halfPrecisionAttributes()
// To avoid these errors, we pad the vertices to 8 byte stride. // To avoid these errors, we pad the vertices to 8 byte stride.
// //
static const qfloat16 vertices[] = { static const qfloat16 vertices[] = {
-1.0, -1.0, 0.0, 0.0, qfloat16(-1.0), qfloat16(-1.0), qfloat16(0.0), qfloat16(0.0),
1.0, -1.0, 0.0, 0.0, qfloat16(1.0), qfloat16(-1.0), qfloat16(0.0), qfloat16(0.0),
0.0, 1.0, 0.0, 0.0, qfloat16(0.0), qfloat16(1.0), qfloat16(0.0), qfloat16(0.0),
}; };
QScopedPointer<QRhiBuffer> vbuf(rhi->newBuffer(QRhiBuffer::Immutable, QRhiBuffer::VertexBuffer, sizeof(vertices))); QScopedPointer<QRhiBuffer> vbuf(rhi->newBuffer(QRhiBuffer::Immutable, QRhiBuffer::VertexBuffer, sizeof(vertices)));