summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2021-09-19 10:50:17 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2021-09-20 12:25:37 +0200
commit481bc82d5931d5c715c2e889da6f249aa88057de (patch)
tree2a7973d6318142d7815474dacf4245811a22619b /tests/auto/gui
parentb4bb3a5415e44bccee08f3aa5423f217629e158b (diff)
rhi: Remove Q_RELOCATABLE_TYPE for types with QVLA in them
QVLA itself is non-relocatable due to self references. (ptr pointing to array[Prealloc] as long as capacity < Prealloc) Seems we shot ourselves in the foot in multiple places with this. Pick-to: 6.2 6.2.0 Fixes: QTBUG-96619 Change-Id: I57a2ce539b671326cd352dbe57a1f3d4c46a6456 Reviewed-by: Tobias Koenig <tobias.koenig@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests/auto/gui')
-rw-r--r--tests/auto/gui/rhi/qrhi/tst_qrhi.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp b/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp
index 47dfe8334e..24d6ad2d7c 100644
--- a/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp
+++ b/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp
@@ -33,6 +33,7 @@
#include <QPainter>
#include <QtGui/private/qrhi_p.h>
+#include <QtGui/private/qrhi_p_p.h>
#include <QtGui/private/qrhinull_p.h>
#if QT_CONFIG(opengl)
@@ -93,6 +94,8 @@ private slots:
void resourceUpdateBatchRGBATextureMip();
void resourceUpdateBatchTextureRawDataStride_data();
void resourceUpdateBatchTextureRawDataStride();
+ void resourceUpdateBatchLotsOfResources_data();
+ void resourceUpdateBatchLotsOfResources();
void invalidPipeline_data();
void invalidPipeline();
void srbLayoutCompatibility_data();
@@ -1371,6 +1374,49 @@ void tst_QRhi::resourceUpdateBatchTextureRawDataStride()
}
}
+void tst_QRhi::resourceUpdateBatchLotsOfResources_data()
+{
+ rhiTestData();
+}
+
+void tst_QRhi::resourceUpdateBatchLotsOfResources()
+{
+ QFETCH(QRhi::Implementation, impl);
+ QFETCH(QRhiInitParams *, initParams);
+
+ QScopedPointer<QRhi> rhi(QRhi::create(impl, initParams, QRhi::Flags(), nullptr));
+ if (!rhi)
+ QSKIP("QRhi could not be created, skipping testing resource updates");
+
+ QImage image(128, 128, QImage::Format_RGBA8888_Premultiplied);
+ image.fill(Qt::red);
+ static const float bufferData[64] = {};
+
+ QRhiResourceUpdateBatch *b = rhi->nextResourceUpdateBatch();
+ std::vector<std::unique_ptr<QRhiTexture>> textures;
+ std::vector<std::unique_ptr<QRhiBuffer>> buffers;
+
+ // QTBUG-96619
+ static const int TEXTURE_COUNT = 3 * QRhiResourceUpdateBatchPrivate::TEXTURE_OPS_STATIC_ALLOC;
+ static const int BUFFER_COUNT = 3 * QRhiResourceUpdateBatchPrivate::BUFFER_OPS_STATIC_ALLOC;
+
+ for (int i = 0; i < TEXTURE_COUNT; ++i) {
+ std::unique_ptr<QRhiTexture> texture(rhi->newTexture(QRhiTexture::RGBA8, image.size()));
+ QVERIFY(texture->create());
+ b->uploadTexture(texture.get(), image);
+ textures.push_back(std::move(texture));
+ }
+
+ for (int i = 0; i < BUFFER_COUNT; ++i) {
+ std::unique_ptr<QRhiBuffer> buffer(rhi->newBuffer(QRhiBuffer::Immutable, QRhiBuffer::VertexBuffer, 256));
+ QVERIFY(buffer->create());
+ b->uploadStaticBuffer(buffer.get(), bufferData);
+ buffers.push_back(std::move(buffer));
+ }
+
+ submitResourceUpdates(rhi.data(), b);
+}
+
static QShader loadShader(const char *name)
{
QFile f(QString::fromUtf8(name));