1 #ifndef _VKPLATFORM_HPP
2 #define _VKPLATFORM_HPP
3 /*-------------------------------------------------------------------------
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 platform abstraction.
24 *//*--------------------------------------------------------------------*/
32 class FunctionLibrary;
42 virtual ~Library (void) {}
44 virtual const PlatformInterface& getPlatformInterface (void) const = 0;
47 class PlatformDriver : public PlatformInterface
50 PlatformDriver (const tcu::FunctionLibrary& library);
51 ~PlatformDriver (void);
53 #include "vkConcretePlatformInterface.inl"
58 #include "vkPlatformFunctionPointers.inl"
64 class InstanceDriver : public InstanceInterface
67 InstanceDriver (const PlatformInterface& platformInterface, VkInstance instance);
68 ~InstanceDriver (void);
70 #include "vkConcreteInstanceInterface.inl"
75 #include "vkInstanceFunctionPointers.inl"
81 class DeviceDriver : public DeviceInterface
84 DeviceDriver (const InstanceInterface& instanceInterface, VkDevice device);
87 #include "vkConcreteDeviceInterface.inl"
92 #include "vkDeviceFunctionPointers.inl"
98 // Defined in vkWsiPlatform.hpp
104 struct PlatformMemoryLimits
106 // System memory properties
107 size_t totalSystemMemory; //!< #bytes of system memory (heap + HOST_LOCAL) tests must not exceed
109 // Device memory properties
110 VkDeviceSize totalDeviceLocalMemory; //!< #bytes of total DEVICE_LOCAL memory tests must not exceed or 0 if DEVICE_LOCAL counts against system memory
111 VkDeviceSize deviceMemoryAllocationGranularity; //!< VkDeviceMemory allocation granularity (typically page size)
113 // Device memory page table geometry
114 // \todo [2016-03-23 pyry] This becomes obsolete if Vulkan API adds a way for driver to expose internal device memory allocations
115 VkDeviceSize devicePageSize; //!< Page size on device (must be rounded up to nearest POT)
116 VkDeviceSize devicePageTableEntrySize; //!< Number of bytes per page table size
117 size_t devicePageTableHierarchyLevels; //!< Number of levels in device page table hierarchy
119 PlatformMemoryLimits (void)
120 : totalSystemMemory (0)
121 , totalDeviceLocalMemory (0)
122 , deviceMemoryAllocationGranularity (0)
124 , devicePageTableEntrySize (0)
125 , devicePageTableHierarchyLevels (0)
129 /*--------------------------------------------------------------------*//*!
130 * \brief Vulkan platform interface
131 *//*--------------------------------------------------------------------*/
138 virtual Library* createLibrary (void) const = 0;
140 virtual wsi::Display* createWsiDisplay (wsi::Type wsiType) const;
142 virtual void getMemoryLimits (PlatformMemoryLimits& limits) const = 0;
143 virtual void describePlatform (std::ostream& dst) const;
146 inline PlatformMemoryLimits getMemoryLimits (const Platform& platform)
148 PlatformMemoryLimits limits;
149 platform.getMemoryLimits(limits);
155 #endif // _VKPLATFORM_HPP