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