• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*-------------------------------------------------------------------------
2  * OpenGL Conformance Test Suite
3  * -----------------------------
4  *
5  * Copyright (c) 2016 Google Inc.
6  * Copyright (c) 2016 The Khronos Group Inc.
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  *//*!
21  * \file
22  * \brief
23  *//*--------------------------------------------------------------------*/
24 
25 #include "tcuNullWSPlatform.hpp"
26 #include "eglwEnums.hpp"
27 #include "eglwLibrary.hpp"
28 #include "egluGLContextFactory.hpp"
29 
30 namespace tcu
31 {
32 namespace nullws
33 {
34 
35 class Window: public eglu::NativeWindow
36 {
37 public:
38 	static const Capability CAPABILITIES = CAPABILITY_CREATE_SURFACE_LEGACY;
39 
Window(eglu::NativeDisplay * nativeDisplay,const eglu::WindowParams & params)40 	Window(eglu::NativeDisplay* nativeDisplay, const eglu::WindowParams& params)
41 		: NativeWindow(CAPABILITIES)
42 	{
43 	}
44 
getLegacyNative()45 	eglw::EGLNativeWindowType getLegacyNative ()
46 	{
47 		return DE_NULL;
48 	}
49 };
50 
51 class WindowFactory: public eglu::NativeWindowFactory
52 {
53 public:
WindowFactory()54 	WindowFactory()
55 		: NativeWindowFactory("nullws", "NullWS Window", Window::CAPABILITIES)
56 	{
57 	}
58 
createWindow(eglu::NativeDisplay * nativeDisplay,const eglu::WindowParams & params) const59 	eglu::NativeWindow* createWindow(eglu::NativeDisplay* nativeDisplay, const eglu::WindowParams& params) const
60 	{
61 		return new Window(nativeDisplay, params);
62 	}
63 };
64 
65 class Pixmap: public eglu::NativePixmap
66 {
67 public:
68 	static const Capability CAPABILITIES = CAPABILITY_CREATE_SURFACE_LEGACY;
69 
Pixmap()70 	Pixmap()
71 		: NativePixmap(CAPABILITIES)
72 	{
73 	}
74 
getLegacyNative()75 	eglw::EGLNativePixmapType getLegacyNative ()
76 	{
77 		return DE_NULL;
78 	}
79 };
80 
81 class PixmapFactory: public eglu::NativePixmapFactory
82 {
83 public:
PixmapFactory()84 	PixmapFactory()
85 		: NativePixmapFactory("nullws", "NullWS Pixmap", Pixmap::CAPABILITIES)
86 	{
87 	}
88 
createPixmap(eglu::NativeDisplay *,int,int) const89 	eglu::NativePixmap* createPixmap (eglu::NativeDisplay*, int, int) const
90 	{
91 		return new Pixmap();
92 	}
93 };
94 
95 class Display: public eglu::NativeDisplay
96 {
97 public:
98 	static const Capability CAPABILITIES = CAPABILITY_GET_DISPLAY_LEGACY;
99 
Display()100 	Display()
101 		: eglu::NativeDisplay(CAPABILITIES)
102 	{
103 	}
104 
getLegacyNative()105 	eglw::EGLNativeDisplayType getLegacyNative()
106 	{
107 		return EGL_DEFAULT_DISPLAY;
108 	}
109 
getLibrary() const110 	const eglw::Library& getLibrary() const
111 	{
112 		return m_library;
113 	}
114 
115 private:
116 	eglw::DefaultLibrary m_library;
117 };
118 
119 
120 class DisplayFactory: public eglu::NativeDisplayFactory
121 {
122 public:
DisplayFactory()123 	DisplayFactory()
124 		: eglu::NativeDisplayFactory ("nullws", "NullWS Display", Display::CAPABILITIES)
125 	{
126 		m_nativeWindowRegistry.registerFactory(new WindowFactory());
127 		m_nativePixmapRegistry.registerFactory(new PixmapFactory());
128 	}
129 
createDisplay(const eglw::EGLAttrib * attribList=DE_NULL) const130 	eglu::NativeDisplay* createDisplay (const eglw::EGLAttrib* attribList = DE_NULL) const
131 	{
132 		return new Display();
133 	}
134 };
135 
Platform()136 Platform::Platform ()
137 {
138 	m_nativeDisplayFactoryRegistry.registerFactory(new DisplayFactory());
139 	m_contextFactoryRegistry.registerFactory(new eglu::GLContextFactory(m_nativeDisplayFactoryRegistry));
140 }
141 
~Platform()142 Platform::~Platform ()
143 {
144 }
145 
146 } // nullws
147 } // tcu
148 
createPlatform()149 tcu::Platform* createPlatform ()
150 {
151 	return new tcu::nullws::Platform();
152 }
153