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 #include "eglwEnums.hpp"
     26 
     27 namespace eglu
     28 {
     29 
     30 using namespace eglw;
     31 
     32 // NativeDisplay
     33 
     34 NativeDisplay::NativeDisplay (Capability capabilities, EGLenum platformType, const char* platformExtension)
     35 	: m_capabilities		(capabilities)
     36 	, m_platformType		(platformType)
     37 	, m_platformExtension	(platformExtension)
     38 {
     39 	DE_ASSERT(platformType != EGL_NONE && platformExtension);
     40 	DE_ASSERT(capabilities & CAPABILITY_GET_DISPLAY_PLATFORM);
     41 }
     42 
     43 NativeDisplay::NativeDisplay (Capability capabilities)
     44 	: m_capabilities		(capabilities)
     45 	, m_platformType		(EGL_NONE)
     46 	, m_platformExtension	("")
     47 {
     48 	DE_ASSERT(!(capabilities & CAPABILITY_GET_DISPLAY_PLATFORM));
     49 	DE_ASSERT(capabilities & CAPABILITY_GET_DISPLAY_LEGACY);
     50 }
     51 
     52 NativeDisplay::~NativeDisplay (void)
     53 {
     54 }
     55 
     56 EGLNativeDisplayType NativeDisplay::getLegacyNative (void)
     57 {
     58 	TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_GET_DISPLAY_LEGACY) == 0);
     59 	throw tcu::NotSupportedError("eglu::NativeDisplay can't be used with eglGetDisplay()", DE_NULL, __FILE__, __LINE__);
     60 }
     61 
     62 void* NativeDisplay::getPlatformNative (void)
     63 {
     64 	TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_GET_DISPLAY_PLATFORM) == 0);
     65 	throw tcu::NotSupportedError("eglu::NativeDisplay can't be used with eglGetPlatformDisplay()", DE_NULL, __FILE__, __LINE__);
     66 }
     67 
     68 const EGLAttrib* NativeDisplay::getPlatformAttributes (void) const
     69 {
     70 	TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_GET_DISPLAY_PLATFORM) == 0);
     71 	return DE_NULL;
     72 }
     73 
     74 // NativeDisplayFactory
     75 
     76 NativeDisplayFactory::NativeDisplayFactory (const std::string& name, const std::string& description, NativeDisplay::Capability capabilities, EGLenum platformType, const char* platformExtension)
     77 	: FactoryBase			(name, description)
     78 	, m_capabilities		(capabilities)
     79 	, m_platformType		(platformType)
     80 	, m_platformExtension	(platformExtension)
     81 {
     82 	DE_ASSERT(platformType != EGL_NONE && platformExtension);
     83 	DE_ASSERT(capabilities & NativeDisplay::CAPABILITY_GET_DISPLAY_PLATFORM);
     84 }
     85 
     86 NativeDisplayFactory::NativeDisplayFactory (const std::string& name, const std::string& description, NativeDisplay::Capability capabilities)
     87 	: FactoryBase			(name, description)
     88 	, m_capabilities		(capabilities)
     89 	, m_platformType		(EGL_NONE)
     90 	, m_platformExtension	("")
     91 {
     92 	DE_ASSERT(!(capabilities & NativeDisplay::CAPABILITY_GET_DISPLAY_PLATFORM));
     93 	DE_ASSERT(capabilities & NativeDisplay::CAPABILITY_GET_DISPLAY_LEGACY);
     94 }
     95 
     96 NativeDisplayFactory::~NativeDisplayFactory (void)
     97 {
     98 }
     99 
    100 } // eglu
    101