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