Debian Codegraph @

tests/auto/render/rhi/rhi_graphicspipelinemanager/tst_rhi_graphicspipelinemanager.cpp

raw symbols SCIP
1 // Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB).
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4 #include <QtTest/QTest>
5 #include <qbackendnodetester.h>
6 #include <testarbiter.h>
7 #include <testrenderer.h>
8 #include <private/shader_p.h>
9 #include <Qt3DRender/qshaderprogram.h>
10 #include <Qt3DRender/private/renderviewjobutils_p.h>
11 #include <rendercommand_p.h>
12 #include <renderer_p.h>
13 #include <rhiresourcemanagers_p.h>
14
15 QT_BEGIN_NAMESPACE
16
17 namespace Qt3DRender {
18
19 namespace Render {
20
21 namespace Rhi {
22
23 class tst_Rhi_GraphicsPipelineManager : public Qt3DCore::QBackendNodeTester
24 {
25 Q_OBJECT
26
27 private Q_SLOTS:
28
29 void checkAttributeInfoComparison()
30 {
31 // GIVEN
32 RHIGraphicsPipelineManager pipelineManagers;
33
34 // WHEN
35 std::vector<AttributeInfo> infoList1 = {
36 { 1, QRhiVertexInputBinding::PerVertex, 32, 0, 0 },
37 { 2, QRhiVertexInputBinding::PerVertex, 32, 8, 0 },
38 };
39 const int infoList1ID = pipelineManagers.getIdForAttributeVec(infoList1);
40
41 // THEN
42 QCOMPARE(infoList1ID, 0);
43
44 // WHEN
45 std::vector<AttributeInfo> infoList2 = {
46 { 1, QRhiVertexInputBinding::PerVertex, 32, 0, 0 },
47 { 2, QRhiVertexInputBinding::PerVertex, 32, 8, 0 },
48 { 3, QRhiVertexInputBinding::PerVertex, 32, 16, 0 },
49 };
50 const int infoList2ID = pipelineManagers.getIdForAttributeVec(infoList2);
51
52 // THEN
53 QCOMPARE(infoList2ID, 1);
54
55 // WHEN
56 std::vector<AttributeInfo> infoList3 = {
57 { 1, QRhiVertexInputBinding::PerVertex, 32, 0, 0 },
58 { 2, QRhiVertexInputBinding::PerVertex, 32, 8, 0 },
59 };
60 const int infoList3ID = pipelineManagers.getIdForAttributeVec(infoList3);
61
62 // THEN
63 QCOMPARE(infoList3ID, infoList1ID);
64 }
65 };
66
67 } // Rhi
68
69 } // Render
70
71 } // Qt3DRender
72
73 QT_END_NAMESPACE
74
75 QTEST_MAIN(Qt3DRender::Render::Rhi::tst_Rhi_GraphicsPipelineManager)
76
77 #include "tst_rhi_graphicspipelinemanager.moc"