1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program Tester Core
3 * ----------------------------------------
5 * Copyright 2014 The Android Open Source Project
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 * \brief Win32 platform port.
22 *//*--------------------------------------------------------------------*/
24 #include "tcuWin32Platform.hpp"
25 #include "tcuWGLContextFactory.hpp"
26 #include "tcuFunctionLibrary.hpp"
28 #if defined(DEQP_SUPPORT_EGL)
29 # include "tcuWin32EGLNativeDisplayFactory.hpp"
30 # include "egluGLContextFactory.hpp"
36 class VulkanLibrary : public vk::Library
40 : m_library ("vulkan-1.dll")
41 , m_driver (m_library)
45 const vk::PlatformInterface& getPlatformInterface (void) const
51 const tcu::DynamicFunctionLibrary m_library;
52 const vk::PlatformDriver m_driver;
55 Win32Platform::Win32Platform (void)
56 : m_instance(GetModuleHandle(NULL))
58 // Set process priority to lower.
59 SetPriorityClass(GetCurrentProcess(), BELOW_NORMAL_PRIORITY_CLASS);
62 WGLContextFactory* factory = DE_NULL;
66 factory = new WGLContextFactory(m_instance);
68 catch (const std::exception& e)
70 print("Warning: WGL not supported: %s\n", e.what());
77 m_contextFactoryRegistry.registerFactory(factory);
87 #if defined(DEQP_SUPPORT_EGL)
88 m_nativeDisplayFactoryRegistry.registerFactory(new Win32EGLNativeDisplayFactory(m_instance));
89 m_contextFactoryRegistry.registerFactory(new eglu::GLContextFactory(m_nativeDisplayFactoryRegistry));
93 Win32Platform::~Win32Platform (void)
97 bool Win32Platform::processEvents (void)
100 while (PeekMessage(&msg, (HWND)-1, 0, 0, PM_REMOVE))
102 DispatchMessage(&msg);
103 if (msg.message == WM_QUIT)
109 vk::Library* Win32Platform::createLibrary (void) const
111 return new VulkanLibrary();
117 tcu::Platform* createPlatform (void)
119 return new tcu::Win32Platform();