summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2021-09-15 13:28:44 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2021-09-16 22:58:17 +0200
commit43a42fa19693d8ee1a52a5723aa026ee1ccd5de2 (patch)
treed936b77ba8c110cfb8dd8261c1997203aa2df612 /tests/auto/gui
parentc5a3cabce0f9fd615a77772002d6e1b5ca121919 (diff)
rhi: Allow testing renderpass compatibility without the objects
Follow what has been done for QRhiShaderResourceBindings. Have a way to retrieve an opaque blob (that just happens to be a list of integers) so that a simple == comparison can be used to determine compatibility even when the objects from which the blob was retrieved are no longer alive. The contract is the following: bool a = rp1->isCompatible(rp2); bool b = rp1->serializedFormat() == rp2->serializedFormat(); assert(a == b); Pick-to: 6.2 Change-Id: I45e7d05eeb6dfa2b2de474da0a0644912aaf174a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Diffstat (limited to 'tests/auto/gui')
-rw-r--r--tests/auto/gui/rhi/qrhi/tst_qrhi.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp b/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp
index 8398dac3eb..6606589103 100644
--- a/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp
+++ b/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp
@@ -3505,6 +3505,7 @@ void tst_QRhi::renderPassDescriptorCompatibility()
QVERIFY(rpDesc->isCompatible(rpDesc2.data()));
QVERIFY(rpDesc2->isCompatible(rpDesc.data()));
+ QCOMPARE(rpDesc->serializedFormat(), rpDesc2->serializedFormat());
}
// two texture rendertargets with tex and tex2 as color0, and a depth-stencil attachment as well (compatible)
@@ -3522,6 +3523,7 @@ void tst_QRhi::renderPassDescriptorCompatibility()
QVERIFY(rpDesc->isCompatible(rpDesc2.data()));
QVERIFY(rpDesc2->isCompatible(rpDesc.data()));
+ QCOMPARE(rpDesc->serializedFormat(), rpDesc2->serializedFormat());
}
// now one of them does not have the ds attachment (not compatible)
@@ -3536,9 +3538,13 @@ void tst_QRhi::renderPassDescriptorCompatibility()
rt2->setRenderPassDescriptor(rpDesc2.data());
QVERIFY(rt2->create());
+ // these backends have a real concept of rp compatibility, with those we
+ // know that incompatibility must be reported; verify this
if (impl == QRhi::Vulkan || impl == QRhi::Metal) {
QVERIFY(!rpDesc->isCompatible(rpDesc2.data()));
QVERIFY(!rpDesc2->isCompatible(rpDesc.data()));
+ QVERIFY(!rpDesc->serializedFormat().isEmpty());
+ QVERIFY(rpDesc->serializedFormat() != rpDesc2->serializedFormat());
}
}
@@ -3566,6 +3572,7 @@ void tst_QRhi::renderPassDescriptorCompatibility()
QVERIFY(rpDesc->isCompatible(rpDesc2.data()));
QVERIFY(rpDesc2->isCompatible(rpDesc.data()));
+ QCOMPARE(rpDesc->serializedFormat(), rpDesc2->serializedFormat());
}
// missing resolve for one of them (not compatible)
@@ -3591,6 +3598,8 @@ void tst_QRhi::renderPassDescriptorCompatibility()
if (impl == QRhi::Vulkan) { // no Metal here
QVERIFY(!rpDesc->isCompatible(rpDesc2.data()));
QVERIFY(!rpDesc2->isCompatible(rpDesc.data()));
+ QVERIFY(!rpDesc->serializedFormat().isEmpty());
+ QVERIFY(rpDesc->serializedFormat() != rpDesc2->serializedFormat());
}
}
} else {
@@ -3616,6 +3625,8 @@ void tst_QRhi::renderPassDescriptorCompatibility()
if (impl == QRhi::Vulkan || impl == QRhi::Metal) {
QVERIFY(!rpDesc->isCompatible(rpDesc2.data()));
QVERIFY(!rpDesc2->isCompatible(rpDesc.data()));
+ QVERIFY(!rpDesc->serializedFormat().isEmpty());
+ QVERIFY(rpDesc->serializedFormat() != rpDesc2->serializedFormat());
}
}
} else {