diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2019-10-05 16:05:06 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2019-10-09 17:15:05 +0200 |
commit | 9baf69c765c446b7c8f069ebdd50910877a7d0f8 (patch) | |
tree | c996af48af33b51b35273f66674d61beccf43de5 /tests/auto/gui/rhi | |
parent | 32924110ce69498ab5b05d00728f77affd6817d9 (diff) |
rhi: gl: Add a feature flag for reading back non-zero mip levels
The joys of "level - Specifies the mipmap level of the texture
image to be attached, which must be 0." for glFramebufferTexture2D
in OpenGL ES 2.0.
Change-Id: Iaf19502f48d7ba73b26abb72535bfa6696a1e182
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'tests/auto/gui/rhi')
-rw-r--r-- | tests/auto/gui/rhi/qrhi/tst_qrhi.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp b/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp index a17495f317..aa20b0fd4a 100644 --- a/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp +++ b/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp @@ -277,7 +277,8 @@ void tst_QRhi::create() QRhi::BaseVertex, QRhi::BaseInstance, QRhi::TriangleFanTopology, - QRhi::ReadBackNonUniformBuffer + QRhi::ReadBackNonUniformBuffer, + QRhi::ReadBackNonBaseMipLevel }; for (size_t i = 0; i <sizeof(features) / sizeof(QRhi::Feature); ++i) rhi->isFeatureSupported(features[i]); @@ -965,10 +966,16 @@ void tst_QRhi::resourceUpdateBatchRGBATextureMip() QImage wrapperImage(reinterpret_cast<const uchar *>(readResult.data.constData()), readResult.pixelSize.width(), readResult.pixelSize.height(), red.format()); - - // Compare to a scaled version; we can do this safely only because we - // only have plain red pixels in the source image. - QImage expectedImage = red.scaled(expectedSize); + QImage expectedImage; + if (level == 0 || rhi->isFeatureSupported(QRhi::ReadBackNonBaseMipLevel)) { + // Compare to a scaled version; we can do this safely only because we + // only have plain red pixels in the source image. + expectedImage = red.scaled(expectedSize); + } else { + qDebug("Expecting all-zero image for level %d because reading back a level other than 0 is not supported", level); + expectedImage = QImage(readResult.pixelSize, red.format()); + expectedImage.fill(0); + } QVERIFY(imageRGBAEquals(expectedImage, wrapperImage)); } } |