1 #ifndef _VKTVKRUNNERTESTCASE_HPP
2 #define _VKTVKRUNNERTESTCASE_HPP
3 /*------------------------------------------------------------------------
4  * Vulkan Conformance Tests
5  * ------------------------
6  *
7  * Copyright (c) 2018 Intel Corporation
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  *//*!
22  * \file
23  * \brief Functional tests using vkrunner
24  *//*--------------------------------------------------------------------*/
25 
26 #include "tcuDefs.hpp"
27 #include "tcuTestCase.hpp"
28 #include "vktTestCase.hpp"
29 
30 struct vr_source;
31 struct vr_script;
32 struct vr_script_shader_code;
33 
34 namespace vkt
35 {
36 namespace vkrunner
37 {
38 
39 struct TestCaseData
40 {
41 	std::string						categoryname;
42 	std::string						filename;
43 	int								num_shaders;
44 	struct vr_source				*source;
45 	struct vr_script				*script;
46 	struct vr_script_shader_code	*shaders;
47 };
48 
49 class VkRunnerTestInstance : public TestInstance
50 {
51 public:
VkRunnerTestInstance(Context & context,const TestCaseData & testCaseData)52 	VkRunnerTestInstance (Context& context, const TestCaseData& testCaseData)
53 		: TestInstance(context),
54 		  m_testCaseData(testCaseData)
55 	{
56 	}
57 
58 	virtual tcu::TestStatus iterate (void);
59 
60 private:
61 	TestCaseData m_testCaseData;
62 };
63 
64 class VkRunnerTestCase : public TestCase
65 {
66 public:
67 	VkRunnerTestCase (tcu::TestContext&	testCtx,
68 					  const char*		categoryname,
69 					  const char*		filename,
70 					  const char*		name,
71 					  const char*		description);
72 
73 	~VkRunnerTestCase (void);
74 
75 	void addTokenReplacement(const char *token,
76 							 const char *replacement);
77 
78 	bool getShaders();
79 
80 	virtual TestInstance* createInstance (Context& ctx) const;
81 
82 	void initPrograms(vk::SourceCollections& programCollection) const;
83 
84 private:
85 	TestCaseData m_testCaseData;
86 };
87 
88 } // vkrunner
89 } // vkt
90 
91 #endif // _VKTVKRUNNERTESTCASE_HPP
92