summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-02-20 10:17:04 +0100
committerLaszlo Agocs <laszlo.agocs@qt.io>2020-02-21 09:15:05 +0100
commitefba2530f99ce5873bd3448b3e974cbda419f461 (patch)
treed64f14a6f2ee9932200c425b0d714e53e20a31f0 /tests
parent336fe172b10eea55eba17c18b8e36b787565346c (diff)
rhi: Do not rely on unspecified relation between readbacks and FramesInFlight
Add a new queriable resource limit value MaxAsyncReadbackFrames. Change the autotest to rely on this instead of relying on the unspecified, works-by-accident relation between readbacks and FramesInFlight. This way even if the behavior diverges in some backend in the future, clients (well written ones, that is), will continue to function correctly. Also clarify the docs for FramesInFlight, and change d3d and gl to return the correct value (which is 1 from QRhi perspective; the expanded docs now explain a bit what this really means and what it does not). Change-Id: I0486715570a9e6fc5d3dc431694d1712875dfe01 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/rhi/qrhi/tst_qrhi.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp b/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp
index ee6ac950c9..ab435caa40 100644
--- a/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp
+++ b/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp
@@ -1672,9 +1672,9 @@ void tst_QRhi::renderToWindowSimple()
QVERIFY(pipeline->build());
- const int framesInFlight = rhi->resourceLimit(QRhi::FramesInFlight);
- QVERIFY(framesInFlight >= 1);
- const int FRAME_COUNT = framesInFlight + 1;
+ const int asyncReadbackFrames = rhi->resourceLimit(QRhi::MaxAsyncReadbackFrames);
+ // one frame issues the readback, then we do MaxAsyncReadbackFrames more to ensure the readback completes
+ const int FRAME_COUNT = asyncReadbackFrames + 1;
bool readCompleted = false;
QRhiReadbackResult readResult;
QImage result;
@@ -1721,8 +1721,8 @@ void tst_QRhi::renderToWindowSimple()
}
// The readback is asynchronous here. However it is guaranteed that it
- // finished at latest after rendering QRhi::FramesInFlight frames after the
- // one that enqueues the readback.
+ // finished at latest after rendering QRhi::MaxAsyncReadbackFrames frames
+ // after the one that enqueues the readback.
QVERIFY(readCompleted);
QVERIFY(readbackWidth > 0);