1*35238bceSAndroid Build Coastguard Worker /*-------------------------------------------------------------------------
2*35238bceSAndroid Build Coastguard Worker * drawElements Quality Program Tester Core
3*35238bceSAndroid Build Coastguard Worker * ----------------------------------------
4*35238bceSAndroid Build Coastguard Worker *
5*35238bceSAndroid Build Coastguard Worker * Copyright 2014 The Android Open Source Project
6*35238bceSAndroid Build Coastguard Worker *
7*35238bceSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
8*35238bceSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
9*35238bceSAndroid Build Coastguard Worker * You may obtain a copy of the License at
10*35238bceSAndroid Build Coastguard Worker *
11*35238bceSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0
12*35238bceSAndroid Build Coastguard Worker *
13*35238bceSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
14*35238bceSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
15*35238bceSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16*35238bceSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
17*35238bceSAndroid Build Coastguard Worker * limitations under the License.
18*35238bceSAndroid Build Coastguard Worker *
19*35238bceSAndroid Build Coastguard Worker *//*!
20*35238bceSAndroid Build Coastguard Worker * \file
21*35238bceSAndroid Build Coastguard Worker * \brief EGL native window abstraction
22*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
23*35238bceSAndroid Build Coastguard Worker
24*35238bceSAndroid Build Coastguard Worker #include "egluNativeWindow.hpp"
25*35238bceSAndroid Build Coastguard Worker
26*35238bceSAndroid Build Coastguard Worker namespace eglu
27*35238bceSAndroid Build Coastguard Worker {
28*35238bceSAndroid Build Coastguard Worker
29*35238bceSAndroid Build Coastguard Worker using namespace eglw;
30*35238bceSAndroid Build Coastguard Worker
31*35238bceSAndroid Build Coastguard Worker // NativeWindow
32*35238bceSAndroid Build Coastguard Worker
NativeWindow(Capability capabilities)33*35238bceSAndroid Build Coastguard Worker NativeWindow::NativeWindow(Capability capabilities) : m_capabilities(capabilities)
34*35238bceSAndroid Build Coastguard Worker {
35*35238bceSAndroid Build Coastguard Worker }
36*35238bceSAndroid Build Coastguard Worker
getLegacyNative(void)37*35238bceSAndroid Build Coastguard Worker EGLNativeWindowType NativeWindow::getLegacyNative(void)
38*35238bceSAndroid Build Coastguard Worker {
39*35238bceSAndroid Build Coastguard Worker TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_CREATE_SURFACE_LEGACY) == 0);
40*35238bceSAndroid Build Coastguard Worker throw tcu::NotSupportedError("eglu::NativeWindow doesn't support eglCreateWindowSurface()", DE_NULL, __FILE__,
41*35238bceSAndroid Build Coastguard Worker __LINE__);
42*35238bceSAndroid Build Coastguard Worker }
43*35238bceSAndroid Build Coastguard Worker
getPlatformExtension(void)44*35238bceSAndroid Build Coastguard Worker void *NativeWindow::getPlatformExtension(void)
45*35238bceSAndroid Build Coastguard Worker {
46*35238bceSAndroid Build Coastguard Worker TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_CREATE_SURFACE_PLATFORM_EXTENSION) == 0);
47*35238bceSAndroid Build Coastguard Worker throw tcu::NotSupportedError("eglu::NativeWindow doesn't support eglCreatePlatformWindowSurfaceEXT()", DE_NULL,
48*35238bceSAndroid Build Coastguard Worker __FILE__, __LINE__);
49*35238bceSAndroid Build Coastguard Worker }
50*35238bceSAndroid Build Coastguard Worker
getPlatformNative(void)51*35238bceSAndroid Build Coastguard Worker void *NativeWindow::getPlatformNative(void)
52*35238bceSAndroid Build Coastguard Worker {
53*35238bceSAndroid Build Coastguard Worker TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_CREATE_SURFACE_PLATFORM) == 0);
54*35238bceSAndroid Build Coastguard Worker throw tcu::NotSupportedError("eglu::NativeWindow doesn't support eglCreatePlatformWindowSurface()", DE_NULL,
55*35238bceSAndroid Build Coastguard Worker __FILE__, __LINE__);
56*35238bceSAndroid Build Coastguard Worker }
57*35238bceSAndroid Build Coastguard Worker
getSurfaceSize(void) const58*35238bceSAndroid Build Coastguard Worker tcu::IVec2 NativeWindow::getSurfaceSize(void) const
59*35238bceSAndroid Build Coastguard Worker {
60*35238bceSAndroid Build Coastguard Worker TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_GET_SURFACE_SIZE) == 0);
61*35238bceSAndroid Build Coastguard Worker throw tcu::NotSupportedError("eglu::NativeWindow doesn't support querying the surface size", DE_NULL, __FILE__,
62*35238bceSAndroid Build Coastguard Worker __LINE__);
63*35238bceSAndroid Build Coastguard Worker }
64*35238bceSAndroid Build Coastguard Worker
setSurfaceSize(tcu::IVec2 size)65*35238bceSAndroid Build Coastguard Worker void NativeWindow::setSurfaceSize(tcu::IVec2 size)
66*35238bceSAndroid Build Coastguard Worker {
67*35238bceSAndroid Build Coastguard Worker DE_UNREF(size);
68*35238bceSAndroid Build Coastguard Worker TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_SET_SURFACE_SIZE) == 0);
69*35238bceSAndroid Build Coastguard Worker throw tcu::NotSupportedError("eglu::NativeWindow doesn't support resizing the surface", DE_NULL, __FILE__,
70*35238bceSAndroid Build Coastguard Worker __LINE__);
71*35238bceSAndroid Build Coastguard Worker }
72*35238bceSAndroid Build Coastguard Worker
getScreenSize(void) const73*35238bceSAndroid Build Coastguard Worker tcu::IVec2 NativeWindow::getScreenSize(void) const
74*35238bceSAndroid Build Coastguard Worker {
75*35238bceSAndroid Build Coastguard Worker TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_GET_SCREEN_SIZE) == 0);
76*35238bceSAndroid Build Coastguard Worker throw tcu::NotSupportedError("eglu::NativeWindow doesn't support querying the size of the window on the screen",
77*35238bceSAndroid Build Coastguard Worker DE_NULL, __FILE__, __LINE__);
78*35238bceSAndroid Build Coastguard Worker }
79*35238bceSAndroid Build Coastguard Worker
readScreenPixels(tcu::TextureLevel *) const80*35238bceSAndroid Build Coastguard Worker void NativeWindow::readScreenPixels(tcu::TextureLevel *) const
81*35238bceSAndroid Build Coastguard Worker {
82*35238bceSAndroid Build Coastguard Worker TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_READ_SCREEN_PIXELS) == 0);
83*35238bceSAndroid Build Coastguard Worker throw tcu::NotSupportedError("eglu::NativeWindow doesn't support readScreenPixels", DE_NULL, __FILE__, __LINE__);
84*35238bceSAndroid Build Coastguard Worker }
85*35238bceSAndroid Build Coastguard Worker
setVisibility(WindowParams::Visibility visibility)86*35238bceSAndroid Build Coastguard Worker void NativeWindow::setVisibility(WindowParams::Visibility visibility)
87*35238bceSAndroid Build Coastguard Worker {
88*35238bceSAndroid Build Coastguard Worker DE_UNREF(visibility);
89*35238bceSAndroid Build Coastguard Worker TCU_CHECK_INTERNAL((m_capabilities & CAPABILITY_CHANGE_VISIBILITY) == 0);
90*35238bceSAndroid Build Coastguard Worker throw tcu::NotSupportedError("eglu::NativeWindow doesn't support changing visibility", DE_NULL, __FILE__, __LINE__);
91*35238bceSAndroid Build Coastguard Worker }
92*35238bceSAndroid Build Coastguard Worker
93*35238bceSAndroid Build Coastguard Worker // NativeWindowFactory
94*35238bceSAndroid Build Coastguard Worker
NativeWindowFactory(const std::string & name,const std::string & description,NativeWindow::Capability capabilities)95*35238bceSAndroid Build Coastguard Worker NativeWindowFactory::NativeWindowFactory(const std::string &name, const std::string &description,
96*35238bceSAndroid Build Coastguard Worker NativeWindow::Capability capabilities)
97*35238bceSAndroid Build Coastguard Worker : FactoryBase(name, description)
98*35238bceSAndroid Build Coastguard Worker , m_capabilities(capabilities)
99*35238bceSAndroid Build Coastguard Worker {
100*35238bceSAndroid Build Coastguard Worker }
101*35238bceSAndroid Build Coastguard Worker
~NativeWindowFactory(void)102*35238bceSAndroid Build Coastguard Worker NativeWindowFactory::~NativeWindowFactory(void)
103*35238bceSAndroid Build Coastguard Worker {
104*35238bceSAndroid Build Coastguard Worker }
105*35238bceSAndroid Build Coastguard Worker
createWindow(NativeDisplay * nativeDisplay,EGLDisplay display,EGLConfig config,const EGLAttrib * attribList,const WindowParams & params) const106*35238bceSAndroid Build Coastguard Worker NativeWindow *NativeWindowFactory::createWindow(NativeDisplay *nativeDisplay, EGLDisplay display, EGLConfig config,
107*35238bceSAndroid Build Coastguard Worker const EGLAttrib *attribList, const WindowParams ¶ms) const
108*35238bceSAndroid Build Coastguard Worker {
109*35238bceSAndroid Build Coastguard Worker DE_UNREF(display && config && attribList);
110*35238bceSAndroid Build Coastguard Worker return createWindow(nativeDisplay, params);
111*35238bceSAndroid Build Coastguard Worker }
112*35238bceSAndroid Build Coastguard Worker
113*35238bceSAndroid Build Coastguard Worker } // namespace eglu
114