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 EGL native display abstraction
22 *//*--------------------------------------------------------------------*/
24 #include "egluNativeDisplay.hpp"
25 #include "eglwEnums.hpp"
34 NativeDisplay::NativeDisplay (Capability capabilities, EGLenum platformType, const char* platformExtension)
35 : m_capabilities (capabilities)
36 , m_platformType (platformType)
37 , m_platformExtension (platformExtension)
39 DE_ASSERT(platformType != EGL_NONE && platformExtension);
40 DE_ASSERT(capabilities & CAPABILITY_GET_DISPLAY_PLATFORM);
43 NativeDisplay::NativeDisplay (Capability capabilities)
44 : m_capabilities (capabilities)
45 , m_platformType (EGL_NONE)
46 , m_platformExtension ("")
48 DE_ASSERT(!(capabilities & CAPABILITY_GET_DISPLAY_PLATFORM));
49 DE_ASSERT(capabilities & CAPABILITY_GET_DISPLAY_LEGACY);
52 NativeDisplay::~NativeDisplay (void)
56 EGLNativeDisplayType NativeDisplay::getLegacyNative (void)
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__);
62 void* NativeDisplay::getPlatformNative (void)
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__);
68 const EGLAttrib* NativeDisplay::getPlatformAttributes (void) const
70 TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_GET_DISPLAY_PLATFORM) == 0);
74 // NativeDisplayFactory
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)
82 DE_ASSERT(platformType != EGL_NONE && platformExtension);
83 DE_ASSERT(capabilities & NativeDisplay::CAPABILITY_GET_DISPLAY_PLATFORM);
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 ("")
92 DE_ASSERT(!(capabilities & NativeDisplay::CAPABILITY_GET_DISPLAY_PLATFORM));
93 DE_ASSERT(capabilities & NativeDisplay::CAPABILITY_GET_DISPLAY_LEGACY);
96 NativeDisplayFactory::~NativeDisplayFactory (void)