summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-10-01 01:01:20 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-10-01 11:47:42 +0200
commit8791a8398ac232a8daab98601f1bef88bdf7638f (patch)
tree4be3c8daaff311943215f399ae7300ca4af4f969 /tests
parent56f084781e2b8891929eca0070212fd7a32b32fc (diff)
parent4e40c54a3caabb6bced27e18e040ee88b739a3c8 (diff)
Merge "Merge remote-tracking branch 'origin/5.14' into 5.15"
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp15
-rw-r--r--tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp6
-rw-r--r--tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp2
-rw-r--r--tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp6
-rw-r--r--tests/auto/corelib/tools/collections/BLACKLIST2
-rw-r--r--tests/auto/gui/kernel/qopenglwindow/BLACKLIST6
-rw-r--r--tests/auto/gui/kernel/qopenglwindow/qopenglwindow.pro2
-rw-r--r--tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp4
-rw-r--r--tests/auto/gui/text/qfont/tst_qfont.cpp21
-rw-r--r--tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp9
-rw-r--r--tests/manual/highdpi/main.cpp2
-rw-r--r--tests/manual/rhi/hellominimalcrossgfxtriangle/hellominimalcrossgfxtriangle.cpp10
-rw-r--r--tests/manual/rhi/mrt/mrt.cpp10
-rw-r--r--tests/manual/rhi/msaatexture/msaatexture.cpp2
-rw-r--r--tests/manual/rhi/multiwindow/multiwindow.cpp8
-rw-r--r--tests/manual/rhi/multiwindow_threaded/multiwindow_threaded.cpp8
-rw-r--r--tests/manual/rhi/shared/examplefw.h14
-rw-r--r--tests/manual/rhi/texuploads/texuploads.cpp25
-rw-r--r--tests/manual/rhi/triquadcube/trianglerenderer.cpp4
19 files changed, 90 insertions, 66 deletions
diff --git a/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp b/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp
index 5697d21547..a6d600e125 100644
--- a/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp
+++ b/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp
@@ -44,6 +44,9 @@ private slots:
void fuzzyCompare();
void rawNaN_data();
void rawNaN();
+#if QT_CONFIG(signaling_nan)
+ void distinctNaN();
+#endif
void generalNaN_data();
void generalNaN();
void infinity();
@@ -139,6 +142,9 @@ void tst_QNumeric::rawNaN_data()
QTest::addColumn<double>("nan");
QTest::newRow("quiet") << qQNaN();
+#if QT_CONFIG(signaling_nan)
+ QTest::newRow("signaling") << qSNaN();
+#endif
}
void tst_QNumeric::rawNaN()
@@ -147,6 +153,15 @@ void tst_QNumeric::rawNaN()
checkNaN(nan);
}
+#if QT_CONFIG(signaling_nan)
+void tst_QNumeric::distinctNaN()
+{
+ const double qnan = qQNaN();
+ const double snan = qSNaN();
+ QVERIFY(memcmp(&qnan, &snan, sizeof(double)) != 0);
+}
+#endif
+
void tst_QNumeric::generalNaN_data()
{
QTest::addColumn<int>("most");
diff --git a/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp b/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp
index e238be1de3..6f9dcc08f9 100644
--- a/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp
+++ b/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp
@@ -320,7 +320,7 @@ void tst_QRandomGenerator::generate32_data()
QTest::newRow("fixed") << (RandomValue32 & RandomDataMask);
QTest::newRow("global") << 0U;
#ifdef QT_BUILD_INTERNAL
- if (qt_has_hwrng())
+ if (qHasHwrng())
QTest::newRow("hwrng") << uint(UseSystemRNG);
QTest::newRow("system") << uint(UseSystemRNG | SkipHWRNG);
# ifdef HAVE_FALLBACK_ENGINE
@@ -755,7 +755,7 @@ void tst_QRandomGenerator::stdUniformIntDistribution_data()
auto newRow = [&](quint32 max) {
#ifdef QT_BUILD_INTERNAL
- if (qt_has_hwrng())
+ if (qHasHwrng())
QTest::addRow("hwrng:%u", max) << uint(UseSystemRNG) << max;
QTest::addRow("system:%u", max) << uint(UseSystemRNG | SkipHWRNG) << max;
# ifdef HAVE_FALLBACK_ENGINE
@@ -868,7 +868,7 @@ void tst_QRandomGenerator::stdUniformRealDistribution_data()
auto newRow = [&](double min, double sup) {
#ifdef QT_BUILD_INTERNAL
- if (qt_has_hwrng())
+ if (qHasHwrng())
QTest::addRow("hwrng:%g-%g", min, sup) << uint(UseSystemRNG) << min << sup;
QTest::addRow("system:%g-%g", min, sup) << uint(UseSystemRNG | SkipHWRNG) << min << sup;
# ifdef HAVE_FALLBACK_ENGINE
diff --git a/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp b/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp
index 6fa82ea681..c6733205e5 100644
--- a/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp
+++ b/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp
@@ -1413,10 +1413,12 @@ void tst_QCborValue::toCbor_data()
// The rest of these tests are conversions whose decoding does not yield
// back the same QCborValue.
+#if QT_CONFIG(signaling_nan)
// Signalling NaN get normalized to quiet ones
QTest::newRow("Double:snan") << QCborValue(qSNaN()) << raw("\xfb\x7f\xf8\0""\0\0\0\0\0") << QCborValue::EncodingOptions();
QTest::newRow("Float:snan") << QCborValue(qSNaN()) << raw("\xfa\x7f\xc0\0\0") << QCborValue::EncodingOptions(QCborValue::UseFloat);
QTest::newRow("Float16:snan") << QCborValue(qSNaN()) << raw("\xf9\x7e\0") << QCborValue::EncodingOptions(QCborValue::UseFloat16);
+#endif
// Floating point written as integers are read back as integers
QTest::newRow("UseInteger:0") << QCborValue(0.) << raw("\x00") << QCborValue::EncodingOptions(QCborValue::UseIntegers);
diff --git a/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp
index 531ac2995f..99176dc68d 100644
--- a/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp
@@ -3468,6 +3468,9 @@ void tst_QDateTime::timeZones() const
void tst_QDateTime::systemTimeZoneChange() const
{
+#ifdef Q_OS_WINRT
+ QSKIP("UWP applications cannot change the system`s time zone (sandboxing)");
+#endif
// Set the timezone to Brisbane time
TimeZoneRollback useZone(QByteArray("AEST-10:00"));
@@ -3485,9 +3488,6 @@ void tst_QDateTime::systemTimeZoneChange() const
useZone.reset(QByteArray("IST-05:30"));
QCOMPARE(localDate, QDateTime(QDate(2012, 6, 1), QTime(2, 15, 30), Qt::LocalTime));
-#ifdef Q_OS_WINRT
- QEXPECT_FAIL("", "WinRT gets this wrong, QTBUG-71185", Continue);
-#endif
QVERIFY(localMsecs != localDate.toMSecsSinceEpoch());
QCOMPARE(utcDate, QDateTime(QDate(2012, 6, 1), QTime(2, 15, 30), Qt::UTC));
QCOMPARE(utcDate.toMSecsSinceEpoch(), utcMsecs);
diff --git a/tests/auto/corelib/tools/collections/BLACKLIST b/tests/auto/corelib/tools/collections/BLACKLIST
deleted file mode 100644
index c6e289aadb..0000000000
--- a/tests/auto/corelib/tools/collections/BLACKLIST
+++ /dev/null
@@ -1,2 +0,0 @@
-[insert_remove_loop]
-msvc-2019
diff --git a/tests/auto/gui/kernel/qopenglwindow/BLACKLIST b/tests/auto/gui/kernel/qopenglwindow/BLACKLIST
new file mode 100644
index 0000000000..3ce78abee8
--- /dev/null
+++ b/tests/auto/gui/kernel/qopenglwindow/BLACKLIST
@@ -0,0 +1,6 @@
+[basic]
+winrt
+[resize]
+winrt
+[painter]
+winrt
diff --git a/tests/auto/gui/kernel/qopenglwindow/qopenglwindow.pro b/tests/auto/gui/kernel/qopenglwindow/qopenglwindow.pro
index d09af5084b..759b608c93 100644
--- a/tests/auto/gui/kernel/qopenglwindow/qopenglwindow.pro
+++ b/tests/auto/gui/kernel/qopenglwindow/qopenglwindow.pro
@@ -4,5 +4,3 @@ TARGET = tst_qopenglwindow
QT += core-private gui-private testlib
SOURCES += tst_qopenglwindow.cpp
-
-win32:CONFIG+=insignificant_test # QTBUG-46452, QTBUG-49630
diff --git a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp
index 67cf9a321a..86a8965cec 100644
--- a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp
+++ b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp
@@ -88,7 +88,9 @@ private slots:
void testToFillPolygons();
+#if QT_CONFIG(signaling_nan)
void testNaNandInfinites();
+#endif
void closing();
@@ -1228,6 +1230,7 @@ void tst_QPainterPath::testToFillPolygons()
QCOMPARE(polygons.first().count(QPointF(70, 50)), 0);
}
+#if QT_CONFIG(signaling_nan)
void tst_QPainterPath::testNaNandInfinites()
{
QPainterPath path1;
@@ -1271,6 +1274,7 @@ void tst_QPainterPath::testNaNandInfinites()
path1.lineTo(QPointF(1, 1));
QVERIFY(path1 != path2);
}
+#endif // signaling_nan
void tst_QPainterPath::connectPathDuplicatePoint()
{
diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp
index 1ee9105cd2..d722856366 100644
--- a/tests/auto/gui/text/qfont/tst_qfont.cpp
+++ b/tests/auto/gui/text/qfont/tst_qfont.cpp
@@ -66,6 +66,8 @@ private slots:
void defaultFamily();
void toAndFromString();
void fromStringWithoutStyleName();
+ void fromDegenerateString_data();
+ void fromDegenerateString();
void sharing();
void familyNameWithCommaQuote_data();
@@ -604,6 +606,25 @@ void tst_QFont::fromStringWithoutStyleName()
QCOMPARE(font2.toString(), str);
}
+void tst_QFont::fromDegenerateString_data()
+{
+ QTest::addColumn<QString>("string");
+
+ QTest::newRow("empty") << QString();
+ QTest::newRow("justAComma") << ",";
+ QTest::newRow("commasAndSpaces") << " , , ";
+ QTest::newRow("spaces") << " ";
+ QTest::newRow("spacesTabsAndNewlines") << " \t \n";
+}
+
+void tst_QFont::fromDegenerateString()
+{
+ QFETCH(QString, string);
+ QFont f;
+ QTest::ignoreMessage(QtWarningMsg, QRegularExpression(".*Invalid description.*"));
+ QCOMPARE(f.fromString(string), false);
+ QCOMPARE(f, QFont());
+}
void tst_QFont::sharing()
{
diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
index 243cb6483e..6091975acb 100644
--- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
+++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
@@ -2712,13 +2712,8 @@ void tst_QWizard::taskQTBUG_46894_nextButtonShortcut()
wizard.show();
QVERIFY(QTest::qWaitForWindowExposed(&wizard));
- if (wizard.button(QWizard::NextButton)->text() == "&Next") {
- QCOMPARE(wizard.button(QWizard::NextButton)->shortcut(),
- QKeySequence(Qt::ALT | Qt::Key_Right));
- } else {
- QCOMPARE(wizard.button(QWizard::NextButton)->shortcut(),
- QKeySequence::mnemonic(wizard.button(QWizard::NextButton)->text()));
- }
+ QCOMPARE(wizard.button(QWizard::NextButton)->shortcut(),
+ QKeySequence::mnemonic(wizard.button(QWizard::NextButton)->text()));
}
}
diff --git a/tests/manual/highdpi/main.cpp b/tests/manual/highdpi/main.cpp
index 8884c5feed..51a7026e85 100644
--- a/tests/manual/highdpi/main.cpp
+++ b/tests/manual/highdpi/main.cpp
@@ -379,7 +379,7 @@ void TiledPixmapPainter::paintEvent(QPaintEvent *event)
// large pixmap: 2 x 2 tiles
// 2x pixmap : 4 x 4 tiles
//
- // On a 2x display the 2x pimxap tiles
+ // On a 2x display the 2x pixmap tiles
// will be drawn in high resolution.
p.drawTiledPixmap(QRect(xoff, yoff, tileAreaEdge, tileAreaEdge), pixmap1X);
yoff += tiles * pixmapEdge + 10;
diff --git a/tests/manual/rhi/hellominimalcrossgfxtriangle/hellominimalcrossgfxtriangle.cpp b/tests/manual/rhi/hellominimalcrossgfxtriangle/hellominimalcrossgfxtriangle.cpp
index 3c39ff1719..ea1fefc308 100644
--- a/tests/manual/rhi/hellominimalcrossgfxtriangle/hellominimalcrossgfxtriangle.cpp
+++ b/tests/manual/rhi/hellominimalcrossgfxtriangle/hellominimalcrossgfxtriangle.cpp
@@ -298,7 +298,7 @@ void Window::init()
m_sc = m_r->newSwapChain();
// allow depth-stencil, although we do not actually enable depth test/write for the triangle
m_ds = m_r->newRenderBuffer(QRhiRenderBuffer::DepthStencil,
- QSize(), // no need to set the size yet
+ QSize(), // no need to set the size here, due to UsedWithSwapChainOnly
1,
QRhiRenderBuffer::UsedWithSwapChainOnly);
releasePool << m_ds;
@@ -376,16 +376,12 @@ void Window::releaseResources()
void Window::resizeSwapChain()
{
- const QSize outputSize = m_sc->surfacePixelSize();
-
- m_ds->setPixelSize(outputSize);
- m_ds->build(); // == m_ds->release(); m_ds->build();
-
- m_hasSwapChain = m_sc->buildOrResize();
+ m_hasSwapChain = m_sc->buildOrResize(); // also handles m_ds
m_elapsedMs = 0;
m_elapsedCount = 0;
+ const QSize outputSize = m_sc->currentPixelSize();
m_proj = m_r->clipSpaceCorrMatrix();
m_proj.perspective(45.0f, outputSize.width() / (float) outputSize.height(), 0.01f, 100.0f);
m_proj.translate(0, 0, -4);
diff --git a/tests/manual/rhi/mrt/mrt.cpp b/tests/manual/rhi/mrt/mrt.cpp
index 258871f9b3..dc72c7d194 100644
--- a/tests/manual/rhi/mrt/mrt.cpp
+++ b/tests/manual/rhi/mrt/mrt.cpp
@@ -200,12 +200,10 @@ void Window::customInit()
{ QRhiShaderStage::Vertex, getShader(QLatin1String(":/mrt.vert.qsb")) },
{ QRhiShaderStage::Fragment, getShader(QLatin1String(":/mrt.frag.qsb")) }
});
- QVector<QRhiGraphicsPipeline::TargetBlend> blends;
- for (int i = 0; i < ATTCOUNT; ++i) {
- QRhiGraphicsPipeline::TargetBlend blend;
- blends.append(blend);
- }
- d.triPs->setTargetBlends(blends);
+
+ QRhiGraphicsPipeline::TargetBlend blends[ATTCOUNT]; // defaults to blending == false
+ d.triPs->setTargetBlends(blends, blends + ATTCOUNT);
+
inputLayout.setBindings({
{ 5 * sizeof(float) }
});
diff --git a/tests/manual/rhi/msaatexture/msaatexture.cpp b/tests/manual/rhi/msaatexture/msaatexture.cpp
index d23a4a8d47..2fb466c8d6 100644
--- a/tests/manual/rhi/msaatexture/msaatexture.cpp
+++ b/tests/manual/rhi/msaatexture/msaatexture.cpp
@@ -240,7 +240,7 @@ void Window::customInit()
#else
d.msaaTriPs->setSampleCount(1);
#endif
- d.msaaTriPs->setShaderStages(d.triPs->shaderStages());
+ d.msaaTriPs->setShaderStages(d.triPs->cbeginShaderStages(), d.triPs->cendShaderStages());
d.msaaTriPs->setVertexInputLayout(d.triPs->vertexInputLayout());
d.msaaTriPs->setShaderResourceBindings(d.triSrb);
d.msaaTriPs->setRenderPassDescriptor(d.msaaRtRp);
diff --git a/tests/manual/rhi/multiwindow/multiwindow.cpp b/tests/manual/rhi/multiwindow/multiwindow.cpp
index 4c5d5c345a..4d5de16a58 100644
--- a/tests/manual/rhi/multiwindow/multiwindow.cpp
+++ b/tests/manual/rhi/multiwindow/multiwindow.cpp
@@ -400,7 +400,7 @@ void Window::init()
{
m_sc = r.r->newSwapChain();
m_ds = r.r->newRenderBuffer(QRhiRenderBuffer::DepthStencil,
- QSize(), // no need to set the size yet
+ QSize(),
1,
QRhiRenderBuffer::UsedWithSwapChainOnly);
m_releasePool << m_ds;
@@ -427,13 +427,9 @@ void Window::releaseResources()
void Window::resizeSwapChain()
{
- const QSize outputSize = m_sc->surfacePixelSize();
-
- m_ds->setPixelSize(outputSize);
- m_ds->build();
-
m_hasSwapChain = m_sc->buildOrResize();
+ const QSize outputSize = m_sc->currentPixelSize();
m_proj = r.r->clipSpaceCorrMatrix();
m_proj.perspective(45.0f, outputSize.width() / (float) outputSize.height(), 0.01f, 1000.0f);
m_proj.translate(0, 0, -4);
diff --git a/tests/manual/rhi/multiwindow_threaded/multiwindow_threaded.cpp b/tests/manual/rhi/multiwindow_threaded/multiwindow_threaded.cpp
index 53185bddb2..37c6cd04c3 100644
--- a/tests/manual/rhi/multiwindow_threaded/multiwindow_threaded.cpp
+++ b/tests/manual/rhi/multiwindow_threaded/multiwindow_threaded.cpp
@@ -441,7 +441,7 @@ void Renderer::init()
{
m_sc = r->newSwapChain();
m_ds = r->newRenderBuffer(QRhiRenderBuffer::DepthStencil,
- QSize(), // no need to set the size yet
+ QSize(),
1,
QRhiRenderBuffer::UsedWithSwapChainOnly);
m_releasePool << m_ds;
@@ -543,11 +543,9 @@ void Renderer::render(bool newlyExposed, bool wakeBeforePresent)
auto buildOrResizeSwapChain = [this] {
qDebug() << "renderer" << this << "build or resize swapchain for window" << window;
- const QSize outputSize = m_sc->surfacePixelSize();
- qDebug() << " size is" << outputSize;
- m_ds->setPixelSize(outputSize);
- m_ds->build();
m_hasSwapChain = m_sc->buildOrResize();
+ const QSize outputSize = m_sc->currentPixelSize();
+ qDebug() << " size is" << outputSize;
m_proj = r->clipSpaceCorrMatrix();
m_proj.perspective(45.0f, outputSize.width() / (float) outputSize.height(), 0.01f, 100.0f);
m_proj.translate(0, 0, -4);
diff --git a/tests/manual/rhi/shared/examplefw.h b/tests/manual/rhi/shared/examplefw.h
index 220c3d0ff2..d28bbea0a8 100644
--- a/tests/manual/rhi/shared/examplefw.h
+++ b/tests/manual/rhi/shared/examplefw.h
@@ -58,6 +58,7 @@
#include <QPlatformSurfaceEvent>
#include <QElapsedTimer>
#include <QTimer>
+#include <QLoggingCategory>
#include <QtGui/private/qshader_p.h>
#include <QFile>
@@ -70,7 +71,6 @@
#endif
#if QT_CONFIG(vulkan)
-#include <QLoggingCategory>
#include <QtGui/private/qrhivulkan_p.h>
#endif
@@ -307,7 +307,7 @@ void Window::init()
m_sc = m_r->newSwapChain();
// allow depth-stencil, although we do not actually enable depth test/write for the triangle
m_ds = m_r->newRenderBuffer(QRhiRenderBuffer::DepthStencil,
- QSize(), // no need to set the size yet
+ QSize(), // no need to set the size here, due to UsedWithSwapChainOnly
sampleCount,
QRhiRenderBuffer::UsedWithSwapChainOnly);
m_sc->setWindow(this);
@@ -344,16 +344,12 @@ void Window::releaseResources()
void Window::resizeSwapChain()
{
- const QSize outputSize = m_sc->surfacePixelSize();
-
- m_ds->setPixelSize(outputSize);
- m_ds->build(); // == m_ds->release(); m_ds->build();
-
- m_hasSwapChain = m_sc->buildOrResize();
+ m_hasSwapChain = m_sc->buildOrResize(); // also handles m_ds
m_frameCount = 0;
m_timer.restart();
+ const QSize outputSize = m_sc->currentPixelSize();
m_proj = m_r->clipSpaceCorrMatrix();
m_proj.perspective(45.0f, outputSize.width() / (float) outputSize.height(), 0.01f, 1000.0f);
m_proj.translate(0, 0, -4);
@@ -444,6 +440,8 @@ int main(int argc, char **argv)
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
+ QLoggingCategory::setFilterRules(QLatin1String("qt.rhi.*=true"));
+
// Defaults.
#if defined(Q_OS_WIN)
graphicsApi = D3D11;
diff --git a/tests/manual/rhi/texuploads/texuploads.cpp b/tests/manual/rhi/texuploads/texuploads.cpp
index f29a989187..4c10a6b965 100644
--- a/tests/manual/rhi/texuploads/texuploads.cpp
+++ b/tests/manual/rhi/texuploads/texuploads.cpp
@@ -68,6 +68,8 @@ struct {
QRhiTexture *newTex = nullptr;
QRhiTexture *importedTex = nullptr;
int testStage = 0;
+
+ QRhiShaderResourceBinding bindings[2];
} d;
void Window::customInit()
@@ -100,10 +102,10 @@ void Window::customInit()
d.srb = m_r->newShaderResourceBindings();
d.releasePool << d.srb;
- d.srb->setBindings({
- QRhiShaderResourceBinding::uniformBuffer(0, QRhiShaderResourceBinding::VertexStage | QRhiShaderResourceBinding::FragmentStage, d.ubuf),
- QRhiShaderResourceBinding::sampledTexture(1, QRhiShaderResourceBinding::FragmentStage, d.tex, d.sampler)
- });
+
+ d.bindings[0] = QRhiShaderResourceBinding::uniformBuffer(0, QRhiShaderResourceBinding::VertexStage | QRhiShaderResourceBinding::FragmentStage, d.ubuf);
+ d.bindings[1] = QRhiShaderResourceBinding::sampledTexture(1, QRhiShaderResourceBinding::FragmentStage, d.tex, d.sampler);
+ d.srb->setBindings(d.bindings, d.bindings + 2);
d.srb->build();
d.ps = m_r->newGraphicsPipeline();
@@ -211,9 +213,8 @@ void Window::customRender()
u->copyTexture(d.newTex, d.tex, desc);
// Now replace d.tex with d.newTex as the shader resource.
- auto bindings = d.srb->bindings();
- bindings[1] = QRhiShaderResourceBinding::sampledTexture(1, QRhiShaderResourceBinding::FragmentStage, d.newTex, d.sampler);
- d.srb->setBindings(bindings);
+ d.bindings[1] = QRhiShaderResourceBinding::sampledTexture(1, QRhiShaderResourceBinding::FragmentStage, d.newTex, d.sampler);
+ d.srb->setBindings(d.bindings, d.bindings + 2);
// "rebuild", whatever that means for a given backend. This srb is
// already live as the ps in the setGraphicsPipeline references it,
// but that's fine. Changes will be picked up automatically.
@@ -259,9 +260,8 @@ void Window::customRender()
// underneath (owned by d.tex)
// switch to showing d.importedTex
- auto bindings = d.srb->bindings();
- bindings[1] = QRhiShaderResourceBinding::sampledTexture(1, QRhiShaderResourceBinding::FragmentStage, d.importedTex, d.sampler);
- d.srb->setBindings(bindings);
+ d.bindings[1] = QRhiShaderResourceBinding::sampledTexture(1, QRhiShaderResourceBinding::FragmentStage, d.importedTex, d.sampler);
+ d.srb->setBindings(d.bindings, d.bindings + 2);
d.srb->build();
} else {
qWarning("Accessing native texture object is not supported");
@@ -270,9 +270,8 @@ void Window::customRender()
// Exercise uploading uncompressed data without a QImage.
if (d.testStage == 7) {
- auto bindings = d.srb->bindings();
- bindings[1] = QRhiShaderResourceBinding::sampledTexture(1, QRhiShaderResourceBinding::FragmentStage, d.newTex, d.sampler);
- d.srb->setBindings(bindings);
+ d.bindings[1] = QRhiShaderResourceBinding::sampledTexture(1, QRhiShaderResourceBinding::FragmentStage, d.newTex, d.sampler);
+ d.srb->setBindings(d.bindings, d.bindings + 2);
d.srb->build();
const QSize sz(221, 139);
diff --git a/tests/manual/rhi/triquadcube/trianglerenderer.cpp b/tests/manual/rhi/triquadcube/trianglerenderer.cpp
index 0980acca49..5d932aea52 100644
--- a/tests/manual/rhi/triquadcube/trianglerenderer.cpp
+++ b/tests/manual/rhi/triquadcube/trianglerenderer.cpp
@@ -94,11 +94,11 @@ void TriangleRenderer::initResources(QRhiRenderPassDescriptor *rp)
QRhiGraphicsPipeline::TargetBlend premulAlphaBlend; // convenient defaults...
premulAlphaBlend.enable = true;
- QVector<QRhiGraphicsPipeline::TargetBlend> rtblends;
+ QVarLengthArray<QRhiGraphicsPipeline::TargetBlend, 4> rtblends;
for (int i = 0; i < m_colorAttCount; ++i)
rtblends << premulAlphaBlend;
- m_ps->setTargetBlends(rtblends);
+ m_ps->setTargetBlends(rtblends.cbegin(), rtblends.cend());
m_ps->setSampleCount(m_sampleCount);
if (m_depthWrite) { // TriangleOnCube may want to exercise this