glx-multithread-texture: Avoid front-buffer rendering.
[piglit.git] / tests / util / piglit-util-egl.h
blob9f8e10822b8be660dd607749e46ed44497b26a99
1 /*
2 * Copyright (c) Intel 2011
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21 * USE OR OTHER DEALINGS IN THE SOFTWARE.
24 #pragma once
26 #define EGL_EGLEXT_PROTOTYPES
28 #include <EGL/egl.h>
29 #include <EGL/eglext.h>
31 #include "piglit-util.h"
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
37 #define EGL_PLATFORM_WAYLAND_EXT 0x31D8
38 #define EGL_PLATFORM_X11_EXT 0x31D5
39 #define EGL_PLATFORM_GBM_MESA 0x31D7
41 #ifndef EGL_KHR_no_config_context
42 #define EGL_KHR_no_config_context 1
43 #define EGL_NO_CONFIG_KHR ((EGLConfig)0)
44 #endif /* EGL_KHR_no_config_context */
46 #ifndef EGL_MESA_platform_surfaceless
47 #define EGL_MESA_platform_surfaceless 1
48 #define EGL_PLATFORM_SURFACELESS_MESA 0x31DD
49 #endif /* EGL_MESA_platform_surfaceless */
51 /**
52 * \brief Convert an EGL error to a string.
54 * For example, given EGL_BAD_DRAWABLE, return "EGL_BAD_DRAWABLE".
56 * Return "(unrecognized error)" if the enum is not recognized.
58 const char* piglit_get_egl_error_name(EGLint error);
60 /**
61 * \brief Check for unexpected EGL errors.
63 * If eglGetError() returns an error other than \c expected_error, then
64 * print a diagnostic and return false.
66 * If you expect no error, then set \code expected_error = EGL_SUCCESS \endcode.
68 bool
69 piglit_check_egl_error(EGLint expected_error);
71 /**
72 * \brief Get default display for given platform.
74 * This function wraps piglit_egl_get_display, providing \c EGL_DEFAULT_DISPLAY
75 * for the native_display.
77 EGLDisplay
78 piglit_egl_get_default_display(EGLenum platform);
80 /**
81 * \brief Get display for given platform with native_display.
83 * If \a platform is EGL_NONE, the this function wraps eglGetDisplay().
84 * Otherwise, it wraps eglGetPlatformDisplayEXT().
86 * On failure, return EGL_NO_DISPLAY.
88 * If EGL does not support the platform extension for the given \a platform,
89 * then return EGL_NO_DISPLAY.
91 EGLDisplay
92 piglit_egl_get_display(EGLenum platform, void *native_display);
94 /**
95 * \brief Checks whether an EGL extension is supported.
97 bool piglit_is_egl_extension_supported(EGLDisplay egl_dpy, const char *name);
99 /**
100 * \brief Checks for EGL extension and skips if not supported
102 void piglit_require_egl_extension(EGLDisplay dpy, const char *name);
105 * \brief Wrapper for eglBindAPI().
107 * Return true if eglBindAPI succeeds. Return false if eglBindAPI fails
108 * because the EGL implementation does not support the API; in most cases,
109 * the caller should then report SKIP.
111 * If eglBindAPI fails for unexpected reasons, then the test fails.
113 bool
114 piglit_egl_bind_api(EGLenum api);
116 #ifdef __cplusplus
117 } /* end extern "C" */
118 #endif