• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2018 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 VK_PHYSICAL_DEVICE_HPP_
16 #define VK_PHYSICAL_DEVICE_HPP_
17 
18 #include "VkObject.hpp"
19 
20 namespace vk
21 {
22 
23 class PhysicalDevice
24 {
25 public:
GetAllocationScope()26 	static constexpr VkSystemAllocationScope GetAllocationScope() { return VK_SYSTEM_ALLOCATION_SCOPE_DEVICE; }
27 
28 	PhysicalDevice(const void*, void* mem);
destroy(const VkAllocationCallbacks * pAllocator)29 	void destroy(const VkAllocationCallbacks* pAllocator) {}
30 
ComputeRequiredAllocationSize(const void *)31 	static size_t ComputeRequiredAllocationSize(const void*) { return 0; }
32 
33 	const VkPhysicalDeviceFeatures& getFeatures() const;
34 	void getFeatures(VkPhysicalDeviceSamplerYcbcrConversionFeatures* features) const;
35 	void getFeatures(VkPhysicalDevice16BitStorageFeatures* features) const;
36 	void getFeatures(VkPhysicalDeviceVariablePointerFeatures* features) const;
37 	void getFeatures(VkPhysicalDevice8BitStorageFeaturesKHR* features) const;
38 	void getFeatures(VkPhysicalDeviceMultiviewFeatures* features) const;
39 	void getFeatures(VkPhysicalDeviceProtectedMemoryFeatures* features) const;
40 	bool hasFeatures(const VkPhysicalDeviceFeatures& requestedFeatures) const;
41 
42 	const VkPhysicalDeviceProperties& getProperties() const;
43 	void getProperties(VkPhysicalDeviceIDProperties* properties) const;
44 	void getProperties(VkPhysicalDeviceMaintenance3Properties* properties) const;
45 	void getProperties(VkPhysicalDeviceMultiviewProperties* properties) const;
46 	void getProperties(VkPhysicalDevicePointClippingProperties* properties) const;
47 	void getProperties(VkPhysicalDeviceProtectedMemoryProperties* properties) const;
48 	void getProperties(VkPhysicalDeviceSubgroupProperties* properties) const;
49 
50 	void getFormatProperties(VkFormat format, VkFormatProperties* pFormatProperties) const;
51 	void getImageFormatProperties(VkFormat format, VkImageType type, VkImageTiling tiling,
52 	                              VkImageUsageFlags usage, VkImageCreateFlags flags,
53 	                              VkImageFormatProperties* pImageFormatProperties) const;
54 	uint32_t getQueueFamilyPropertyCount() const;
55 	void getQueueFamilyProperties(uint32_t pQueueFamilyPropertyCount,
56 	                              VkQueueFamilyProperties* pQueueFamilyProperties) const;
57 	const VkPhysicalDeviceMemoryProperties& getMemoryProperties() const;
58 
59 private:
60 	const VkPhysicalDeviceLimits& getLimits() const;
61 	VkSampleCountFlags getSampleCounts() const;
62 };
63 
64 using DispatchablePhysicalDevice = DispatchableObject<PhysicalDevice, VkPhysicalDevice>;
65 
Cast(VkPhysicalDevice object)66 static inline PhysicalDevice* Cast(VkPhysicalDevice object)
67 {
68 	return DispatchablePhysicalDevice::Cast(object);
69 }
70 
71 } // namespace vk
72 
73 #endif // VK_PHYSICAL_DEVICE_HPP_
74