• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2021 The SwiftShader Authors. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //    http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef VULKAN_TESTER_HPP_
16 #define VULKAN_TESTER_HPP_
17 
18 #include "VulkanHeaders.hpp"
19 
20 class VulkanTester
21 {
22 public:
23 	VulkanTester();
24 	virtual ~VulkanTester();
25 
26 	// Call once after construction so that virtual functions may be called during init
27 	void initialize();
28 
dynamicLoader() const29 	const vk::DynamicLoader &dynamicLoader() const { return *dl; }
getPhysicalDevice()30 	vk::PhysicalDevice &getPhysicalDevice() { return physicalDevice; }
getDevice()31 	vk::Device &getDevice() { return device; }
getQueue()32 	vk::Queue &getQueue() { return queue; }
getQueueFamilyIndex() const33 	uint32_t getQueueFamilyIndex() const { return queueFamilyIndex; }
34 
35 private:
36 	std::unique_ptr<vk::DynamicLoader> loadDriver();
37 
38 	std::unique_ptr<class ScopedSetIcdFilenames> setIcdFilenames;
39 	std::unique_ptr<vk::DynamicLoader> dl;
40 	vk::DebugUtilsMessengerEXT debugReport;
41 
42 protected:
43 	const uint32_t queueFamilyIndex = 0;
44 
45 	vk::Instance instance;  // Owning handle
46 	vk::PhysicalDevice physicalDevice;
47 	vk::Device device;  // Owning handle
48 	vk::Queue queue;
49 };
50 
51 #endif  // VULKAN_TESTER_HPP_
52