Merge vk-gl-cts/dev/VK_KHR_fragment_shader_barycentric into vk-gl-cts/main
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / modules / vulkan / vktTestPackage.cpp
1 /*-------------------------------------------------------------------------
2  * Vulkan Conformance Tests
3  * ------------------------
4  *
5  * Copyright (c) 2015 Google Inc.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  *//*!
20  * \file
21  * \brief Vulkan Test Package
22  *//*--------------------------------------------------------------------*/
23
24 #include "vktTestPackage.hpp"
25
26 #include "qpDebugOut.h"
27 #include "qpInfo.h"
28
29 #include "tcuPlatform.hpp"
30 #include "tcuTestCase.hpp"
31 #include "tcuTestLog.hpp"
32 #include "tcuCommandLine.hpp"
33 #include "tcuWaiverUtil.hpp"
34
35 #include "vkPlatform.hpp"
36 #include "vkPrograms.hpp"
37 #include "vkBinaryRegistry.hpp"
38 #include "vkShaderToSpirV.hpp"
39 #include "vkDebugReportUtil.hpp"
40 #include "vkQueryUtil.hpp"
41 #include "vkApiVersion.hpp"
42 #include "vkRenderDocUtil.hpp"
43 #include "vkResourceInterface.hpp"
44
45 #include "deUniquePtr.hpp"
46 #include "deSharedPtr.hpp"
47 #ifdef CTS_USES_VULKANSC
48         #include "deProcess.h"
49         #include "vksClient.hpp"
50         #include "vksIPC.hpp"
51 #endif // CTS_USES_VULKANSC
52
53 #include "vktTestGroupUtil.hpp"
54 #include "vktApiTests.hpp"
55 #include "vktPipelineTests.hpp"
56 #include "vktBindingModelTests.hpp"
57 #include "vktSpvAsmTests.hpp"
58 #include "vktShaderLibrary.hpp"
59 #include "vktRenderPassTests.hpp"
60 #include "vktMemoryTests.hpp"
61 #include "vktShaderRenderBuiltinVarTests.hpp"
62 #include "vktShaderRenderDerivateTests.hpp"
63 #include "vktShaderRenderDiscardTests.hpp"
64 #include "vktShaderRenderIndexingTests.hpp"
65 #include "vktShaderRenderInvarianceTests.hpp"
66 #include "vktShaderRenderLimitTests.hpp"
67 #include "vktShaderRenderLoopTests.hpp"
68 #include "vktShaderRenderMatrixTests.hpp"
69 #include "vktShaderRenderOperatorTests.hpp"
70 #include "vktShaderRenderReturnTests.hpp"
71 #include "vktShaderRenderStructTests.hpp"
72 #include "vktShaderRenderSwitchTests.hpp"
73 #include "vktShaderRenderTextureFunctionTests.hpp"
74 #include "vktShaderRenderTextureGatherTests.hpp"
75 #include "vktShaderBuiltinTests.hpp"
76 #include "vktOpaqueTypeIndexingTests.hpp"
77 #include "vktAtomicOperationTests.hpp"
78 #include "vktUniformBlockTests.hpp"
79 #include "vktDynamicStateTests.hpp"
80 #include "vktSSBOLayoutTests.hpp"
81 #include "vktQueryPoolTests.hpp"
82 #include "vktDrawTests.hpp"
83 #include "vktComputeTests.hpp"
84 #include "vktConditionalTests.hpp"
85 #include "vktImageTests.hpp"
86 #include "vktInfoTests.hpp"
87 #include "vktWsiTests.hpp"
88 #include "vktSynchronizationTests.hpp"
89 #include "vktSparseResourcesTests.hpp"
90 #include "vktTessellationTests.hpp"
91 #include "vktRasterizationTests.hpp"
92 #include "vktClippingTests.hpp"
93 #include "vktFragmentOperationsTests.hpp"
94 #include "vktTextureTests.hpp"
95 #include "vktGeometryTests.hpp"
96 #include "vktRobustnessTests.hpp"
97 #include "vktMultiViewTests.hpp"
98 #include "vktSubgroupsTests.hpp"
99 #include "vktYCbCrTests.hpp"
100 #include "vktProtectedMemTests.hpp"
101 #include "vktDeviceGroupTests.hpp"
102 #include "vktMemoryModelTests.hpp"
103 #include "vktAmberGraphicsFuzzTests.hpp"
104 #include "vktAmberGlslTests.hpp"
105 #include "vktImagelessFramebufferTests.hpp"
106 #include "vktTransformFeedbackTests.hpp"
107 #include "vktDescriptorIndexingTests.hpp"
108 #include "vktImagelessFramebufferTests.hpp"
109 #include "vktFragmentShaderInterlockTests.hpp"
110 #include "vktShaderClockTests.hpp"
111 #include "vktModifiersTests.hpp"
112 #include "vktRayTracingTests.hpp"
113 #include "vktRayQueryTests.hpp"
114 #include "vktPostmortemTests.hpp"
115 #include "vktFragmentShadingRateTests.hpp"
116 #include "vktReconvergenceTests.hpp"
117 #include "vktMeshShaderTests.hpp"
118 #include "vktFragmentShadingBarycentricTests.hpp"
119 #ifdef CTS_USES_VULKANSC
120 #include "vktSafetyCriticalTests.hpp"
121 #endif // CTS_USES_VULKANSC
122
123 #include <vector>
124 #include <sstream>
125 #include <fstream>
126 #include <thread>
127
128 namespace vkt
129 {
130
131 using std::vector;
132 using de::UniquePtr;
133 using de::SharedPtr;
134 using de::MovePtr;
135 using tcu::TestLog;
136
137 // TestCaseExecutor
138
139 #ifdef CTS_USES_VULKANSC
140 struct DetailedSubprocessTestCount
141 {
142         std::string                                                                     testPattern;
143         int                                                                                     testCount;
144 };
145 #endif // CTS_USES_VULKANSC
146
147 class TestCaseExecutor : public tcu::TestCaseExecutor
148 {
149 public:
150                                                                                                 TestCaseExecutor                        (tcu::TestContext& testCtx);
151                                                                                                 ~TestCaseExecutor                       (void);
152
153         void                                                                            init                                            (tcu::TestCase* testCase, const std::string& path) override;
154         void                                                                            deinit                                          (tcu::TestCase* testCase) override;
155
156         tcu::TestNode::IterateResult                            iterate                                         (tcu::TestCase* testCase) override;
157
158         void                                                                            deinitTestPackage                       (tcu::TestContext& testCtx) override;
159         bool                                                                            usesLocalStatus                         () override;
160         void                                                                            updateGlobalStatus                      (tcu::TestRunStatus& status) override;
161         void                                                                            reportDurations                         (tcu::TestContext& testCtx, const std::string& packageName, const deInt64& duration, const std::map<std::string, deUint64>& groupsDurationTime) override;
162         int                                                                                     getCurrentSubprocessCount       (const std::string& casePath, int defaultSubprocessCount);
163
164 private:
165         void                                                                            logUnusedShaders                (tcu::TestCase* testCase);
166
167         void                                                                            runTestsInSubprocess    (tcu::TestContext& testCtx);
168
169         bool                                                                            spirvVersionSupported   (vk::SpirvVersion);
170
171         vk::BinaryCollection                                            m_progCollection;
172         vk::BinaryRegistryReader                                        m_prebuiltBinRegistry;
173
174         const UniquePtr<vk::Library>                            m_library;
175         MovePtr<Context>                                                        m_context;
176
177         const UniquePtr<vk::RenderDocUtil>                      m_renderDoc;
178         SharedPtr<vk::ResourceInterface>                        m_resourceInterface;
179         vk::VkPhysicalDeviceProperties                          m_deviceProperties;
180         tcu::WaiverUtil                                                         m_waiverMechanism;
181
182         TestInstance*                                                           m_instance;                     //!< Current test case instance
183         std::vector<std::string>                                        m_testsForSubprocess;
184         tcu::TestRunStatus                                                      m_status;
185
186 #ifdef CTS_USES_VULKANSC
187         int                                                                                     m_subprocessCount;
188
189         std::unique_ptr<vksc_server::ipc::Parent>       m_parentIPC;
190         std::vector<DetailedSubprocessTestCount>        m_detailedSubprocessTestCount;
191 #endif // CTS_USES_VULKANSC
192 };
193
194 #ifdef CTS_USES_VULKANSC
195 static deBool   supressedWrite                  (int, const char*)                                                              { return false; }
196 static deBool   supressedWriteFtm               (int, const char*, va_list)                                             { return false; }
197 static deBool   openWrite                               (int type, const char* message)                                 { DE_UNREF(type); DE_UNREF(message); return true; }
198 static deBool   openWriteFtm                    (int type, const char* format, va_list args)    { DE_UNREF(type); DE_UNREF(format); DE_UNREF(args); return true; }
199 static void             suppressStandardOutput  ()                                                                                              { qpRedirectOut(supressedWrite, supressedWriteFtm); }
200 static void             restoreStandardOutput   ()                                                                                              { qpRedirectOut(openWrite, openWriteFtm); }
201 #endif // CTS_USES_VULKANSC
202
203 static MovePtr<vk::Library> createLibrary (tcu::TestContext& testCtx)
204 {
205         return MovePtr<vk::Library>(testCtx.getPlatform().getVulkanPlatform().createLibrary(testCtx.getCommandLine().getVkLibraryPath()));
206 }
207
208 static vk::VkPhysicalDeviceProperties getPhysicalDeviceProperties(vkt::Context& context)
209 {
210         const vk::InstanceInterface&    vki                             = context.getInstanceInterface();
211         const vk::VkPhysicalDevice              physicalDevice  = context.getPhysicalDevice();
212
213         vk::VkPhysicalDeviceProperties  properties;
214         vki.getPhysicalDeviceProperties(physicalDevice, &properties);
215         return properties;
216 }
217
218 std::string trim (const std::string& original)
219 {
220         static const std::string whiteSigns = " \t";
221         const auto beg = original.find_first_not_of(whiteSigns);
222         if (beg == std::string::npos)
223                 return std::string();
224         const auto end = original.find_last_not_of(whiteSigns);
225         return original.substr(beg, end - beg + 1);
226 }
227
228 TestCaseExecutor::TestCaseExecutor (tcu::TestContext& testCtx)
229         : m_prebuiltBinRegistry (testCtx.getArchive(), "vulkan/prebuilt")
230         , m_library                             (createLibrary(testCtx))
231         , m_renderDoc                   (testCtx.getCommandLine().isRenderDocEnabled()
232                                                          ? MovePtr<vk::RenderDocUtil>(new vk::RenderDocUtil())
233                                                          : MovePtr<vk::RenderDocUtil>(DE_NULL))
234 #if defined CTS_USES_VULKANSC
235         , m_resourceInterface   (new vk::ResourceInterfaceVKSC(testCtx))
236 #else
237         , m_resourceInterface   (new vk::ResourceInterfaceStandard(testCtx))
238 #endif // CTS_USES_VULKANSC
239         , m_instance                    (DE_NULL)
240 #if defined CTS_USES_VULKANSC
241         , m_subprocessCount             (0)
242 #endif // CTS_USES_VULKANSC
243 {
244 #ifdef CTS_USES_VULKANSC
245         std::vector<int> caseFraction = testCtx.getCommandLine().getCaseFraction();
246         std::string jsonFileName;
247         int portOffset;
248         if (caseFraction.empty())
249         {
250                 jsonFileName    = "pipeline_data.txt";
251                 portOffset              = 0;
252         }
253         else
254         {
255                 jsonFileName    = "pipeline_data_" + std::to_string(caseFraction[0]) + ".txt";
256                 portOffset              = caseFraction[0];
257         }
258
259         if (testCtx.getCommandLine().isSubProcess())
260         {
261                 std::vector<deUint8> input = vksc_server::ipc::Child{portOffset}.GetFile(jsonFileName);
262                 m_resourceInterface->importData(input);
263         }
264         else
265         {
266                 m_parentIPC.reset( new vksc_server::ipc::Parent{portOffset} );
267         }
268
269         // Load information about test tree branches that use subprocess test count other than default
270         // Expected file format:
271         if (!testCtx.getCommandLine().isSubProcess() && !std::string(testCtx.getCommandLine().getSubprocessConfigFile()).empty())
272         {
273                 std::ifstream                   iFile(testCtx.getCommandLine().getSubprocessConfigFile(), std::ios::in);
274                 if (!iFile)
275                         TCU_THROW(InternalError, (std::string("Missing config file defining number of tests: ") + testCtx.getCommandLine().getSubprocessConfigFile()).c_str());
276                 std::string line;
277                 while (std::getline(iFile, line))
278                 {
279                         if (line.empty())
280                                 continue;
281                         std::size_t pos = line.find_first_of(',');
282                         if (pos == std::string::npos)
283                                 continue;
284                         std::string testPattern, testNumber;
285                         std::copy(line.begin(), line.begin() + pos, std::back_inserter(testPattern));
286                         testPattern = trim(testPattern);
287                         std::copy(line.begin() + pos + 1, line.end(), std::back_inserter(testNumber));
288                         testNumber = trim(testNumber);
289                         if (testPattern.empty() || testNumber.empty())
290                                 continue;
291                         std::istringstream is(testNumber);
292                         int testCount;
293                         if ((is >> testCount).fail())
294                                 continue;
295                         m_detailedSubprocessTestCount.push_back(DetailedSubprocessTestCount{ testPattern, testCount });
296                 }
297                 // sort test patterns
298                 std::sort(m_detailedSubprocessTestCount.begin(), m_detailedSubprocessTestCount.end(), [](const DetailedSubprocessTestCount& lhs, const DetailedSubprocessTestCount& rhs)
299                         {
300                                 return lhs.testCount < rhs.testCount;
301                         } );
302         }
303
304         // If we are provided with remote location
305         if (!std::string(testCtx.getCommandLine().getServerAddress()).empty())
306         {
307                 // Open connection with the server dedicated for standard output
308                 vksc_server::OpenRemoteStandardOutput(testCtx.getCommandLine().getServerAddress());
309                 restoreStandardOutput();
310         }
311 #endif // CTS_USES_VULKANSC
312
313         m_context                       = MovePtr<Context>(new Context(testCtx, m_library->getPlatformInterface(), m_progCollection, m_resourceInterface));
314         m_deviceProperties      = getPhysicalDeviceProperties(*m_context);
315
316         tcu::SessionInfo sessionInfo(m_deviceProperties.vendorID,
317                                                                  m_deviceProperties.deviceID,
318                                                                  testCtx.getCommandLine().getInitialCmdLine());
319         m_waiverMechanism.setup(testCtx.getCommandLine().getWaiverFileName(),
320                                                         "dEQP-VK",
321                                                         m_deviceProperties.vendorID,
322                                                         m_deviceProperties.deviceID,
323                                                         sessionInfo);
324
325 #ifdef CTS_USES_VULKANSC
326         if (!std::string(testCtx.getCommandLine().getServerAddress()).empty())
327         {
328                 vksc_server::AppendRequest request;
329                 request.fileName = testCtx.getCommandLine().getLogFileName();
330
331                 std::ostringstream str;
332                 str << "#sessionInfo releaseName " << qpGetReleaseName() << std::endl;
333                 str << "#sessionInfo releaseId 0x" << std::hex << std::setw(8) << std::setfill('0') << qpGetReleaseId() << std::endl;
334                 str << "#sessionInfo targetName \"" << qpGetTargetName() << "\"" << std::endl;
335                 str << sessionInfo.get() << std::endl;
336                 str << "#beginSession" << std::endl;
337
338                 std::string output = str.str();
339                 request.data.assign(output.begin(), output.end());
340                 request.clear = true;
341                 vksc_server::StandardOutputServerSingleton()->SendRequest(request);
342         }
343         else
344 #endif // CTS_USES_VULKANSC
345         {
346                 testCtx.getLog().writeSessionInfo(sessionInfo.get());
347         }
348
349 #ifdef CTS_USES_VULKANSC
350         m_resourceInterface->initApiVersion(m_context->getUsedApiVersion());
351
352         // Real Vulkan SC tests are performed in subprocess.
353         // Tests run in main process are only used to collect data required by Vulkan SC.
354         // That's why we turn off any output in main process and copy output from subprocess when subprocess tests are performed
355         if (!testCtx.getCommandLine().isSubProcess())
356         {
357                 suppressStandardOutput();
358                 m_context->getTestContext().getLog().supressLogging(true);
359         }
360 #endif // CTS_USES_VULKANSC
361 }
362
363 TestCaseExecutor::~TestCaseExecutor (void)
364 {
365         delete m_instance;
366 }
367
368 void TestCaseExecutor::init (tcu::TestCase* testCase, const std::string& casePath)
369 {
370         if (m_waiverMechanism.isOnWaiverList(casePath))
371                 throw tcu::TestException("Waived test", QP_TEST_RESULT_WAIVER);
372
373         TestCase*                                       vktCase                                         = dynamic_cast<TestCase*>(testCase);
374         tcu::TestLog&                           log                                                     = m_context->getTestContext().getLog();
375         const deUint32                          usedVulkanVersion                       = m_context->getUsedApiVersion();
376         const vk::SpirvVersion          baselineSpirvVersion            = vk::getBaselineSpirvVersion(usedVulkanVersion);
377         vk::ShaderBuildOptions          defaultGlslBuildOptions         (usedVulkanVersion, baselineSpirvVersion, 0u);
378         vk::ShaderBuildOptions          defaultHlslBuildOptions         (usedVulkanVersion, baselineSpirvVersion, 0u);
379         vk::SpirVAsmBuildOptions        defaultSpirvAsmBuildOptions     (usedVulkanVersion, baselineSpirvVersion);
380         vk::SourceCollections           sourceProgs                                     (usedVulkanVersion, defaultGlslBuildOptions, defaultHlslBuildOptions, defaultSpirvAsmBuildOptions);
381         const tcu::CommandLine&         commandLine                                     = m_context->getTestContext().getCommandLine();
382         const bool                                      doShaderLog                                     = commandLine.isLogDecompiledSpirvEnabled() && log.isShaderLoggingEnabled();
383
384         if (!vktCase)
385                 TCU_THROW(InternalError, "Test node not an instance of vkt::TestCase");
386
387         {
388 #ifdef CTS_USES_VULKANSC
389                 int currentSubprocessCount = getCurrentSubprocessCount(casePath, m_context->getTestContext().getCommandLine().getSubprocessTestCount());
390                 if (m_subprocessCount && currentSubprocessCount != m_subprocessCount)
391                 {
392                         runTestsInSubprocess(m_context->getTestContext());
393
394                         // Clean up data after performing tests in subprocess and prepare system for another batch of tests
395                         m_testsForSubprocess.clear();
396                         const vk::DeviceInterface&                              vkd = m_context->getDeviceInterface();
397                         const vk::DeviceDriverSC*                               dds = dynamic_cast<const vk::DeviceDriverSC*>(&vkd);
398                         if (dds == DE_NULL)
399                                 TCU_THROW(InternalError, "Undefined device driver for Vulkan SC");
400                         dds->reset();
401                         m_resourceInterface->resetObjects();
402
403                         suppressStandardOutput();
404                         m_context->getTestContext().getLog().supressLogging(true);
405                 }
406                 m_subprocessCount = currentSubprocessCount;
407 #endif // CTS_USES_VULKANSC
408                 m_testsForSubprocess.push_back(casePath);
409         }
410
411         m_resourceInterface->initTestCase(casePath);
412
413         if (m_waiverMechanism.isOnWaiverList(casePath))
414                 throw tcu::TestException("Waived test", QP_TEST_RESULT_WAIVER);
415
416         vktCase->checkSupport(*m_context);
417
418         vktCase->delayedInit();
419
420         m_progCollection.clear();
421         vktCase->initPrograms(sourceProgs);
422
423         for (vk::GlslSourceCollection::Iterator progIter = sourceProgs.glslSources.begin(); progIter != sourceProgs.glslSources.end(); ++progIter)
424         {
425                 if (!spirvVersionSupported(progIter.getProgram().buildOptions.targetVersion))
426                         TCU_THROW(NotSupportedError, "Shader requires SPIR-V higher than available");
427
428                 const vk::ProgramBinary* const binProg = m_resourceInterface->buildProgram<glu::ShaderProgramInfo, vk::GlslSourceCollection::Iterator>(casePath, progIter, m_prebuiltBinRegistry, &m_progCollection);
429
430                 if (doShaderLog)
431                 {
432                         try
433                         {
434                                 std::ostringstream disasm;
435
436                                 vk::disassembleProgram(*binProg, &disasm);
437
438                                 log << vk::SpirVAsmSource(disasm.str());
439                         }
440                         catch (const tcu::NotSupportedError& err)
441                         {
442                                 log << err;
443                         }
444                 }
445         }
446
447         for (vk::HlslSourceCollection::Iterator progIter = sourceProgs.hlslSources.begin(); progIter != sourceProgs.hlslSources.end(); ++progIter)
448         {
449                 if (!spirvVersionSupported(progIter.getProgram().buildOptions.targetVersion))
450                         TCU_THROW(NotSupportedError, "Shader requires SPIR-V higher than available");
451
452                 const vk::ProgramBinary* const binProg = m_resourceInterface->buildProgram<glu::ShaderProgramInfo, vk::HlslSourceCollection::Iterator>(casePath, progIter, m_prebuiltBinRegistry, &m_progCollection);
453
454                 if (doShaderLog)
455                 {
456                         try
457                         {
458                                 std::ostringstream disasm;
459
460                                 vk::disassembleProgram(*binProg, &disasm);
461
462                                 log << vk::SpirVAsmSource(disasm.str());
463                         }
464                         catch (const tcu::NotSupportedError& err)
465                         {
466                                 log << err;
467                         }
468                 }
469         }
470
471         for (vk::SpirVAsmCollection::Iterator asmIterator = sourceProgs.spirvAsmSources.begin(); asmIterator != sourceProgs.spirvAsmSources.end(); ++asmIterator)
472         {
473                 if (!spirvVersionSupported(asmIterator.getProgram().buildOptions.targetVersion))
474                         TCU_THROW(NotSupportedError, "Shader requires SPIR-V higher than available");
475
476                 m_resourceInterface->buildProgram<vk::SpirVProgramInfo, vk::SpirVAsmCollection::Iterator>(casePath, asmIterator, m_prebuiltBinRegistry, &m_progCollection);
477         }
478
479         if (m_renderDoc) m_renderDoc->startFrame(m_context->getInstance());
480
481         DE_ASSERT(!m_instance);
482         m_instance = vktCase->createInstance(*m_context);
483         m_context->resultSetOnValidation(false);
484 }
485
486 void TestCaseExecutor::deinit (tcu::TestCase* testCase)
487 {
488         delete m_instance;
489         m_instance = DE_NULL;
490
491         if (m_renderDoc) m_renderDoc->endFrame(m_context->getInstance());
492
493         // Collect and report any debug messages
494 #ifndef CTS_USES_VULKANSC
495         if (m_context->hasDebugReportRecorder())
496                 collectAndReportDebugMessages(m_context->getDebugReportRecorder(), *m_context);
497 #endif // CTS_USES_VULKANSC
498
499         if (testCase != DE_NULL)
500                 logUnusedShaders(testCase);
501
502 #ifdef CTS_USES_VULKANSC
503         if (!m_context->getTestContext().getCommandLine().isSubProcess())
504         {
505                 int currentSubprocessCount = getCurrentSubprocessCount(m_context->getResourceInterface()->getCasePath(), m_context->getTestContext().getCommandLine().getSubprocessTestCount());
506                 if (m_testsForSubprocess.size() >= std::size_t(currentSubprocessCount))
507                 {
508                         runTestsInSubprocess(m_context->getTestContext());
509
510                         // Clean up data after performing tests in subprocess and prepare system for another batch of tests
511                         m_testsForSubprocess.clear();
512                         const vk::DeviceInterface&                              vkd                                             = m_context->getDeviceInterface();
513                         const vk::DeviceDriverSC*                               dds                                             = dynamic_cast<const vk::DeviceDriverSC*>(&vkd);
514                         if (dds == DE_NULL)
515                                 TCU_THROW(InternalError, "Undefined device driver for Vulkan SC");
516                         dds->reset();
517                         m_resourceInterface->resetObjects();
518
519                         suppressStandardOutput();
520                         m_context->getTestContext().getLog().supressLogging(true);
521                 }
522         }
523 #endif // CTS_USES_VULKANSC
524 }
525
526 void TestCaseExecutor::logUnusedShaders (tcu::TestCase* testCase)
527 {
528         const qpTestResult      testResult      = testCase->getTestContext().getTestResult();
529
530         if (testResult == QP_TEST_RESULT_PASS || testResult == QP_TEST_RESULT_QUALITY_WARNING || testResult == QP_TEST_RESULT_COMPATIBILITY_WARNING)
531         {
532                 bool    unusedShaders   = false;
533
534                 for (vk::BinaryCollection::Iterator it = m_progCollection.begin(); it != m_progCollection.end(); ++it)
535                 {
536                         if (!it.getProgram().getUsed())
537                         {
538                                 unusedShaders = true;
539
540                                 break;
541                         }
542                 }
543
544                 if (unusedShaders)
545                 {
546                         std::string message;
547
548                         for (vk::BinaryCollection::Iterator it = m_progCollection.begin(); it != m_progCollection.end(); ++it)
549                         {
550                                 if (!it.getProgram().getUsed())
551                                         message += it.getName() + ",";
552                         }
553
554                         message.resize(message.size() - 1);
555
556                         message = std::string("Unused shaders: ") + message;
557
558                         m_context->getTestContext().getLog() << TestLog::Message << message << TestLog::EndMessage;
559                 }
560         }
561 }
562
563 tcu::TestNode::IterateResult TestCaseExecutor::iterate (tcu::TestCase*)
564 {
565         DE_ASSERT(m_instance);
566
567         const tcu::TestStatus   result  = m_instance->iterate();
568
569         if (result.isComplete())
570         {
571                 // Vulkan tests shouldn't set result directly except when using a debug report messenger to catch validation errors.
572                 DE_ASSERT(m_context->getTestContext().getTestResult() == QP_TEST_RESULT_LAST || m_context->resultSetOnValidation());
573
574                 // Override result if not set previously by a debug report messenger.
575                 if (!m_context->resultSetOnValidation())
576                         m_context->getTestContext().setTestResult(result.getCode(), result.getDescription().c_str());
577                 return tcu::TestNode::STOP;
578         }
579         else
580                 return tcu::TestNode::CONTINUE;
581 }
582
583 void TestCaseExecutor::deinitTestPackage (tcu::TestContext& testCtx)
584 {
585 #ifdef CTS_USES_VULKANSC
586         if (!testCtx.getCommandLine().isSubProcess())
587         {
588                 if (!m_testsForSubprocess.empty())
589                 {
590                         runTestsInSubprocess(testCtx);
591
592                         // Clean up data after performing tests in subprocess and prepare system for another batch of tests
593                         m_testsForSubprocess.clear();
594                         const vk::DeviceInterface&                              vkd                                             = m_context->getDeviceInterface();
595                         const vk::DeviceDriverSC*                               dds                                             = dynamic_cast<const vk::DeviceDriverSC*>(&vkd);
596                         if (dds == DE_NULL)
597                                 TCU_THROW(InternalError, "Undefined device driver for Vulkan SC");
598                         dds->reset();
599                         m_resourceInterface->resetObjects();
600                 }
601
602                 // Tests are finished. Next tests ( if any ) will come from other test package and test executor
603                 restoreStandardOutput();
604                 m_context->getTestContext().getLog().supressLogging(false);
605         }
606         m_resourceInterface->resetPipelineCaches();
607 #else
608         DE_UNREF(testCtx);
609 #endif // CTS_USES_VULKANSC
610 }
611
612 bool TestCaseExecutor::usesLocalStatus ()
613 {
614 #ifdef CTS_USES_VULKANSC
615         return !m_context->getTestContext().getCommandLine().isSubProcess();
616 #else
617         return false;
618 #endif
619 }
620
621 void TestCaseExecutor::updateGlobalStatus (tcu::TestRunStatus& status)
622 {
623         status.numExecuted                                      += m_status.numExecuted;
624         status.numPassed                                        += m_status.numPassed;
625         status.numNotSupported                          += m_status.numNotSupported;
626         status.numWarnings                                      += m_status.numWarnings;
627         status.numWaived                                        += m_status.numWaived;
628         status.numFailed                                        += m_status.numFailed;
629         m_status.clear();
630 }
631
632 void TestCaseExecutor::reportDurations(tcu::TestContext& testCtx, const std::string& packageName, const deInt64& duration, const std::map<std::string, deUint64>& groupsDurationTime)
633 {
634 #ifdef CTS_USES_VULKANSC
635         // Send it to server to append to its log
636         vksc_server::AppendRequest request;
637         request.fileName = testCtx.getCommandLine().getLogFileName();
638
639         std::ostringstream str;
640
641         str << std::endl;
642         str << "#beginTestsCasesTime" << std::endl;
643
644         str << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl;
645         str << "<TestsCasesTime>" << std::endl;
646
647         str << " <Number Name=\"" << packageName << "\" Description=\"Total tests case duration in microseconds\" Tag=\"Time\" Unit=\"us\">" << duration << "</Number>" << std::endl;
648         for (std::map<std::string, deUint64>::const_iterator it = groupsDurationTime.begin(); it != groupsDurationTime.end(); ++it)
649                 str << " <Number Name=\"" << it->first << "\" Description=\"The test group case duration in microseconds\" Tag=\"Time\" Unit=\"us\">" << it->second << "</Number>" << std::endl;
650         str << "</TestsCasesTime>" << std::endl;
651         str << std::endl;
652         str << "#endTestsCasesTime" << std::endl;
653         str << std::endl;
654         str << "#endSession" << std::endl;
655
656         std::string output = str.str();
657         request.data.assign(output.begin(), output.end());
658         vksc_server::StandardOutputServerSingleton()->SendRequest(request);
659 #else
660         DE_UNREF(testCtx);
661         DE_UNREF(packageName);
662         DE_UNREF(duration);
663         DE_UNREF(groupsDurationTime);
664 #endif // CTS_USES_VULKANSC
665
666 }
667
668 int TestCaseExecutor::getCurrentSubprocessCount(const std::string& casePath, int defaultSubprocessCount)
669 {
670 #ifdef CTS_USES_VULKANSC
671         for (const auto& detailed : m_detailedSubprocessTestCount)
672                 if (tcu::matchWildcards(detailed.testPattern.begin(), detailed.testPattern.end(), casePath.begin(), casePath.end(), false))
673                         return detailed.testCount;
674 #else
675         DE_UNREF(casePath);
676 #endif // CTS_USES_VULKANSC
677         return defaultSubprocessCount;
678 }
679
680 void TestCaseExecutor::runTestsInSubprocess (tcu::TestContext& testCtx)
681 {
682 #ifdef CTS_USES_VULKANSC
683         if (testCtx.getCommandLine().isSubProcess())
684                 TCU_THROW(InternalError, "Cannot run subprocess inside subprocess : ");
685
686         if (m_testsForSubprocess.empty())
687                 return;
688
689         std::vector<int>        caseFraction    = testCtx.getCommandLine().getCaseFraction();
690         std::ostringstream      jsonFileName, qpaFileName, pipelineCompilerOutFileName, pipelineCompilerLogFileName, pipelineCompilerPrefix;
691         if (caseFraction.empty())
692         {
693                 jsonFileName                            << "pipeline_data.txt";
694                 qpaFileName                                     << "sub.qpa";
695                 if (!std::string(testCtx.getCommandLine().getPipelineCompilerPath()).empty())
696                 {
697                         pipelineCompilerOutFileName << "pipeline_cache.bin";
698                         pipelineCompilerLogFileName << "compiler.log";
699                         pipelineCompilerPrefix << "";
700                 }
701         }
702         else
703         {
704                 jsonFileName    << "pipeline_data_" << caseFraction[0] << ".txt";
705                 qpaFileName             << "sub_" << caseFraction[0] << ".qpa";
706                 if (!std::string(testCtx.getCommandLine().getPipelineCompilerPath()).empty())
707                 {
708                         pipelineCompilerOutFileName << "pipeline_cache_" << caseFraction[0] <<".bin";
709                         pipelineCompilerLogFileName << "compiler_" << caseFraction[0] << ".log";
710                         pipelineCompilerPrefix << "sub_" << caseFraction[0] << "_";
711                 }
712         }
713
714         // export data collected during statistics gathering to JSON file ( VkDeviceObjectReservationCreateInfo, SPIR-V shaders, pipelines )
715         {
716                 m_resourceInterface->removeRedundantObjects();
717                 m_resourceInterface->finalizeCommandBuffers();
718                 std::vector<deUint8>                                    data                                    = m_resourceInterface->exportData();
719                 m_parentIPC->SetFile(jsonFileName.str(), data);
720         }
721
722         // collect current application name, add it to new commandline with subprocess parameters
723         std::string                                                             newCmdLine;
724         {
725                 std::string appName = testCtx.getCommandLine().getApplicationName();
726                 if (appName.empty())
727                         TCU_THROW(InternalError, "Application name is not defined");
728                 // add --deqp-subprocess option to inform deqp-vksc process that it works as slave process
729                 newCmdLine = appName + " --deqp-subprocess=enable --deqp-log-filename=" + qpaFileName.str();
730
731                 // add offline pipeline compiler parameters if present
732                 if (!std::string(testCtx.getCommandLine().getPipelineCompilerPath()).empty())
733                 {
734                         newCmdLine += " --deqp-pipeline-compiler="              + std::string(testCtx.getCommandLine().getPipelineCompilerPath());
735                         newCmdLine += " --deqp-pipeline-file="                  + pipelineCompilerOutFileName.str();
736                         if (!std::string(testCtx.getCommandLine().getPipelineCompilerDataDir()).empty())
737                                 newCmdLine += " --deqp-pipeline-dir="                   + std::string(testCtx.getCommandLine().getPipelineCompilerDataDir());
738                         newCmdLine += " --deqp-pipeline-logfile="               + pipelineCompilerLogFileName.str();
739                         if(!pipelineCompilerPrefix.str().empty())
740                                 newCmdLine += " --deqp-pipeline-prefix="        + pipelineCompilerPrefix.str();
741                         if (!std::string(testCtx.getCommandLine().getPipelineCompilerArgs()).empty())
742                                 newCmdLine += " --deqp-pipeline-args=\""        + std::string( testCtx.getCommandLine().getPipelineCompilerArgs() ) + "\"";
743                 }
744         }
745
746         // collect parameters, remove parameters associated with case filter and case fraction. We will provide our own case list
747         {
748                 std::string                                                     originalCmdLine         = testCtx.getCommandLine().getInitialCmdLine();
749
750                 // brave ( but working ) assumption that each CTS parameter starts with "--deqp"
751
752                 std::string                                                     paramStr                        ("--deqp");
753                 std::vector<std::string>                        skipElements            =
754                 {
755                         "--deqp-case",
756                         "--deqp-stdin-caselist",
757                         "--deqp-log-filename",
758                         "--deqp-pipeline-compiler",
759                         "--deqp-pipeline-dir",
760                         "--deqp-pipeline-args",
761                         "--deqp-pipeline-file",
762                         "--deqp-pipeline-logfile",
763                         "--deqp-pipeline-prefix"
764                 };
765
766                 std::size_t                                                     pos = 0;
767                 std::vector<std::size_t>                        argPos;
768                 while ((pos = originalCmdLine.find(paramStr, pos)) != std::string::npos)
769                         argPos.push_back(pos++);
770                 if (!argPos.empty())
771                         argPos.push_back(originalCmdLine.size());
772
773                 std::vector<std::string> args;
774                 for (std::size_t i = 0; i < argPos.size()-1; ++i)
775                 {
776                         std::string s = originalCmdLine.substr(argPos[i], argPos[i + 1] - argPos[i]);
777                         std::size_t found = s.find_last_not_of(' ');
778                         if (found != std::string::npos)
779                         {
780                                 s.erase(found + 1);
781                                 args.push_back(s);
782                         }
783                 }
784                 for (std::size_t i = 0; i < args.size(); ++i)
785                 {
786                         bool skipElement = false;
787                         for (const auto& elem : skipElements)
788                                 if (args[i].find(elem) == 0)
789                                 {
790                                         skipElement = true;
791                                         break;
792                                 }
793                         if (skipElement)
794                                 continue;
795                         newCmdLine = newCmdLine + " " + args[i];
796                 }
797         }
798
799         // create --deqp-case list from tests collected in m_testsForSubprocess
800         std::string subprocessTestList;
801         for (auto it = begin(m_testsForSubprocess); it != end(m_testsForSubprocess); ++it)
802         {
803                 auto nit = it; ++nit;
804
805                 subprocessTestList += *it;
806                 if (nit != end(m_testsForSubprocess))
807                         subprocessTestList += "\n";
808         }
809
810         std::string caseListName        = "subcaselist" + (caseFraction.empty() ? std::string("") : de::toString(caseFraction[0])) + ".txt";
811
812         deFile*         exportFile              = deFile_create(caseListName.c_str(), DE_FILEMODE_CREATE | DE_FILEMODE_OPEN | DE_FILEMODE_WRITE | DE_FILEMODE_TRUNCATE);
813         deInt64         numWritten              = 0;
814         deFile_write(exportFile, subprocessTestList.c_str(), subprocessTestList.size(), &numWritten);
815         deFile_destroy(exportFile);
816         newCmdLine = newCmdLine + " --deqp-caselist-file=" + caseListName;
817
818         // restore cout and cerr
819         restoreStandardOutput();
820
821         // create subprocess which will perform real tests
822         std::string subProcessExitCodeInfo;
823         {
824                 deProcess*      process                 = deProcess_create();
825                 if (deProcess_start(process, newCmdLine.c_str(), ".") != DE_TRUE)
826                 {
827                         std::string err = deProcess_getLastError(process);
828                         deProcess_destroy(process);
829                         process = DE_NULL;
830                         TCU_THROW(InternalError, "Error while running subprocess : " + err);
831                 }
832                 std::string whole;
833                 whole.reserve(1024 * 4);
834
835                 // create a separate thread that captures std::err output
836                 de::MovePtr<std::thread> errThread(new std::thread([&process]
837                 {
838                         deFile*         subErr = deProcess_getStdErr(process);
839                         char            errBuffer[128]  = { 0 };
840                         deInt64         errNumRead              = 0;
841                         while (deFile_read(subErr, errBuffer, sizeof(errBuffer) - 1, &errNumRead) == DE_FILERESULT_SUCCESS)
842                         {
843                                 errBuffer[errNumRead] = 0;
844                         }
845                 }));
846
847                 deFile*         subOutput               = deProcess_getStdOut(process);
848                 char            outBuffer[128]  = { 0 };
849                 deInt64         numRead                 = 0;
850                 while (deFile_read(subOutput, outBuffer, sizeof(outBuffer) - 1, &numRead) == DE_FILERESULT_SUCCESS)
851                 {
852                         outBuffer[numRead] = 0;
853                         qpPrint(outBuffer);
854                         whole += outBuffer;
855                 }
856                 errThread->join();
857                 if (deProcess_waitForFinish(process))
858                 {
859                         const int                       exitCode = deProcess_getExitCode(process);
860                         std::stringstream       s;
861
862                         s << " Subprocess failed with exit code " << exitCode << "(" << std::hex << exitCode << ")";
863
864                         subProcessExitCodeInfo = s.str();
865                 }
866                 deProcess_destroy(process);
867
868                 vksc_server::RemoteWrite(0, whole.c_str());
869         }
870
871         // copy test information from sub.qpa to main log
872         {
873                 std::ifstream   subQpa(qpaFileName.str(), std::ios::binary);
874                 std::string             subQpaText{std::istreambuf_iterator<char>(subQpa),
875                                                                    std::istreambuf_iterator<char>()};
876                 {
877                         std::string                     beginText               ("#beginTestCaseResult");
878                         std::string                     endText                 ("#endTestCaseResult");
879                         std::size_t                     beginPos                = subQpaText.find(beginText);
880                         std::size_t                     endPos                  = subQpaText.rfind(endText);
881                         if (beginPos == std::string::npos || endPos == std::string::npos)
882                                 TCU_THROW(InternalError, "Couldn't match tags from " + qpaFileName.str() + subProcessExitCodeInfo);
883
884                         std::string             subQpaCopy = "\n" + std::string(subQpaText.begin() + beginPos, subQpaText.begin() + endPos + endText.size()) + "\n";
885
886                         if (!std::string(testCtx.getCommandLine().getServerAddress()).empty())
887                         {
888                                 // Send it to server to append to its log
889                                 vksc_server::AppendRequest request;
890                                 request.fileName = testCtx.getCommandLine().getLogFileName();
891                                 request.data.assign(subQpaCopy.begin(), subQpaCopy.end());
892                                 vksc_server::StandardOutputServerSingleton()->SendRequest(request);
893                         }
894                         else
895                         {
896                                 // Write it to parent's log
897                                 try
898                                 {
899                                         testCtx.getLog().supressLogging(false);
900                                         testCtx.getLog().writeRaw(subQpaCopy.c_str());
901                                 }
902                                 catch(...)
903                                 {
904                                         testCtx.getLog().supressLogging(true);
905                                         throw;
906                                 }
907                                 testCtx.getLog().supressLogging(true);
908                         }
909                 }
910
911                 {
912                         std::string                     beginStat               ("#SubProcessStatus");
913                         std::size_t                     beginPos                = subQpaText.find(beginStat);
914                         if (beginPos == std::string::npos)
915                                 TCU_THROW(InternalError, "Couldn't match #SubProcessStatus tag from " + qpaFileName.str() + subProcessExitCodeInfo);
916
917                         std::string                     subQpaStat              (subQpaText.begin() + beginPos + beginStat.size(), subQpaText.end());
918
919                         std::istringstream      str(subQpaStat);
920                         int                                     numExecuted, numPassed, numFailed, numNotSupported, numWarnings, numWaived;
921                         str >> numExecuted >> numPassed >> numFailed >> numNotSupported >> numWarnings >> numWaived;
922
923                         m_status.numExecuted                            += numExecuted;
924                         m_status.numPassed                                      += numPassed;
925                         m_status.numNotSupported                        += numNotSupported;
926                         m_status.numWarnings                            += numWarnings;
927                         m_status.numWaived                                      += numWaived;
928                         m_status.numFailed                                      += numFailed;
929                 }
930
931                 deDeleteFile(qpaFileName.str().c_str());
932         }
933 #else
934         DE_UNREF(testCtx);
935 #endif // CTS_USES_VULKANSC
936 }
937
938 bool TestCaseExecutor::spirvVersionSupported (vk::SpirvVersion spirvVersion)
939 {
940         if (spirvVersion <= vk::getMaxSpirvVersionForVulkan(m_context->getUsedApiVersion()))
941                 return true;
942
943         if (spirvVersion <= vk::SPIRV_VERSION_1_4)
944                 return m_context->isDeviceFunctionalitySupported("VK_KHR_spirv_1_4");
945
946         return false;
947 }
948
949 // GLSL shader tests
950
951 void createGlslTests (tcu::TestCaseGroup* glslTests)
952 {
953         tcu::TestContext&       testCtx         = glslTests->getTestContext();
954
955         // ShaderLibrary-based tests
956         static const struct
957         {
958                 const char*             name;
959                 const char*             description;
960         } s_es310Tests[] =
961         {
962                 { "arrays",                                             "Arrays"                                        },
963                 { "conditionals",                               "Conditional statements"        },
964                 { "constant_expressions",               "Constant expressions"          },
965                 { "constants",                                  "Constants"                                     },
966                 { "conversions",                                "Type conversions"                      },
967                 { "functions",                                  "Functions"                                     },
968                 { "linkage",                                    "Linking"                                       },
969                 { "scoping",                                    "Scoping"                                       },
970                 { "swizzles",                                   "Swizzles"                                      },
971         };
972
973         for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(s_es310Tests); ndx++)
974                 glslTests->addChild(createShaderLibraryGroup(testCtx,
975                                                                                                          s_es310Tests[ndx].name,
976                                                                                                          s_es310Tests[ndx].description,
977                                                                                                          std::string("vulkan/glsl/es310/") + s_es310Tests[ndx].name + ".test").release());
978
979         static const struct
980         {
981                 const char*             name;
982                 const char*             description;
983         } s_440Tests[] =
984         {
985                 { "linkage",                                    "Linking"                                       },
986         };
987
988         de::MovePtr<tcu::TestCaseGroup> glsl440Tests = de::MovePtr<tcu::TestCaseGroup>(new tcu::TestCaseGroup(testCtx, "440", ""));
989
990         for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(s_440Tests); ndx++)
991                 glsl440Tests->addChild(createShaderLibraryGroup(testCtx,
992                                                                                                          s_440Tests[ndx].name,
993                                                                                                          s_440Tests[ndx].description,
994                                                                                                          std::string("vulkan/glsl/440/") + s_440Tests[ndx].name + ".test").release());
995
996         glslTests->addChild(glsl440Tests.release());
997
998         // ShaderRenderCase-based tests
999         glslTests->addChild(sr::createDerivateTests                     (testCtx));
1000         glslTests->addChild(sr::createDiscardTests                      (testCtx));
1001 #ifndef CTS_USES_VULKANSC
1002         glslTests->addChild(sr::createDemoteTests                       (testCtx));
1003 #endif // CTS_USES_VULKANSC
1004         glslTests->addChild(sr::createIndexingTests                     (testCtx));
1005         glslTests->addChild(sr::createShaderInvarianceTests     (testCtx));
1006         glslTests->addChild(sr::createLimitTests                        (testCtx));
1007         glslTests->addChild(sr::createLoopTests                         (testCtx));
1008         glslTests->addChild(sr::createMatrixTests                       (testCtx));
1009         glslTests->addChild(sr::createOperatorTests                     (testCtx));
1010         glslTests->addChild(sr::createReturnTests                       (testCtx));
1011         glslTests->addChild(sr::createStructTests                       (testCtx));
1012         glslTests->addChild(sr::createSwitchTests                       (testCtx));
1013         glslTests->addChild(sr::createTextureFunctionTests      (testCtx));
1014         glslTests->addChild(sr::createTextureGatherTests        (testCtx));
1015         glslTests->addChild(sr::createBuiltinVarTests           (testCtx));
1016
1017         // ShaderExecutor-based tests
1018         glslTests->addChild(shaderexecutor::createBuiltinTests                          (testCtx));
1019         glslTests->addChild(shaderexecutor::createOpaqueTypeIndexingTests       (testCtx));
1020         glslTests->addChild(shaderexecutor::createAtomicOperationTests          (testCtx));
1021         glslTests->addChild(shaderexecutor::createShaderClockTests                      (testCtx));
1022
1023 #ifndef CTS_USES_VULKANSC
1024         // Amber GLSL tests.
1025         glslTests->addChild(cts_amber::createCombinedOperationsGroup            (testCtx));
1026         glslTests->addChild(cts_amber::createCrashTestGroup                                     (testCtx));
1027 #endif // CTS_USES_VULKANSC
1028 }
1029
1030 // TestPackage
1031
1032 BaseTestPackage::BaseTestPackage (tcu::TestContext& testCtx, const char* name, const char* desc)
1033         : tcu::TestPackage(testCtx, name, desc)
1034 {
1035 }
1036
1037 BaseTestPackage::~BaseTestPackage (void)
1038 {
1039 }
1040
1041 #ifdef CTS_USES_VULKAN
1042
1043 TestPackage::TestPackage (tcu::TestContext& testCtx)
1044         : BaseTestPackage(testCtx, "dEQP-VK", "dEQP Vulkan Tests")
1045 {
1046 }
1047
1048 TestPackage::~TestPackage (void)
1049 {
1050 }
1051
1052 ExperimentalTestPackage::ExperimentalTestPackage (tcu::TestContext& testCtx)
1053         : BaseTestPackage(testCtx, "dEQP-VK-experimental", "dEQP Vulkan Experimental Tests")
1054 {
1055 }
1056
1057 ExperimentalTestPackage::~ExperimentalTestPackage (void)
1058 {
1059 }
1060
1061 #endif
1062
1063 #ifdef CTS_USES_VULKANSC
1064
1065 TestPackageSC::TestPackageSC (tcu::TestContext& testCtx)
1066         : BaseTestPackage(testCtx, "dEQP-VKSC", "dEQP Vulkan SC Tests")
1067 {
1068 }
1069
1070 TestPackageSC::~TestPackageSC (void)
1071 {
1072 }
1073
1074 #endif // CTS_USES_VULKANSC
1075
1076 tcu::TestCaseExecutor* BaseTestPackage::createExecutor (void) const
1077 {
1078         return new TestCaseExecutor(m_testCtx);
1079 }
1080
1081 #ifdef CTS_USES_VULKAN
1082
1083 void TestPackage::init (void)
1084 {
1085         addChild(createTestGroup                                        (m_testCtx, "info", "Build and Device Info Tests", createInfoTests));
1086         addChild(api::createTests                                       (m_testCtx));
1087         addChild(memory::createTests                            (m_testCtx));
1088         addChild(pipeline::createTests                          (m_testCtx));
1089         addChild(BindingModel::createTests                      (m_testCtx));
1090         addChild(SpirVAssembly::createTests                     (m_testCtx));
1091         addChild(createTestGroup                                        (m_testCtx, "glsl", "GLSL shader execution tests", createGlslTests));
1092         addChild(createRenderPassTests                          (m_testCtx));
1093         addChild(createRenderPass2Tests                         (m_testCtx));
1094         addChild(createDynamicRenderingTests            (m_testCtx));
1095         addChild(ubo::createTests                                       (m_testCtx));
1096         addChild(DynamicState::createTests                      (m_testCtx));
1097         addChild(ssbo::createTests                                      (m_testCtx));
1098         addChild(QueryPool::createTests                         (m_testCtx));
1099         addChild(Draw::createTests                                      (m_testCtx));
1100         addChild(compute::createTests                           (m_testCtx));
1101         addChild(image::createTests                                     (m_testCtx));
1102         addChild(wsi::createTests                                       (m_testCtx));
1103         addChild(createSynchronizationTests                     (m_testCtx));
1104         addChild(createSynchronization2Tests            (m_testCtx));
1105         addChild(sparse::createTests                            (m_testCtx));
1106         addChild(tessellation::createTests                      (m_testCtx));
1107         addChild(rasterization::createTests                     (m_testCtx));
1108         addChild(clipping::createTests                          (m_testCtx));
1109         addChild(FragmentOperations::createTests        (m_testCtx));
1110         addChild(texture::createTests                           (m_testCtx));
1111         addChild(geometry::createTests                          (m_testCtx));
1112         addChild(robustness::createTests                        (m_testCtx));
1113         addChild(MultiView::createTests                         (m_testCtx));
1114         addChild(subgroups::createTests                         (m_testCtx));
1115         addChild(ycbcr::createTests                                     (m_testCtx));
1116         addChild(ProtectedMem::createTests                      (m_testCtx));
1117         addChild(DeviceGroup::createTests                       (m_testCtx));
1118         addChild(MemoryModel::createTests                       (m_testCtx));
1119         addChild(conditional::createTests                       (m_testCtx));
1120         addChild(cts_amber::createGraphicsFuzzTests     (m_testCtx));
1121         addChild(imageless::createTests                         (m_testCtx));
1122         addChild(TransformFeedback::createTests         (m_testCtx));
1123         addChild(DescriptorIndexing::createTests        (m_testCtx));
1124         addChild(FragmentShaderInterlock::createTests(m_testCtx));
1125         addChild(modifiers::createTests                         (m_testCtx));
1126         addChild(RayTracing::createTests                        (m_testCtx));
1127         addChild(RayQuery::createTests                          (m_testCtx));
1128         addChild(FragmentShadingRate::createTests       (m_testCtx));
1129         addChild(Reconvergence::createTests                     (m_testCtx, false));
1130         addChild(MeshShader::createTests                        (m_testCtx));
1131         addChild(FragmentShadingBarycentric::createTests(m_testCtx));
1132 }
1133
1134 void ExperimentalTestPackage::init (void)
1135 {
1136         addChild(postmortem::createTests                        (m_testCtx));
1137         addChild(Reconvergence::createTests                     (m_testCtx, true));
1138 }
1139
1140 #endif
1141
1142 #ifdef CTS_USES_VULKANSC
1143
1144 void TestPackageSC::init (void)
1145 {
1146         addChild(createTestGroup                                        (m_testCtx, "info", "Build and Device Info Tests", createInfoTests));
1147         addChild(api::createTests                                       (m_testCtx));
1148         addChild(memory::createTests                            (m_testCtx));
1149         addChild(pipeline::createTests                          (m_testCtx));
1150         addChild(BindingModel::createTests                      (m_testCtx));
1151         addChild(SpirVAssembly::createTests                     (m_testCtx));
1152         addChild(createTestGroup                                        (m_testCtx, "glsl", "GLSL shader execution tests", createGlslTests));
1153         addChild(createRenderPassTests                          (m_testCtx));
1154         addChild(createRenderPass2Tests                         (m_testCtx));
1155         addChild(ubo::createTests                                       (m_testCtx));
1156         addChild(DynamicState::createTests                      (m_testCtx));
1157         addChild(ssbo::createTests                                      (m_testCtx));
1158         addChild(QueryPool::createTests                         (m_testCtx));
1159         addChild(Draw::createTests                                      (m_testCtx));
1160         addChild(compute::createTests                           (m_testCtx));
1161         addChild(image::createTests                                     (m_testCtx));
1162 //      addChild(wsi::createTests                                       (m_testCtx));
1163         addChild(createSynchronizationTests                     (m_testCtx));
1164         addChild(createSynchronization2Tests            (m_testCtx));
1165 //      addChild(sparse::createTests                            (m_testCtx));
1166         addChild(tessellation::createTests                      (m_testCtx));
1167         addChild(rasterization::createTests                     (m_testCtx));
1168         addChild(clipping::createTests                          (m_testCtx));
1169         addChild(FragmentOperations::createTests        (m_testCtx));
1170         addChild(texture::createTests                           (m_testCtx));
1171         addChild(geometry::createTests                          (m_testCtx));
1172         addChild(robustness::createTests                        (m_testCtx));
1173         addChild(MultiView::createTests                         (m_testCtx));
1174         addChild(subgroups::createTests                         (m_testCtx));
1175         addChild(ycbcr::createTests                                     (m_testCtx));
1176         addChild(ProtectedMem::createTests                      (m_testCtx));
1177         addChild(DeviceGroup::createTests                       (m_testCtx));
1178         addChild(MemoryModel::createTests                       (m_testCtx));
1179 //      addChild(conditional::createTests                       (m_testCtx));
1180 //      addChild(cts_amber::createGraphicsFuzzTests     (m_testCtx));
1181         addChild(imageless::createTests                         (m_testCtx));
1182 //      addChild(TransformFeedback::createTests         (m_testCtx));
1183         addChild(DescriptorIndexing::createTests        (m_testCtx));
1184         addChild(FragmentShaderInterlock::createTests(m_testCtx));
1185 //      addChild(modifiers::createTests                         (m_testCtx));
1186 //      addChild(RayTracing::createTests                        (m_testCtx));
1187 //      addChild(RayQuery::createTests                          (m_testCtx));
1188         addChild(FragmentShadingRate::createTests(m_testCtx));
1189         addChild(sc::createTests(m_testCtx));
1190 }
1191
1192 #endif // CTS_USES_VULKANSC
1193
1194 } // vkt