summaryrefslogtreecommitdiffstats
path: root/tests
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-17 12:46:36 +0200
commit0a1cefa4c58d2a668e816d1b1581bbbd85700b7a (patch)
tree3fe524a744abfcc212d0f05d0fb32500d2226b2c /tests
parent092dc581ceb63e851af7a48c02cf72926a6f4986 (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); Change-Id: I45e7d05eeb6dfa2b2de474da0a0644912aaf174a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Strømme <christian.stromme@qt.io> (cherry picked from commit 43a42fa19693d8ee1a52a5723aa026ee1ccd5de2) Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'tests')
-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 {