glx-multithread-texture: Avoid front-buffer rendering.
[piglit.git] / tests / util / piglit-framework-gl / piglit_sl_framework.c
blob066a052829c4c7f1d3f8a4f6fbcf3096011f9f5f
1 /*
2 * Copyright 2021 Collabora, Ltd.
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
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 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
21 * IN THE SOFTWARE.
24 #include <assert.h>
25 #include <stdlib.h>
27 #include "piglit-util-gl.h"
28 #include "piglit_sl_framework.h"
30 static void
31 enter_event_loop(struct piglit_winsys_framework *winsys_fw)
35 static void
36 show_window(struct piglit_winsys_framework *winsys_fw)
38 waffle_window_show(winsys_fw->wfl_fw.window);
41 static void
42 destroy(struct piglit_gl_framework *gl_fw)
44 struct piglit_winsys_framework *winsys_fw= piglit_winsys_framework(gl_fw);
46 if (winsys_fw == NULL)
47 return;
49 piglit_winsys_framework_teardown(winsys_fw);
50 free(winsys_fw);
53 struct piglit_gl_framework*
54 piglit_sl_framework_create(const struct piglit_gl_test_config *test_config)
56 #if WAFFLE_MAJOR_VERSION > 1 || (WAFFLE_MAJOR_VERSION == 1 && WAFFLE_MINOR_VERSION >= 6)
57 struct piglit_winsys_framework *winsys_fw = NULL;
58 struct piglit_gl_framework *gl_fw = NULL;
59 bool ok = true;
61 winsys_fw = calloc(1, sizeof(*winsys_fw));
62 gl_fw = &winsys_fw->wfl_fw.gl_fw;
64 ok = piglit_winsys_framework_init(winsys_fw, test_config,
65 WAFFLE_PLATFORM_SURFACELESS_EGL);
66 if (!ok)
67 goto fail;
69 winsys_fw->show_window = show_window;
70 winsys_fw->enter_event_loop = enter_event_loop;
71 gl_fw->destroy = destroy;
73 return gl_fw;
75 fail:
76 destroy(gl_fw);
77 #endif
78 return NULL;