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 // If NativeDisplay claims to support CAPABILITY_GET_DISPLAY_LEGACY then
59 // this method must be implemented.
60 TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_GET_DISPLAY_LEGACY) == 0);
61 TCU_THROW(NotSupportedError, "eglu::NativeDisplay can't be used with eglGetDisplay()");
64 void* NativeDisplay::getPlatformNative (void)
66 // If NativeDisplay claims to support CAPABILITY_GET_DISPLAY_PLATFORM then
67 // this method must be implemented.
68 TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_GET_DISPLAY_PLATFORM) == 0);
69 TCU_THROW(NotSupportedError, "eglu::NativeDisplay can't be used with eglGetPlatformDisplay()");
72 const EGLAttrib* NativeDisplay::getPlatformAttributes (void) const
74 // If NativeDisplay claims to support CAPABILITY_GET_DISPLAY_PLATFORM then
75 // this method must be implemented.
76 TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_GET_DISPLAY_PLATFORM) == 0);
77 TCU_THROW(NotSupportedError, "eglu::NativeDisplay can't be used with eglGetPlatformDisplay()");
80 // NativeDisplayFactory
82 NativeDisplayFactory::NativeDisplayFactory (const std::string& name, const std::string& description, NativeDisplay::Capability capabilities, EGLenum platformType, const char* platformExtension)
83 : FactoryBase (name, description)
84 , m_capabilities (capabilities)
85 , m_platformType (platformType)
86 , m_platformExtension (platformExtension)
88 DE_ASSERT(platformType != EGL_NONE && platformExtension);
89 DE_ASSERT(capabilities & NativeDisplay::CAPABILITY_GET_DISPLAY_PLATFORM);
92 NativeDisplayFactory::NativeDisplayFactory (const std::string& name, const std::string& description, NativeDisplay::Capability capabilities)
93 : FactoryBase (name, description)
94 , m_capabilities (capabilities)
95 , m_platformType (EGL_NONE)
96 , m_platformExtension ("")
98 DE_ASSERT(!(capabilities & NativeDisplay::CAPABILITY_GET_DISPLAY_PLATFORM));
99 DE_ASSERT(capabilities & NativeDisplay::CAPABILITY_GET_DISPLAY_LEGACY);
102 NativeDisplayFactory::~NativeDisplayFactory (void)