diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2019-10-02 10:58:44 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2019-10-03 09:37:48 +0200 |
commit | f1c7814a55903dad5a5e77683bdcca5fc3805394 (patch) | |
tree | 3de4f3da1506349d7ed06cc4d6593bfd499383ba /tests | |
parent | 1a8f4a3c8fa30265e7f184373c738dbc3574663a (diff) |
rhi: Remove QVectors from the data description structs as well
As usual, keep some QVector overloads around to allow Qt Quick to compile.
Color attachments and vertex input bindings get an at(index) type of
accessor, unlike any other of similar lists. This is because there the
index is significant, and sequential iteration is not the only type of
operation that is performed. Sometimes a lookup based on an index will
be needed as well.
Task-number: QTBUG-78883
Change-Id: I3882941f09e94ee2f179e0e9b8161551f0d5dae7
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/manual/rhi/compressedtexture_bc1/compressedtexture_bc1.cpp | 6 | ||||
-rw-r--r-- | tests/manual/rhi/mrt/mrt.cpp | 6 | ||||
-rw-r--r-- | tests/manual/rhi/triquadcube/texturedcuberenderer.cpp | 8 |
3 files changed, 12 insertions, 8 deletions
diff --git a/tests/manual/rhi/compressedtexture_bc1/compressedtexture_bc1.cpp b/tests/manual/rhi/compressedtexture_bc1/compressedtexture_bc1.cpp index bb3722bec5..af454c2487 100644 --- a/tests/manual/rhi/compressedtexture_bc1/compressedtexture_bc1.cpp +++ b/tests/manual/rhi/compressedtexture_bc1/compressedtexture_bc1.cpp @@ -165,11 +165,13 @@ void Window::customRender() u->updateDynamicBuffer(d.ubuf, 64, 4, &flip); } if (!d.compressedData.isEmpty()) { - QRhiTextureUploadDescription desc; + QVarLengthArray<QRhiTextureUploadEntry, 16> descEntries; for (int i = 0; i < d.compressedData.count(); ++i) { QRhiTextureSubresourceUploadDescription image(d.compressedData[i].constData(), d.compressedData[i].size()); - desc.append({ 0, i, image }); + descEntries.append({ 0, i, image }); } + QRhiTextureUploadDescription desc; + desc.setEntries(descEntries.cbegin(), descEntries.cend()); u->uploadTexture(d.tex, desc); d.compressedData.clear(); } diff --git a/tests/manual/rhi/mrt/mrt.cpp b/tests/manual/rhi/mrt/mrt.cpp index dc72c7d194..dfec5bb1d1 100644 --- a/tests/manual/rhi/mrt/mrt.cpp +++ b/tests/manual/rhi/mrt/mrt.cpp @@ -143,10 +143,10 @@ void Window::customInit() } QRhiTextureRenderTargetDescription rtDesc; - QVector<QRhiColorAttachment> att; + QRhiColorAttachment att[ATTCOUNT]; for (int i = 0; i < ATTCOUNT; ++i) - att.append(QRhiColorAttachment(d.colData[i].tex)); - rtDesc.setColorAttachments(att); + att[i] = QRhiColorAttachment(d.colData[i].tex); + rtDesc.setColorAttachments(att, att + ATTCOUNT); d.rt = m_r->newTextureRenderTarget(rtDesc); d.releasePool << d.rt; d.rtRp = d.rt->newCompatibleRenderPassDescriptor(); diff --git a/tests/manual/rhi/triquadcube/texturedcuberenderer.cpp b/tests/manual/rhi/triquadcube/texturedcuberenderer.cpp index 3f15881e2d..8c5845d4fc 100644 --- a/tests/manual/rhi/triquadcube/texturedcuberenderer.cpp +++ b/tests/manual/rhi/triquadcube/texturedcuberenderer.cpp @@ -181,16 +181,18 @@ void TexturedCubeRenderer::queueResourceUpdates(QRhiResourceUpdateBatch *resourc if (!m_image.isNull()) { if (MIPMAP) { - QRhiTextureUploadDescription desc; + QVarLengthArray<QRhiTextureUploadEntry, 16> descEntries; if (!AUTOGENMIPMAP) { // the ghetto mipmap generator... for (int i = 0, ie = m_r->mipLevelsForSize(m_image.size()); i != ie; ++i) { QImage image = m_image.scaled(m_r->sizeForMipLevel(i, m_image.size())); - desc.append({ 0, i, image }); + descEntries.append({ 0, i, image }); } } else { - desc.append({ 0, 0, m_image }); + descEntries.append({ 0, 0, m_image }); } + QRhiTextureUploadDescription desc; + desc.setEntries(descEntries.cbegin(), descEntries.cend()); resourceUpdates->uploadTexture(m_tex, desc); if (AUTOGENMIPMAP) resourceUpdates->generateMips(m_tex); |