Home | History | Annotate | Download | only in egl
      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 
     36 namespace tcu
     37 {
     38 class CommandLine;
     39 }
     40 
     41 namespace eglw
     42 {
     43 class Library;
     44 }
     45 
     46 namespace eglu
     47 {
     48 
     49 class NativePixmapFactory;
     50 class NativePixmap;
     51 class FilterList;
     52 
     53 typedef std::map<eglw::EGLint, eglw::EGLint> AttribMap;
     54 
     55 std::vector<eglw::EGLint>		attribMapToList				(const AttribMap& map);
     56 
     57 Version							getVersion					(const eglw::Library& egl, eglw::EGLDisplay display);
     58 
     59 std::vector<std::string>		getClientExtensions			(const eglw::Library& egl);
     60 std::vector<std::string>		getDisplayExtensions		(const eglw::Library& egl, eglw::EGLDisplay display);
     61 bool							hasExtension				(const eglw::Library& egl, eglw::EGLDisplay display, const std::string& extName);
     62 
     63 std::vector<eglw::EGLConfig>	getConfigs					(const eglw::Library& egl, eglw::EGLDisplay display);
     64 std::vector<eglw::EGLConfig>	chooseConfigs				(const eglw::Library& egl, eglw::EGLDisplay display, const AttribMap& attribs);
     65 std::vector<eglw::EGLConfig>	chooseConfigs				(const eglw::Library& egl, eglw::EGLDisplay display, const FilterList& filters);
     66 std::vector<eglw::EGLConfig>	chooseConfigs				(const eglw::Library& egl, eglw::EGLDisplay display, const eglw::EGLint* attribs);
     67 eglw::EGLConfig					chooseSingleConfig			(const eglw::Library& egl, eglw::EGLDisplay display, const AttribMap& attribs);
     68 eglw::EGLConfig					chooseSingleConfig			(const eglw::Library& egl, eglw::EGLDisplay display, const eglw::EGLint* attribs);
     69 eglw::EGLConfig					chooseSingleConfig			(const eglw::Library& egl, eglw::EGLDisplay display, const FilterList& filters);
     70 eglw::EGLConfig					chooseConfigByID			(const eglw::Library& egl, eglw::EGLDisplay display, eglw::EGLint id);
     71 eglw::EGLint					getConfigAttribInt			(const eglw::Library& egl, eglw::EGLDisplay display, eglw::EGLConfig config, eglw::EGLint attrib);
     72 eglw::EGLint					getConfigID					(const eglw::Library& egl, eglw::EGLDisplay display, eglw::EGLConfig config);
     73 
     74 eglw::EGLint					querySurfaceInt				(const eglw::Library& egl, eglw::EGLDisplay display, eglw::EGLSurface surface, eglw::EGLint attrib);
     75 tcu::IVec2						getSurfaceSize				(const eglw::Library& egl, eglw::EGLDisplay display, eglw::EGLSurface surface);
     76 tcu::IVec2						getSurfaceResolution		(const eglw::Library& egl, eglw::EGLDisplay display, eglw::EGLSurface surface);
     77 
     78 eglw::EGLDisplay				getDisplay					(NativeDisplay& nativeDisplay);
     79 eglw::EGLDisplay				getAndInitDisplay			(NativeDisplay& nativeDisplay, Version* version = DE_NULL);
     80 eglw::EGLSurface				createWindowSurface			(NativeDisplay& nativeDisplay, NativeWindow& window, eglw::EGLDisplay display, eglw::EGLConfig config, const eglw::EGLAttrib* attribList);
     81 eglw::EGLSurface				createPixmapSurface			(NativeDisplay& nativeDisplay, NativePixmap& pixmap, eglw::EGLDisplay display, eglw::EGLConfig config, const eglw::EGLAttrib* attribList);
     82 
     83 const NativeDisplayFactory&		selectNativeDisplayFactory	(const NativeDisplayFactoryRegistry& registry, const tcu::CommandLine& cmdLine);
     84 const NativeWindowFactory&		selectNativeWindowFactory	(const NativeDisplayFactory& factory, const tcu::CommandLine& cmdLine);
     85 const NativePixmapFactory&		selectNativePixmapFactory	(const NativeDisplayFactory& factory, const tcu::CommandLine& cmdLine);
     86 
     87 WindowParams::Visibility		parseWindowVisibility		(const tcu::CommandLine& commandLine);
     88 eglw::EGLenum					parseClientAPI				(const std::string& api);
     89 std::vector<eglw::EGLenum>		parseClientAPIs				(const std::string& apiList);
     90 std::vector<eglw::EGLenum>		getClientAPIs				(const eglw::Library& egl, eglw::EGLDisplay display);
     91 
     92 eglw::EGLint					getRenderableAPIsMask		(const eglw::Library& egl, eglw::EGLDisplay display);
     93 
     94 std::vector<eglw::EGLint>		toLegacyAttribList			(const eglw::EGLAttrib* attribs);
     95 
     96 } // eglu
     97 
     98 #endif // _EGLUUTIL_HPP
     99