summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2021-09-06 15:45:01 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-09-07 13:19:18 +0000
commit6b6475539815f73dcab5ccf94ea33fd54fcb23bf (patch)
treea02fc2be91bf4df69e94d0a3008f540fa115c846 /tests
parent67027b60eed0baa196263df5485644abbfd40af3 (diff)
rhi: Make the serialized srb layout description accessible
...by the Qt Quick renderer, for example. A typical Qt Quick material binding set serializes to 8 uints. This would not demand a container like QVector. However, being implicitly shared is essential here due to the intended usage (query the serialized blob, put it into a cache key, hash it, compare it, all without any copying and new allocs; we can afford an extra alloc upon each srb construction, but don't want more afterwards in the rendering engines) Also make it clear in the pipeline docs that the optimization Qt Quick is (soon going to be) doing is legal. (the srb ref in the pipeline can be dead and dangling as long as every call to setShaderResources() specifies a layout-compatible alternative) Change-Id: I97efbea1fa3516b10c9832adbab0a21b7bc0845d Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit b6b0c33058ba7f43661e316d9f27d4102f6a988f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/rhi/qrhi/tst_qrhi.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp b/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp
index be825c8ac2..61e19434e0 100644
--- a/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp
+++ b/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp
@@ -3271,6 +3271,8 @@ void tst_QRhi::srbLayoutCompatibility()
QVERIFY(srb1->isLayoutCompatible(srb2.data()));
QVERIFY(srb2->isLayoutCompatible(srb1.data()));
+
+ QCOMPARE(srb1->serializedLayoutDescription(), srb2->serializedLayoutDescription());
}
// different count (not compatible)
@@ -3286,6 +3288,8 @@ void tst_QRhi::srbLayoutCompatibility()
QVERIFY(!srb1->isLayoutCompatible(srb2.data()));
QVERIFY(!srb2->isLayoutCompatible(srb1.data()));
+
+ QVERIFY(srb1->serializedLayoutDescription() != srb2->serializedLayoutDescription());
}
// full match (compatible)
@@ -3306,6 +3310,10 @@ void tst_QRhi::srbLayoutCompatibility()
QVERIFY(srb1->isLayoutCompatible(srb2.data()));
QVERIFY(srb2->isLayoutCompatible(srb1.data()));
+
+ QVERIFY(!srb1->serializedLayoutDescription().isEmpty());
+ QVERIFY(!srb2->serializedLayoutDescription().isEmpty());
+ QCOMPARE(srb1->serializedLayoutDescription(), srb2->serializedLayoutDescription());
}
// different visibility (not compatible)
@@ -3324,6 +3332,8 @@ void tst_QRhi::srbLayoutCompatibility()
QVERIFY(!srb1->isLayoutCompatible(srb2.data()));
QVERIFY(!srb2->isLayoutCompatible(srb1.data()));
+
+ QVERIFY(srb1->serializedLayoutDescription() != srb2->serializedLayoutDescription());
}
// different binding points (not compatible)
@@ -3342,6 +3352,8 @@ void tst_QRhi::srbLayoutCompatibility()
QVERIFY(!srb1->isLayoutCompatible(srb2.data()));
QVERIFY(!srb2->isLayoutCompatible(srb1.data()));
+
+ QVERIFY(srb1->serializedLayoutDescription() != srb2->serializedLayoutDescription());
}
// different buffer region offset and size (compatible)
@@ -3362,6 +3374,8 @@ void tst_QRhi::srbLayoutCompatibility()
QVERIFY(srb1->isLayoutCompatible(srb2.data()));
QVERIFY(srb2->isLayoutCompatible(srb1.data()));
+
+ QCOMPARE(srb1->serializedLayoutDescription(), srb2->serializedLayoutDescription());
}
// different resources (compatible)
@@ -3382,6 +3396,8 @@ void tst_QRhi::srbLayoutCompatibility()
QVERIFY(srb1->isLayoutCompatible(srb2.data()));
QVERIFY(srb2->isLayoutCompatible(srb1.data()));
+
+ QCOMPARE(srb1->serializedLayoutDescription(), srb2->serializedLayoutDescription());
}
}