Skip to content

Commit

Permalink
Fix build with gcc-14
Browse files Browse the repository at this point in the history
Work-around SiC change made to qfloat16 when using native floats.

Pick-to: 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 dcb2186)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit a1413a6)
  • Loading branch information
Allan Sandfeld Jensen authored and Qt Cherry-pick Bot committed Feb 14, 2024
1 parent ab683da commit 535afba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,21 +182,21 @@ void tst_QColorTransform::mapRGBAFP16x4()
else
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);
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);
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);
QCOMPARE(result.alpha(), 1.0f);
if (sharesRed)
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);
// QRgbaFloat16 might overflow blue if we convert to a smaller gamut:
QCOMPARE(result.blue16(), 65535);
Expand Down
6 changes: 3 additions & 3 deletions tests/auto/gui/rhi/qrhi/tst_qrhi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6760,9 +6760,9 @@ void tst_QRhi::halfPrecisionAttributes()
// To avoid these errors, we pad the vertices to 8 byte stride.
//
static const qfloat16 vertices[] = {
-1.0, -1.0, 0.0, 0.0,
1.0, -1.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
qfloat16(-1.0), qfloat16(-1.0), qfloat16(0.0), qfloat16(0.0),
qfloat16(1.0), qfloat16(-1.0), qfloat16(0.0), qfloat16(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)));
Expand Down

0 comments on commit 535afba

Please sign in to comment.