summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2020-07-13 16:48:10 +0200
committerPaul Lemire <paul.lemire@kdab.com>2020-07-16 10:55:14 +0200
commit0904479c1294797d6dcd2d9b7cce641eec041206 (patch)
tree19693e7493b612ad5573c537de577cdeb014595b /tests
parent3b290d1c820f272268836057bcb489dff7531e75 (diff)
PipelineKey: use Geometry Layout instead of GeometryID
- Allows to create less pipelines - PipelineUBO: use aligned offsets - RenderCommand store ShaderResourceBindings (avoids creatings a new one every frame) and store last used bindings to see if rebuild is required. Change-Id: I3a44d340a92f5c48f150896b9aa9912527b3b1ea Reviewed-by: Mike Krus <mike.krus@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/render/rhi/CMakeLists.txt1
-rw-r--r--tests/auto/render/rhi/rhi.pro3
-rw-r--r--tests/auto/render/rhi/rhi_graphicspipelinemanager/CMakeLists.txt27
-rw-r--r--tests/auto/render/rhi/rhi_graphicspipelinemanager/rhi_graphicspipelinemanager.pro15
-rw-r--r--tests/auto/render/rhi/rhi_graphicspipelinemanager/tst_rhi_graphicspipelinemanager.cpp102
5 files changed, 147 insertions, 1 deletions
diff --git a/tests/auto/render/rhi/CMakeLists.txt b/tests/auto/render/rhi/CMakeLists.txt
index 009b6c0ef..5c3043bbe 100644
--- a/tests/auto/render/rhi/CMakeLists.txt
+++ b/tests/auto/render/rhi/CMakeLists.txt
@@ -3,4 +3,5 @@
if (NOT QT_BUILD_STANDALONE_TESTS)
add_subdirectory(rhi_renderviews)
add_subdirectory(rhi_rendercommands)
+ add_subdirectory(rhi_graphicspipelinemanager)
endif()
diff --git a/tests/auto/render/rhi/rhi.pro b/tests/auto/render/rhi/rhi.pro
index 543ea043a..9391c8ce0 100644
--- a/tests/auto/render/rhi/rhi.pro
+++ b/tests/auto/render/rhi/rhi.pro
@@ -2,4 +2,5 @@ TEMPLATE = subdirs
SUBDIRS += \
rhi_renderviews \
- rhi_rendercommands
+ rhi_rendercommands \
+ rhi_graphicspipelinemanager
diff --git a/tests/auto/render/rhi/rhi_graphicspipelinemanager/CMakeLists.txt b/tests/auto/render/rhi/rhi_graphicspipelinemanager/CMakeLists.txt
new file mode 100644
index 000000000..0875e4f71
--- /dev/null
+++ b/tests/auto/render/rhi/rhi_graphicspipelinemanager/CMakeLists.txt
@@ -0,0 +1,27 @@
+# Generated from rhi_graphicspipelinemanager.pro.
+
+#####################################################################
+## tst_rhi_graphicspipelinemanager Test:
+#####################################################################
+
+qt_add_test(tst_rhi_graphicspipelinemanager
+ SOURCES
+ tst_rhi_graphicspipelinemanager.cpp
+)
+
+## Scopes:
+#####################################################################
+
+include(../../commons/commons.cmake)
+qt3d_setup_common_render_test(tst_rhi_graphicspipelinemanager USE_TEST_ASPECT)
+include(${PROJECT_SOURCE_DIR}/src/plugins/renderers/rhi/rhi.cmake)
+qt3d_setup_rhi_renderer_target(tst_rhi_graphicspipelinemanager)
+
+qt_extend_target(tst_rhi_graphicspipelinemanager CONDITION gcov
+ COMPILE_OPTIONS
+ -fprofile-arcs
+ -ftest-coverage
+ LINK_OPTIONS
+ "-fprofile-arcs"
+ "-ftest-coverage"
+)
diff --git a/tests/auto/render/rhi/rhi_graphicspipelinemanager/rhi_graphicspipelinemanager.pro b/tests/auto/render/rhi/rhi_graphicspipelinemanager/rhi_graphicspipelinemanager.pro
new file mode 100644
index 000000000..33d26fed8
--- /dev/null
+++ b/tests/auto/render/rhi/rhi_graphicspipelinemanager/rhi_graphicspipelinemanager.pro
@@ -0,0 +1,15 @@
+TEMPLATE = app
+
+TARGET = tst_rhi_rendercommands
+
+QT += 3dcore 3dcore-private 3drender 3drender-private testlib
+
+CONFIG += testcase
+
+SOURCES += tst_rhi_rendercommands.cpp
+
+include(../../../core/common/common.pri)
+include(../../commons/commons.pri)
+
+# Link Against RHI Renderer Plugin
+include(../rhi_render_plugin.pri)
diff --git a/tests/auto/render/rhi/rhi_graphicspipelinemanager/tst_rhi_graphicspipelinemanager.cpp b/tests/auto/render/rhi/rhi_graphicspipelinemanager/tst_rhi_graphicspipelinemanager.cpp
new file mode 100644
index 000000000..3959fdad3
--- /dev/null
+++ b/tests/auto/render/rhi/rhi_graphicspipelinemanager/tst_rhi_graphicspipelinemanager.cpp
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QTest>
+#include <qbackendnodetester.h>
+#include <testarbiter.h>
+#include <testrenderer.h>
+#include <private/shader_p.h>
+#include <Qt3DRender/qshaderprogram.h>
+#include <Qt3DRender/private/renderviewjobutils_p.h>
+#include <rendercommand_p.h>
+#include <renderer_p.h>
+#include <rhiresourcemanagers_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+namespace Rhi {
+
+class tst_Rhi_GraphicsPipelineManager : public Qt3DCore::QBackendNodeTester
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+
+ void checkAttributeInfoComparison()
+ {
+ // GIVEN
+ RHIGraphicsPipelineManager pipelineManagers;
+
+ // WHEN
+ std::vector<AttributeInfo> infoList1 = {
+ { 1, QRhiVertexInputBinding::PerVertex, 32, 0, 0 },
+ { 2, QRhiVertexInputBinding::PerVertex, 32, 8, 0 },
+ };
+ const int infoList1ID = pipelineManagers.getIdForAttributeVec(infoList1);
+
+ // THEN
+ QCOMPARE(infoList1ID, 0);
+
+ // WHEN
+ std::vector<AttributeInfo> infoList2 = {
+ { 1, QRhiVertexInputBinding::PerVertex, 32, 0, 0 },
+ { 2, QRhiVertexInputBinding::PerVertex, 32, 8, 0 },
+ { 3, QRhiVertexInputBinding::PerVertex, 32, 16, 0 },
+ };
+ const int infoList2ID = pipelineManagers.getIdForAttributeVec(infoList2);
+
+ // THEN
+ QCOMPARE(infoList2ID, 1);
+
+ // WHEN
+ std::vector<AttributeInfo> infoList3 = {
+ { 1, QRhiVertexInputBinding::PerVertex, 32, 0, 0 },
+ { 2, QRhiVertexInputBinding::PerVertex, 32, 8, 0 },
+ };
+ const int infoList3ID = pipelineManagers.getIdForAttributeVec(infoList3);
+
+ // THEN
+ QCOMPARE(infoList3ID, infoList1ID);
+ }
+};
+
+} // Rhi
+
+} // Render
+
+} // Qt3DRender
+
+QT_END_NAMESPACE
+
+QTEST_MAIN(Qt3DRender::Render::Rhi::tst_Rhi_GraphicsPipelineManager)
+
+#include "tst_rhi_graphicspipelinemanager.moc"