summaryrefslogtreecommitdiffstats
path: root/tests/manual/rhi/triquadcube
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2019-09-28 15:19:09 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2019-09-30 20:07:43 +0200
commit7000b66f7e85e58d267b71322fbb3d5a0fc356b8 (patch)
tree77d098a0f7d759686fb43942a881dcc9718ebba4 /tests/manual/rhi/triquadcube
parentd4c17725abe381d247d6c453dafe87b8e17e80de (diff)
Remove QVector in the API of QRhiResource subclasses
Forcing users to go through a QVector, when in practice they almost always want to source the data from an initializer list, a QVarLengthArray, or a plain C array, is not ideal. Especially since we can reason about the maximum number of elements in the vast majority of use cases for all the affected lists. QRhiResource is also not copyable so we do not need the usual machinery offered by containers. So switch to a QVarLengthArray. Note that a resource is not a container. The only operations we are interested in is to be able to source data either via an initializer list or by iterating on something, and to be able to extract the data, in case a user wishes to set up another resource based on the existing one. In some cases a QVector overload is kept for source compatibility with other modules (Qt Quick). These may be removed in the future. Also do a similar QVector->QVarLengthArray change in the srb-related data in the backends. Change-Id: I6f5b2ebd8e75416ce0cca0817bb529446a4cb664 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Diffstat (limited to 'tests/manual/rhi/triquadcube')
-rw-r--r--tests/manual/rhi/triquadcube/trianglerenderer.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/manual/rhi/triquadcube/trianglerenderer.cpp b/tests/manual/rhi/triquadcube/trianglerenderer.cpp
index 0980acca49..5d932aea52 100644
--- a/tests/manual/rhi/triquadcube/trianglerenderer.cpp
+++ b/tests/manual/rhi/triquadcube/trianglerenderer.cpp
@@ -94,11 +94,11 @@ void TriangleRenderer::initResources(QRhiRenderPassDescriptor *rp)
QRhiGraphicsPipeline::TargetBlend premulAlphaBlend; // convenient defaults...
premulAlphaBlend.enable = true;
- QVector<QRhiGraphicsPipeline::TargetBlend> rtblends;
+ QVarLengthArray<QRhiGraphicsPipeline::TargetBlend, 4> rtblends;
for (int i = 0; i < m_colorAttCount; ++i)
rtblends << premulAlphaBlend;
- m_ps->setTargetBlends(rtblends);
+ m_ps->setTargetBlends(rtblends.cbegin(), rtblends.cend());
m_ps->setSampleCount(m_sampleCount);
if (m_depthWrite) { // TriangleOnCube may want to exercise this