• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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(void)42 	VulkanLibrary (void)
43 		: m_library	("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 private:
57 	const tcu::DynamicFunctionLibrary	m_library;
58 	const vk::PlatformDriver			m_driver;
59 };
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 { return static_cast<const glu::Platform&>(*this); }
getEGLPlatform() const69 	virtual const eglu::Platform&	getEGLPlatform	()	const { return static_cast<const eglu::Platform&>(*this); }
getVulkanPlatform() const70   virtual const vk::Platform&   getVulkanPlatform() const { return static_cast<const vk::Platform&>(*this); }
71 
createLibrary(void) const72 	vk::Library* createLibrary (void) const
73 	{
74 		return new VulkanLibrary();
75 	}
76 	// FINISHME: Query actual memory limits.
77 	//
78 	// These hard-coded memory limits were copied from tcuX11Platform.cpp,
79 	// and they work well enough for Intel platforms.
getMemoryLimits(vk::PlatformMemoryLimits & limits) const80 	void getMemoryLimits (vk::PlatformMemoryLimits& limits) const
81 	{
82 		limits.totalSystemMemory					= 256*1024*1024;
83 		limits.totalDeviceLocalMemory				= 128*1024*1024;
84 		limits.deviceMemoryAllocationGranularity	= 64*1024;
85 		limits.devicePageSize						= 4096;
86 		limits.devicePageTableEntrySize				= 8;
87 		limits.devicePageTableHierarchyLevels		= 3;
88 	}
89 
90 };
91 
92 } // nullws
93 } // tcu
94 
95 #endif // _TCUNULLWSPLATFORM_HPP
96