Home | History | Annotate | Download | only in egl
      1 /*-------------------------------------------------------------------------
      2  * drawElements Quality Program Tester Core
      3  * ----------------------------------------
      4  *
      5  * Copyright 2014 The Android Open Source Project
      6  *
      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
     10  *
     11  *      http://www.apache.org/licenses/LICENSE-2.0
     12  *
     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.
     18  *
     19  *//*!
     20  * \file
     21  * \brief EGL native display abstraction
     22  *//*--------------------------------------------------------------------*/
     23 
     24 #include "egluNativeDisplay.hpp"
     25 
     26 namespace eglu
     27 {
     28 
     29 // NativeDisplay
     30 
     31 NativeDisplay::NativeDisplay (Capability capabilities, EGLenum platformType, const char* platformExtension)
     32 	: m_capabilities		(capabilities)
     33 	, m_platformType		(platformType)
     34 	, m_platformExtension	(platformExtension)
     35 {
     36 	DE_ASSERT(platformType != EGL_NONE && platformExtension);
     37 	DE_ASSERT(capabilities & CAPABILITY_GET_DISPLAY_PLATFORM);
     38 }
     39 
     40 NativeDisplay::NativeDisplay (Capability capabilities)
     41 	: m_capabilities		(capabilities)
     42 	, m_platformType		(EGL_NONE)
     43 	, m_platformExtension	("")
     44 {
     45 	DE_ASSERT(!(capabilities & CAPABILITY_GET_DISPLAY_PLATFORM));
     46 	DE_ASSERT(capabilities & CAPABILITY_GET_DISPLAY_LEGACY);
     47 }
     48 
     49 NativeDisplay::~NativeDisplay (void)
     50 {
     51 }
     52 
     53 EGLNativeDisplayType NativeDisplay::getLegacyNative (void)
     54 {
     55 	TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_GET_DISPLAY_LEGACY) == 0);
     56 	throw tcu::NotSupportedError("eglu::NativeDisplay can't be used with eglGetDisplay()", DE_NULL, __FILE__, __LINE__);
     57 }
     58 
     59 void* NativeDisplay::getPlatformNative (void)
     60 {
     61 	TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_GET_DISPLAY_PLATFORM) == 0);
     62 	throw tcu::NotSupportedError("eglu::NativeDisplay can't be used with eglGetPlatformDisplay()", DE_NULL, __FILE__, __LINE__);
     63 }
     64 
     65 // NativeDisplayFactory
     66 
     67 NativeDisplayFactory::NativeDisplayFactory (const std::string& name, const std::string& description, NativeDisplay::Capability capabilities, EGLenum platformType, const char* platformExtension)
     68 	: FactoryBase			(name, description)
     69 	, m_capabilities		(capabilities)
     70 	, m_platformType		(platformType)
     71 	, m_platformExtension	(platformExtension)
     72 {
     73 	DE_ASSERT(platformType != EGL_NONE && platformExtension);
     74 	DE_ASSERT(capabilities & NativeDisplay::CAPABILITY_GET_DISPLAY_PLATFORM);
     75 }
     76 
     77 NativeDisplayFactory::NativeDisplayFactory (const std::string& name, const std::string& description, NativeDisplay::Capability capabilities)
     78 	: FactoryBase			(name, description)
     79 	, m_capabilities		(capabilities)
     80 	, m_platformType		(EGL_NONE)
     81 	, m_platformExtension	("")
     82 {
     83 	DE_ASSERT(!(capabilities & NativeDisplay::CAPABILITY_GET_DISPLAY_PLATFORM));
     84 	DE_ASSERT(capabilities & NativeDisplay::CAPABILITY_GET_DISPLAY_LEGACY);
     85 }
     86 
     87 NativeDisplayFactory::~NativeDisplayFactory (void)
     88 {
     89 }
     90 
     91 } // eglu
     92