From 7000b66f7e85e58d267b71322fbb3d5a0fc356b8 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Sat, 28 Sep 2019 15:19:09 +0200 Subject: Remove QVector in the API of QRhiResource subclasses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- tests/manual/rhi/mrt/mrt.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'tests/manual/rhi/mrt') diff --git a/tests/manual/rhi/mrt/mrt.cpp b/tests/manual/rhi/mrt/mrt.cpp index 258871f9b3..dc72c7d194 100644 --- a/tests/manual/rhi/mrt/mrt.cpp +++ b/tests/manual/rhi/mrt/mrt.cpp @@ -200,12 +200,10 @@ void Window::customInit() { QRhiShaderStage::Vertex, getShader(QLatin1String(":/mrt.vert.qsb")) }, { QRhiShaderStage::Fragment, getShader(QLatin1String(":/mrt.frag.qsb")) } }); - QVector blends; - for (int i = 0; i < ATTCOUNT; ++i) { - QRhiGraphicsPipeline::TargetBlend blend; - blends.append(blend); - } - d.triPs->setTargetBlends(blends); + + QRhiGraphicsPipeline::TargetBlend blends[ATTCOUNT]; // defaults to blending == false + d.triPs->setTargetBlends(blends, blends + ATTCOUNT); + inputLayout.setBindings({ { 5 * sizeof(float) } }); -- cgit v1.2.3