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, 65 const AttribMap &attribs); 66 std::vector<eglw::EGLConfig> chooseConfigs(const eglw::Library &egl, eglw::EGLDisplay display, 67 const FilterList &filters); 68 std::vector<eglw::EGLConfig> chooseConfigs(const eglw::Library &egl, eglw::EGLDisplay display, 69 const eglw::EGLint *attribs); 70 eglw::EGLConfig chooseSingleConfig(const eglw::Library &egl, eglw::EGLDisplay display, const AttribMap &attribs); 71 eglw::EGLConfig chooseSingleConfig(const eglw::Library &egl, eglw::EGLDisplay display, const eglw::EGLint *attribs); 72 eglw::EGLConfig chooseSingleConfig(const eglw::Library &egl, eglw::EGLDisplay display, const FilterList &filters); 73 eglw::EGLConfig chooseConfigByID(const eglw::Library &egl, eglw::EGLDisplay display, eglw::EGLint id); 74 eglw::EGLint getConfigAttribInt(const eglw::Library &egl, eglw::EGLDisplay display, eglw::EGLConfig config, 75 eglw::EGLint attrib); 76 eglw::EGLint getConfigID(const eglw::Library &egl, eglw::EGLDisplay display, eglw::EGLConfig config); 77 78 eglw::EGLint querySurfaceInt(const eglw::Library &egl, eglw::EGLDisplay display, eglw::EGLSurface surface, 79 eglw::EGLint attrib); 80 tcu::IVec2 getSurfaceSize(const eglw::Library &egl, eglw::EGLDisplay display, eglw::EGLSurface surface); 81 tcu::IVec2 getSurfaceResolution(const eglw::Library &egl, eglw::EGLDisplay display, eglw::EGLSurface surface); 82 83 eglw::EGLDisplay getDisplay(NativeDisplay &nativeDisplay); 84 eglw::EGLDisplay getAndInitDisplay(NativeDisplay &nativeDisplay, Version *version = DE_NULL); 85 void terminateDisplay(const eglw::Library &egl, eglw::EGLDisplay display); 86 eglw::EGLSurface createWindowSurface(NativeDisplay &nativeDisplay, NativeWindow &window, eglw::EGLDisplay display, 87 eglw::EGLConfig config, const eglw::EGLAttrib *attribList); 88 eglw::EGLSurface createPixmapSurface(NativeDisplay &nativeDisplay, NativePixmap &pixmap, eglw::EGLDisplay display, 89 eglw::EGLConfig config, const eglw::EGLAttrib *attribList); 90 91 const NativeDisplayFactory &selectNativeDisplayFactory(const NativeDisplayFactoryRegistry ®istry, 92 const tcu::CommandLine &cmdLine); 93 const NativeWindowFactory &selectNativeWindowFactory(const NativeDisplayFactory &factory, 94 const tcu::CommandLine &cmdLine); 95 const NativePixmapFactory &selectNativePixmapFactory(const NativeDisplayFactory &factory, 96 const tcu::CommandLine &cmdLine); 97 98 WindowParams::Visibility parseWindowVisibility(const tcu::CommandLine &commandLine); 99 eglw::EGLenum parseClientAPI(const std::string &api); 100 std::vector<eglw::EGLenum> parseClientAPIs(const std::string &apiList); 101 std::vector<eglw::EGLenum> getClientAPIs(const eglw::Library &egl, eglw::EGLDisplay display); 102 103 eglw::EGLint getRenderableAPIsMask(const eglw::Library &egl, eglw::EGLDisplay display); 104 105 std::vector<eglw::EGLint> toLegacyAttribList(const eglw::EGLAttrib *attribs); 106 107 } // namespace eglu 108 109 #endif // _EGLUUTIL_HPP 110