Home | History | Annotate | Download | only in vulkan
      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 
     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 
     39 PlatformDriver::~PlatformDriver (void)
     40 {
     41 }
     42 
     43 InstanceDriver::InstanceDriver (const PlatformInterface& platformInterface, VkInstance instance)
     44 {
     45 	loadFunctions(platformInterface, instance);
     46 }
     47 
     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 
     55 InstanceDriver::~InstanceDriver (void)
     56 {
     57 }
     58 
     59 DeviceDriver::DeviceDriver (const InstanceInterface& instanceInterface, VkDevice device)
     60 {
     61 #define GET_PROC_ADDR(NAME) instanceInterface.getDeviceProcAddr(device, NAME)
     62 #include "vkInitDeviceFunctionPointers.inl"
     63 #undef GET_PROC_ADDR
     64 }
     65 
     66 DeviceDriver::~DeviceDriver (void)
     67 {
     68 }
     69 
     70 #include "vkPlatformDriverImpl.inl"
     71 #include "vkInstanceDriverImpl.inl"
     72 #include "vkDeviceDriverImpl.inl"
     73 
     74 wsi::Display* Platform::createWsiDisplay (wsi::Type) const
     75 {
     76 	TCU_THROW(NotSupportedError, "WSI not supported");
     77 }
     78 
     79 void Platform::describePlatform (std::ostream& dst) const
     80 {
     81 	dst << "vk::Platform::describePlatform() not implemented";
     82 }
     83 
     84 } // vk
     85