• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*-------------------------------------------------------------------------
2  * Vulkan CTS Framework
3  * --------------------
4  *
5  * Copyright (c) 2015 Google Inc.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  *//*!
20  * \file
21  * \brief Vulkan platform abstraction.
22  *//*--------------------------------------------------------------------*/
23 
24 #include "vkPlatform.hpp"
25 #include "tcuFunctionLibrary.hpp"
26 
27 namespace vk
28 {
29 
PlatformDriver(const tcu::FunctionLibrary & library)30 PlatformDriver::PlatformDriver (const tcu::FunctionLibrary& library)
31 {
32 	m_vk.getInstanceProcAddr	= (GetInstanceProcAddrFunc)library.getFunction("vkGetInstanceProcAddr");
33 
34 #define GET_PROC_ADDR(NAME) m_vk.getInstanceProcAddr(DE_NULL, NAME)
35 #include "vkInitPlatformFunctionPointers.inl"
36 #undef GET_PROC_ADDR
37 }
38 
~PlatformDriver(void)39 PlatformDriver::~PlatformDriver (void)
40 {
41 }
42 
InstanceDriver(const PlatformInterface & platformInterface,VkInstance instance)43 InstanceDriver::InstanceDriver (const PlatformInterface& platformInterface, VkInstance instance)
44 {
45 	loadFunctions(platformInterface, instance);
46 }
47 
loadFunctions(const PlatformInterface & platformInterface,VkInstance instance)48 void InstanceDriver::loadFunctions (const PlatformInterface& platformInterface, VkInstance instance)
49 {
50 #define GET_PROC_ADDR(NAME) platformInterface.getInstanceProcAddr(instance, NAME)
51 #include "vkInitInstanceFunctionPointers.inl"
52 #undef GET_PROC_ADDR
53 }
54 
~InstanceDriver(void)55 InstanceDriver::~InstanceDriver (void)
56 {
57 }
58 
DeviceDriver(const PlatformInterface & platformInterface,VkInstance instance,VkDevice device)59 DeviceDriver::DeviceDriver(const PlatformInterface& platformInterface, VkInstance instance, VkDevice device)
60 {
61 	m_vk.getDeviceProcAddr = (GetDeviceProcAddrFunc)platformInterface.getInstanceProcAddr(instance, "vkGetDeviceProcAddr");
62 
63 #define GET_PROC_ADDR(NAME) m_vk.getDeviceProcAddr(device, NAME)
64 #include "vkInitDeviceFunctionPointers.inl"
65 #undef GET_PROC_ADDR
66 }
67 
~DeviceDriver(void)68 DeviceDriver::~DeviceDriver (void)
69 {
70 }
71 
72 #include "vkPlatformDriverImpl.inl"
73 #include "vkInstanceDriverImpl.inl"
74 #include "vkDeviceDriverImpl.inl"
75 
createWsiDisplay(wsi::Type) const76 wsi::Display* Platform::createWsiDisplay (wsi::Type) const
77 {
78 	TCU_THROW(NotSupportedError, "WSI not supported");
79 }
80 
hasDisplay(wsi::Type) const81 bool Platform::hasDisplay (wsi::Type) const
82 {
83 	return false;
84 }
85 
describePlatform(std::ostream & dst) const86 void Platform::describePlatform (std::ostream& dst) const
87 {
88 	dst << "vk::Platform::describePlatform() not implemented";
89 }
90 
91 } // vk
92