2 * Copyright © 2011 Intel Corporation
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 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * 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
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 NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
23 * Author: Kristian Høgsberg <krh@bitplanet.net>
26 /** @file egl-create-surface.c
28 * Test EGLCreate*Surface behaviour.
29 * EGL 1.4, section 3.5.1 "Creating On-Screen Rendering Surfaces":
31 * On failure eglCreateWindowSurface returns EGL_NO_SURFACE. [...]
32 * If there is already an EGLConfig associated with win (as a result
33 * of a previous eglCreateWindowSurface call), then an EGL_BAD_ALLOC
37 #include "piglit-util-gl.h"
40 static enum piglit_result
41 draw(struct egl_state
*state
)
45 /* egl-util.c already has created state->surf from state->win,
46 * so this should fail. */
48 surf
= eglCreateWindowSurface(state
->egl_dpy
,
49 state
->cfg
, state
->win
, NULL
);
50 if (surf
!= EGL_NO_SURFACE
) {
51 fprintf(stderr
, "eglCreateWindowSurface() didn't fail\n");
52 piglit_report_result(PIGLIT_FAIL
);
55 if (eglGetError() != EGL_BAD_ALLOC
) {
56 fprintf(stderr
, "eglCreateWindowSurface() "
57 "error wasn't EGL_BAD_ALLOC\n");
58 piglit_report_result(PIGLIT_FAIL
);
65 main(int argc
, char *argv
[])
72 if (egl_util_run(&test
, argc
, argv
) != PIGLIT_PASS
)