1 #ifndef _TCUNULLWSPLATFORM_HPP 2 #define _TCUNULLWSPLATFORM_HPP 3 /*------------------------------------------------------------------------- 4 * OpenGL Conformance Test Suite 5 * ----------------------------- 6 * 7 * Copyright (c) 2016 Google Inc. 8 * Copyright (c) 2016 The Khronos Group Inc. 9 * 10 * Licensed under the Apache License, Version 2.0 (the "License"); 11 * you may not use this file except in compliance with the License. 12 * You may obtain a copy of the License at 13 * 14 * http://www.apache.org/licenses/LICENSE-2.0 15 * 16 * Unless required by applicable law or agreed to in writing, software 17 * distributed under the License is distributed on an "AS IS" BASIS, 18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 * See the License for the specific language governing permissions and 20 * limitations under the License. 21 * 22 *//*! 23 * \file 24 * \brief 25 *//*--------------------------------------------------------------------*/ 26 27 #include "deDynamicLibrary.hpp" 28 #include "tcuFunctionLibrary.hpp" 29 #include "tcuDefs.hpp" 30 #include "tcuPlatform.hpp" 31 #include "gluPlatform.hpp" 32 #include "egluPlatform.hpp" 33 #include "vkPlatform.hpp" 34 35 namespace tcu 36 { 37 namespace nullws 38 { 39 class VulkanLibrary : public vk::Library 40 { 41 public: VulkanLibrary(const char * libraryPath)42 VulkanLibrary(const char *libraryPath) 43 : m_library(libraryPath != DE_NULL ? libraryPath : "libvulkan.so.1") 44 , m_driver(m_library) 45 { 46 } 47 getPlatformInterface(void) const48 const vk::PlatformInterface &getPlatformInterface(void) const 49 { 50 return m_driver; 51 } getFunctionLibrary(void) const52 const tcu::FunctionLibrary &getFunctionLibrary(void) const 53 { 54 return m_library; 55 } 56 57 private: 58 const tcu::DynamicFunctionLibrary m_library; 59 const vk::PlatformDriver m_driver; 60 }; 61 62 class Platform : public tcu::Platform, private glu::Platform, private eglu::Platform, private vk::Platform 63 { 64 public: 65 Platform(); 66 virtual ~Platform(); 67 getGLPlatform() const68 virtual const glu::Platform &getGLPlatform() const 69 { 70 return static_cast<const glu::Platform &>(*this); 71 } getEGLPlatform() const72 virtual const eglu::Platform &getEGLPlatform() const 73 { 74 return static_cast<const eglu::Platform &>(*this); 75 } getVulkanPlatform() const76 virtual const vk::Platform &getVulkanPlatform() const 77 { 78 return static_cast<const vk::Platform &>(*this); 79 } 80 createLibrary(const char * libraryPath) const81 vk::Library *createLibrary(const char *libraryPath) const 82 { 83 return new VulkanLibrary(libraryPath); 84 } 85 }; 86 87 } // namespace nullws 88 } // namespace tcu 89 90 #endif // _TCUNULLWSPLATFORM_HPP 91