112edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos#ifndef _VKTTESTCASE_HPP
212edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos#define _VKTTESTCASE_HPP
312edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos/*-------------------------------------------------------------------------
4846cc3ce8e721a972ef38c44e24da49ea96110caPyry Haulos * Vulkan Conformance Tests
5846cc3ce8e721a972ef38c44e24da49ea96110caPyry Haulos * ------------------------
612edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos *
7846cc3ce8e721a972ef38c44e24da49ea96110caPyry Haulos * Copyright (c) 2015 Google Inc.
812edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos *
9978d3d585aa549eb1e729b51e9d85fc6477240f9Pyry Haulos * Licensed under the Apache License, Version 2.0 (the "License");
10978d3d585aa549eb1e729b51e9d85fc6477240f9Pyry Haulos * you may not use this file except in compliance with the License.
11978d3d585aa549eb1e729b51e9d85fc6477240f9Pyry Haulos * You may obtain a copy of the License at
1212edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos *
13978d3d585aa549eb1e729b51e9d85fc6477240f9Pyry Haulos *      http://www.apache.org/licenses/LICENSE-2.0
1412edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos *
15978d3d585aa549eb1e729b51e9d85fc6477240f9Pyry Haulos * Unless required by applicable law or agreed to in writing, software
16978d3d585aa549eb1e729b51e9d85fc6477240f9Pyry Haulos * distributed under the License is distributed on an "AS IS" BASIS,
17978d3d585aa549eb1e729b51e9d85fc6477240f9Pyry Haulos * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18978d3d585aa549eb1e729b51e9d85fc6477240f9Pyry Haulos * See the License for the specific language governing permissions and
19978d3d585aa549eb1e729b51e9d85fc6477240f9Pyry Haulos * limitations under the License.
2012edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos *
2112edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos *//*!
2212edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos * \file
2312edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos * \brief Vulkan test case base classes
2412edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos *//*--------------------------------------------------------------------*/
2512edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos
2612edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos#include "tcuDefs.hpp"
2712edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos#include "tcuTestCase.hpp"
2832675035be2a05886457025598f90c131d83c670Pyry Haulos#include "vkDefs.hpp"
29bd0311e17f335ca7e184f35e2d2ca1c826364039Jarkko Pöyry#include "deUniquePtr.hpp"
30d784ada312e9c0f2d0262a87402e2ff6c6160a66Boris Zanin#include "vkPrograms.hpp"
3139a3dba45084e984fddcc91bde0f16e6b8fcaf0cArkadiusz Sarwa#include "vkApiVersion.hpp"
3212edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos
3312edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulosnamespace glu
3412edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos{
3512edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulosstruct ProgramSources;
3612edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos}
3712edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos
3812edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulosnamespace vk
3912edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos{
4012edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulosclass PlatformInterface;
41bd0311e17f335ca7e184f35e2d2ca1c826364039Jarkko Pöyryclass Allocator;
427485f0bbab69ed556d54503e8f94bedc5b71175dAndrew Woloszynstruct SourceCollections;
4312edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos}
4412edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos
4512edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulosnamespace vkt
4612edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos{
4712edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos
4832675035be2a05886457025598f90c131d83c670Pyry Haulosclass DefaultDevice;
4932675035be2a05886457025598f90c131d83c670Pyry Haulos
5012edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulosclass Context
5112edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos{
5212edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulospublic:
53d784ada312e9c0f2d0262a87402e2ff6c6160a66Boris Zanin												Context							(tcu::TestContext&				testCtx,
54d784ada312e9c0f2d0262a87402e2ff6c6160a66Boris Zanin																				 const vk::PlatformInterface&	platformInterface,
55d784ada312e9c0f2d0262a87402e2ff6c6160a66Boris Zanin																				 vk::BinaryCollection&			progCollection);
56fa8d8350fe202ecc4697be1d08f2047c90e91332Jarkko Pöyry												~Context						(void);
5732675035be2a05886457025598f90c131d83c670Pyry Haulos
58fa8d8350fe202ecc4697be1d08f2047c90e91332Jarkko Pöyry	tcu::TestContext&							getTestContext					(void) const { return m_testCtx;			}
59fa8d8350fe202ecc4697be1d08f2047c90e91332Jarkko Pöyry	const vk::PlatformInterface&				getPlatformInterface			(void) const { return m_platformInterface;	}
60d784ada312e9c0f2d0262a87402e2ff6c6160a66Boris Zanin	vk::BinaryCollection&						getBinaryCollection				(void) const { return m_progCollection;		}
6112edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos
6232675035be2a05886457025598f90c131d83c670Pyry Haulos	// Default instance & device, selected with --deqp-vk-device-id=N
63b68af198a76622bebeb81d0ae0fe007c6527d35eMarcin Rogucki	deUint32									getAvailableInstanceVersion		(void) const;
640dbda1aa0f2399e03025db46c44e0ecce3d42c25Arkadiusz Sarwa	const std::vector<std::string>&				getInstanceExtensions			(void) const;
65fa8d8350fe202ecc4697be1d08f2047c90e91332Jarkko Pöyry	vk::VkInstance								getInstance						(void) const;
66fa8d8350fe202ecc4697be1d08f2047c90e91332Jarkko Pöyry	const vk::InstanceInterface&				getInstanceInterface			(void) const;
67fa8d8350fe202ecc4697be1d08f2047c90e91332Jarkko Pöyry	vk::VkPhysicalDevice						getPhysicalDevice				(void) const;
68aae4252b14d3f5fc1594706fecc567b84c64f1adAlexander Galazin	deUint32									getDeviceVersion				(void) const;
69f263eb0791c3290b7d10847a7d7282cf67f51440Pyry Haulos	const vk::VkPhysicalDeviceFeatures&			getDeviceFeatures				(void) const;
7033b5a8a9652e2ad55029dccd970f0e7a39af917fAlexander Galazin	const vk::VkPhysicalDeviceFeatures2&		getDeviceFeatures2				(void) const;
718ee015701bdeed93cf55f91f5af91cdc61bb7fcbMarcin Rogucki	const vk::VkPhysicalDeviceSamplerYcbcrConversionFeatures&
728ee015701bdeed93cf55f91f5af91cdc61bb7fcbMarcin Rogucki												getSamplerYCbCrConversionFeatures
738ee015701bdeed93cf55f91f5af91cdc61bb7fcbMarcin Rogucki																				(void) const;
74cb6cfaca1e81b741857924d7b18bf5e7c934b23eJeff Bolz	const vk::VkPhysicalDeviceProperties&		getDeviceProperties				(void) const;
75ed8561a07cdb1bb7730eccf9025b738838392464Pyry Haulos	const std::vector<std::string>&				getDeviceExtensions				(void) const;
76fa8d8350fe202ecc4697be1d08f2047c90e91332Jarkko Pöyry	vk::VkDevice								getDevice						(void) const;
77fa8d8350fe202ecc4697be1d08f2047c90e91332Jarkko Pöyry	const vk::DeviceInterface&					getDeviceInterface				(void) const;
78fa8d8350fe202ecc4697be1d08f2047c90e91332Jarkko Pöyry	deUint32									getUniversalQueueFamilyIndex	(void) const;
79fa8d8350fe202ecc4697be1d08f2047c90e91332Jarkko Pöyry	vk::VkQueue									getUniversalQueue				(void) const;
80aae4252b14d3f5fc1594706fecc567b84c64f1adAlexander Galazin	deUint32									getUsedApiVersion				(void) const;
8112edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos
82bd0311e17f335ca7e184f35e2d2ca1c826364039Jarkko Pöyry	vk::Allocator&								getDefaultAllocator				(void) const;
8339a3dba45084e984fddcc91bde0f16e6b8fcaf0cArkadiusz Sarwa	bool										contextSupports					(const deUint32 majorNum, const deUint32 minorNum, const deUint32 patchNum) const;
8439a3dba45084e984fddcc91bde0f16e6b8fcaf0cArkadiusz Sarwa	bool										contextSupports					(const vk::ApiVersion version) const;
8539a3dba45084e984fddcc91bde0f16e6b8fcaf0cArkadiusz Sarwa	bool										contextSupports					(const deUint32 requiredApiVersionBits) const;
86bd0311e17f335ca7e184f35e2d2ca1c826364039Jarkko Pöyry
8712edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulosprotected:
8812edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos	tcu::TestContext&							m_testCtx;
8912edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos	const vk::PlatformInterface&				m_platformInterface;
90d784ada312e9c0f2d0262a87402e2ff6c6160a66Boris Zanin	vk::BinaryCollection&						m_progCollection;
9132675035be2a05886457025598f90c131d83c670Pyry Haulos
92bd0311e17f335ca7e184f35e2d2ca1c826364039Jarkko Pöyry	const de::UniquePtr<DefaultDevice>			m_device;
93bd0311e17f335ca7e184f35e2d2ca1c826364039Jarkko Pöyry	const de::UniquePtr<vk::Allocator>			m_allocator;
9432675035be2a05886457025598f90c131d83c670Pyry Haulos
9532675035be2a05886457025598f90c131d83c670Pyry Haulosprivate:
96fa8d8350fe202ecc4697be1d08f2047c90e91332Jarkko Pöyry												Context							(const Context&); // Not allowed
97fa8d8350fe202ecc4697be1d08f2047c90e91332Jarkko Pöyry	Context&									operator=						(const Context&); // Not allowed
9812edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos};
9912edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos
10012edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulosclass TestInstance;
10112edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos
10212edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulosclass TestCase : public tcu::TestCase
10312edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos{
10412edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulospublic:
10512edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos							TestCase		(tcu::TestContext& testCtx, const std::string& name, const std::string& description);
10612edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos							TestCase		(tcu::TestContext& testCtx, tcu::TestNodeType type, const std::string& name, const std::string& description);
10712edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos	virtual					~TestCase		(void) {}
10812edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos
1097485f0bbab69ed556d54503e8f94bedc5b71175dAndrew Woloszyn	virtual void			initPrograms	(vk::SourceCollections& programCollection) const;
11012edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos	virtual TestInstance*	createInstance	(Context& context) const = 0;
11112edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos
11212edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos	IterateResult			iterate			(void) { DE_ASSERT(false); return STOP; } // Deprecated in this module
11312edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos};
11412edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos
11512edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulosclass TestInstance
11612edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos{
11712edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulospublic:
11812edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos								TestInstance	(Context& context) : m_context(context) {}
11912edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos	virtual						~TestInstance	(void) {}
12012edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos
12112edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos	virtual tcu::TestStatus		iterate			(void) = 0;
12212edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos
12312edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulosprotected:
12412edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos	Context&					m_context;
125fbf00b07fa0b5b35b84f24fe07f1367cba21934cPyry Haulos
126fbf00b07fa0b5b35b84f24fe07f1367cba21934cPyry Haulosprivate:
127fbf00b07fa0b5b35b84f24fe07f1367cba21934cPyry Haulos								TestInstance	(const TestInstance&);
128fbf00b07fa0b5b35b84f24fe07f1367cba21934cPyry Haulos	TestInstance&				operator=		(const TestInstance&);
12912edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos};
13012edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos
13112edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulosinline TestCase::TestCase (tcu::TestContext& testCtx, const std::string& name, const std::string& description)
13212edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos	: tcu::TestCase(testCtx, name.c_str(), description.c_str())
13312edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos{
13412edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos}
13512edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos
13612edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulosinline TestCase::TestCase (tcu::TestContext& testCtx, tcu::TestNodeType type, const std::string& name, const std::string& description)
13712edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos	: tcu::TestCase(testCtx, type, name.c_str(), description.c_str())
13812edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos{
13912edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos}
14012edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos
14112edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos} // vkt
14212edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos
14312edbd9c94d5380368146b99cfdf24b811c5f46bPyry Haulos#endif // _VKTTESTCASE_HPP
144