2 * Copyright © 2010 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-nok-swap-region.c
28 * Test EGL_NOK_swap_region.
31 #define PFNEGLSWAPBUFFERSREGIONNOK PFNEGLSWAPBUFFERSREGIONNOKPROC
32 #include "piglit-util-gl.h"
35 const char *extensions
[] = { "EGL_NOK_swap_region", NULL
};
37 static enum piglit_result
38 draw(struct egl_state
*state
)
42 20, 20, 20, 10, /* wide rect */
43 40, 30, 10, 20, /* tall rect */
46 float green
[] = { 0.0, 1.0, 0.0, 1.0};
47 float red
[] = { 1.0, 0.0, 0.0, 1.0};
50 const float *expected
;
53 { 15, state
->height
- 15, green
},
58 { 25, state
->height
- 25, green
},
63 { 45, state
->height
- 35, green
},
66 { 55, state
->height
- 55, green
},
68 PFNEGLSWAPBUFFERSREGIONNOKPROC swap_buffers_region
;
71 swap_buffers_region
= (PFNEGLSWAPBUFFERSREGIONNOKPROC
)
72 eglGetProcAddress("eglSwapBuffersRegionNOK");
74 if (swap_buffers_region
== NULL
) {
75 fprintf(stderr
, "could not getproc eglSwapBuffersRegionNOK");
76 piglit_report_result(PIGLIT_PASS
);
79 /* Clear background to green */
80 glClearColor(0.0, 1.0, 0.0, 1.0);
81 glClear(GL_COLOR_BUFFER_BIT
);
82 eglSwapBuffers(state
->egl_dpy
, state
->surf
);
83 glClearColor(1.0, 0.0, 0.0, 1.0);
84 glClear(GL_COLOR_BUFFER_BIT
);
85 swap_buffers_region(state
->egl_dpy
, state
->surf
, 4, rects
);
89 for (i
= 0; i
< ARRAY_SIZE(probes
); i
++)
90 if (!egl_probe_front_pixel_rgb(state
,
100 main(int argc
, char *argv
[])
102 struct egl_test test
;
104 egl_init_test(&test
);
105 test
.extensions
= extensions
;
108 if (egl_util_run(&test
, argc
, argv
) != PIGLIT_PASS
)