1 #ifndef _VKTTESTCASE_HPP
2 #define _VKTTESTCASE_HPP
3 /*-------------------------------------------------------------------------
4 * Vulkan Conformance Tests
5 * ------------------------
7 * Copyright (c) 2015 Google Inc.
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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.
23 * \brief Vulkan test case base classes
24 *//*--------------------------------------------------------------------*/
26 #include "tcuDefs.hpp"
27 #include "tcuTestCase.hpp"
29 #include "deUniquePtr.hpp"
30 #include "vkPrograms.hpp"
31 #include "vkApiVersion.hpp"
35 struct ProgramSources;
40 class PlatformInterface;
42 struct SourceCollections;
53 Context (tcu::TestContext& testCtx,
54 const vk::PlatformInterface& platformInterface,
55 vk::BinaryCollection& progCollection);
58 tcu::TestContext& getTestContext (void) const { return m_testCtx; }
59 const vk::PlatformInterface& getPlatformInterface (void) const { return m_platformInterface; }
60 vk::BinaryCollection& getBinaryCollection (void) const { return m_progCollection; }
62 // Default instance & device, selected with --deqp-vk-device-id=N
63 deUint32 getAvailableInstanceVersion (void) const;
64 const std::vector<std::string>& getInstanceExtensions (void) const;
65 vk::VkInstance getInstance (void) const;
66 const vk::InstanceInterface& getInstanceInterface (void) const;
67 vk::VkPhysicalDevice getPhysicalDevice (void) const;
68 deUint32 getDeviceVersion (void) const;
69 const vk::VkPhysicalDeviceFeatures& getDeviceFeatures (void) const;
70 const vk::VkPhysicalDeviceFeatures2& getDeviceFeatures2 (void) const;
71 const vk::VkPhysicalDeviceSamplerYcbcrConversionFeatures&
72 getSamplerYCbCrConversionFeatures
74 const vk::VkPhysicalDevice16BitStorageFeatures&
75 get16BitStorageFeatures (void) const;
76 const vk::VkPhysicalDeviceVariablePointerFeatures&
77 getVariablePointerFeatures (void) const;
78 const vk::VkPhysicalDeviceProperties& getDeviceProperties (void) const;
79 const std::vector<std::string>& getDeviceExtensions (void) const;
80 vk::VkDevice getDevice (void) const;
81 const vk::DeviceInterface& getDeviceInterface (void) const;
82 deUint32 getUniversalQueueFamilyIndex (void) const;
83 vk::VkQueue getUniversalQueue (void) const;
84 deUint32 getUsedApiVersion (void) const;
85 deUint32 getSparseQueueFamilyIndex (void) const;
86 vk::VkQueue getSparseQueue (void) const;
87 vk::Allocator& getDefaultAllocator (void) const;
88 bool contextSupports (const deUint32 majorNum, const deUint32 minorNum, const deUint32 patchNum) const;
89 bool contextSupports (const vk::ApiVersion version) const;
90 bool contextSupports (const deUint32 requiredApiVersionBits) const;
93 tcu::TestContext& m_testCtx;
94 const vk::PlatformInterface& m_platformInterface;
95 vk::BinaryCollection& m_progCollection;
97 const de::UniquePtr<DefaultDevice> m_device;
98 const de::UniquePtr<vk::Allocator> m_allocator;
101 Context (const Context&); // Not allowed
102 Context& operator= (const Context&); // Not allowed
107 class TestCase : public tcu::TestCase
110 TestCase (tcu::TestContext& testCtx, const std::string& name, const std::string& description);
111 TestCase (tcu::TestContext& testCtx, tcu::TestNodeType type, const std::string& name, const std::string& description);
112 virtual ~TestCase (void) {}
114 virtual void initPrograms (vk::SourceCollections& programCollection) const;
115 virtual TestInstance* createInstance (Context& context) const = 0;
117 IterateResult iterate (void) { DE_ASSERT(false); return STOP; } // Deprecated in this module
123 TestInstance (Context& context) : m_context(context) {}
124 virtual ~TestInstance (void) {}
126 virtual tcu::TestStatus iterate (void) = 0;
132 TestInstance (const TestInstance&);
133 TestInstance& operator= (const TestInstance&);
136 inline TestCase::TestCase (tcu::TestContext& testCtx, const std::string& name, const std::string& description)
137 : tcu::TestCase(testCtx, name.c_str(), description.c_str())
141 inline TestCase::TestCase (tcu::TestContext& testCtx, tcu::TestNodeType type, const std::string& name, const std::string& description)
142 : tcu::TestCase(testCtx, type, name.c_str(), description.c_str())
148 #endif // _VKTTESTCASE_HPP