1#ifndef _EGLUUTIL_HPP
2#define _EGLUUTIL_HPP
3/*-------------------------------------------------------------------------
4 * drawElements Quality Program Tester Core
5 * ----------------------------------------
6 *
7 * Copyright 2014 The Android Open Source Project
8 *
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
12 *
13 *      http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 *
21 *//*!
22 * \file
23 * \brief EGL utilities
24 *//*--------------------------------------------------------------------*/
25
26#include "tcuDefs.hpp"
27#include "egluDefs.hpp"
28#include "egluNativeWindow.hpp"
29#include "egluNativeDisplay.hpp"
30#include "eglwDefs.hpp"
31
32#include <vector>
33#include <map>
34#include <string>
35
36namespace tcu
37{
38class CommandLine;
39}
40
41namespace eglw
42{
43class Library;
44}
45
46namespace eglu
47{
48
49class NativePixmapFactory;
50class NativePixmap;
51class FilterList;
52
53typedef std::map<eglw::EGLint, eglw::EGLint> AttribMap;
54
55std::vector<eglw::EGLint>		attribMapToList				(const AttribMap& map);
56
57Version							getVersion					(const eglw::Library& egl, eglw::EGLDisplay display);
58
59std::vector<std::string>		getPlatformExtensions		(const eglw::Library& egl);
60std::vector<std::string>		getClientExtensions			(const eglw::Library& egl, eglw::EGLDisplay display);
61bool							hasExtension				(const eglw::Library& egl, eglw::EGLDisplay display, const std::string& extName);
62
63std::vector<eglw::EGLConfig>	getConfigs					(const eglw::Library& egl, eglw::EGLDisplay display);
64std::vector<eglw::EGLConfig>	chooseConfigs				(const eglw::Library& egl, eglw::EGLDisplay display, const AttribMap& attribs);
65std::vector<eglw::EGLConfig>	chooseConfigs				(const eglw::Library& egl, eglw::EGLDisplay display, const FilterList& filters);
66std::vector<eglw::EGLConfig>	chooseConfigs				(const eglw::Library& egl, eglw::EGLDisplay display, const eglw::EGLint* attribs);
67eglw::EGLConfig					chooseSingleConfig			(const eglw::Library& egl, eglw::EGLDisplay display, const AttribMap& attribs);
68eglw::EGLConfig					chooseSingleConfig			(const eglw::Library& egl, eglw::EGLDisplay display, const eglw::EGLint* attribs);
69eglw::EGLConfig					chooseSingleConfig			(const eglw::Library& egl, eglw::EGLDisplay display, const FilterList& filters);
70eglw::EGLConfig					chooseConfigByID			(const eglw::Library& egl, eglw::EGLDisplay display, eglw::EGLint id);
71eglw::EGLint					getConfigAttribInt			(const eglw::Library& egl, eglw::EGLDisplay display, eglw::EGLConfig config, eglw::EGLint attrib);
72eglw::EGLint					getConfigID					(const eglw::Library& egl, eglw::EGLDisplay display, eglw::EGLConfig config);
73
74eglw::EGLint					querySurfaceInt				(const eglw::Library& egl, eglw::EGLDisplay display, eglw::EGLSurface surface, eglw::EGLint attrib);
75tcu::IVec2						getSurfaceSize				(const eglw::Library& egl, eglw::EGLDisplay display, eglw::EGLSurface surface);
76tcu::IVec2						getSurfaceResolution		(const eglw::Library& egl, eglw::EGLDisplay display, eglw::EGLSurface surface);
77
78eglw::EGLDisplay				getDisplay					(NativeDisplay& nativeDisplay);
79eglw::EGLDisplay				getAndInitDisplay			(NativeDisplay& nativeDisplay, Version* version = DE_NULL);
80eglw::EGLSurface				createWindowSurface			(NativeDisplay& nativeDisplay, NativeWindow& window, eglw::EGLDisplay display, eglw::EGLConfig config, const eglw::EGLAttrib* attribList);
81eglw::EGLSurface				createPixmapSurface			(NativeDisplay& nativeDisplay, NativePixmap& pixmap, eglw::EGLDisplay display, eglw::EGLConfig config, const eglw::EGLAttrib* attribList);
82
83const NativeDisplayFactory&		selectNativeDisplayFactory	(const NativeDisplayFactoryRegistry& registry, const tcu::CommandLine& cmdLine);
84const NativeWindowFactory&		selectNativeWindowFactory	(const NativeDisplayFactory& factory, const tcu::CommandLine& cmdLine);
85const NativePixmapFactory&		selectNativePixmapFactory	(const NativeDisplayFactory& factory, const tcu::CommandLine& cmdLine);
86
87WindowParams::Visibility		parseWindowVisibility		(const tcu::CommandLine& commandLine);
88eglw::EGLenum					parseClientAPI				(const std::string& api);
89std::vector<eglw::EGLenum>		parseClientAPIs				(const std::string& apiList);
90std::vector<eglw::EGLenum>		getClientAPIs				(const eglw::Library& egl, eglw::EGLDisplay display);
91
92eglw::EGLint					getRenderableAPIsMask		(const eglw::Library& egl, eglw::EGLDisplay display);
93
94std::vector<eglw::EGLint>		toLegacyAttribList			(const eglw::EGLAttrib* attribs);
95
96} // eglu
97
98#endif // _EGLUUTIL_HPP
99