Home | History | Annotate | Download | only in wayland
      1 /*-------------------------------------------------------------------------
      2  * drawElements Quality Program Tester Core
      3  * ----------------------------------------
      4  *
      5  * Copyright (c) 2014 The Android Open Source Project
      6  * Copyright (c) 2016 The Khronos Group Inc.
      7  * Copyright (c) 2016 Mun Gwan-gyeong <elongbug (at) gmail.com>
      8  *
      9  * Licensed under the Apache License, Version 2.0 (the "License");
     10  * you may not use this file except in compliance with the License.
     11  * You may obtain a copy of the License at
     12  *
     13  *      http://www.apache.org/licenses/LICENSE-2.0
     14  *
     15  * Unless required by applicable law or agreed to in writing, software
     16  * distributed under the License is distributed on an "AS IS" BASIS,
     17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     18  * See the License for the specific language governing permissions and
     19  * limitations under the License.
     20  *
     21  *//*!
     22  * \file
     23  * \brief wayland Platform.
     24  *//*--------------------------------------------------------------------*/
     25 
     26 #include "tcuWaylandPlatform.hpp"
     27 #include "tcuWaylandEglPlatform.hpp"
     28 
     29 #include "deUniquePtr.hpp"
     30 #include "gluPlatform.hpp"
     31 #include "vkPlatform.hpp"
     32 #include "tcuWayland.hpp"
     33 #include "tcuWaylandVulkanPlatform.hpp"
     34 #include "tcuFunctionLibrary.hpp"
     35 #include "deMemory.h"
     36 
     37 #include <sys/utsname.h>
     38 
     39 namespace tcu
     40 {
     41 namespace wayland
     42 {
     43 
     44 class WaylandGLPlatform : public glu::Platform
     45 {
     46 public:
     47 	void		registerFactory	(de::MovePtr<glu::ContextFactory> factory)
     48 	{
     49 		m_contextFactoryRegistry.registerFactory(factory.release());
     50 	}
     51 };
     52 
     53 class WaylandPlatform : public tcu::Platform
     54 {
     55 public:
     56 							WaylandPlatform	(void);
     57 	bool					processEvents	(void) { return !m_eventState.getQuitFlag(); }
     58 	const glu::Platform&	getGLPlatform	(void) const { return m_glPlatform; }
     59 	const eglu::Platform&	getEGLPlatform	(void) const { return m_eglPlatform; }
     60 	const vk::Platform&		getVulkanPlatform	(void) const { return m_vkPlatform; }
     61 
     62 
     63 private:
     64 	EventState				m_eventState;
     65 	wayland::egl::Platform	m_eglPlatform;
     66 	WaylandGLPlatform		m_glPlatform;
     67 	WaylandVulkanPlatform	m_vkPlatform;
     68 };
     69 
     70 WaylandPlatform::WaylandPlatform (void)
     71 	: m_eglPlatform	(m_eventState)
     72 	, m_vkPlatform	(m_eventState)
     73 {
     74 	m_glPlatform.registerFactory(m_eglPlatform.createContextFactory());
     75 }
     76 
     77 } // wayland
     78 } // tcu
     79 
     80 tcu::Platform* createPlatform (void)
     81 {
     82 	return new tcu::wayland::WaylandPlatform();
     83 }
     84