1/*
2 * Copyright © 2013 Intel Corporation
3 *
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:
10 *
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.
14 *
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.
22 */
23
24/**
25 * @file glx_gles2.c
26 *
27 * Catches a bug where a GLES2 context using
28 * GLX_EXT_create_context_es2_profile would try to find the symbols in
29 * libGLESv2.so.2 instead of libGL.so.1.
30 */
31
32#include <stdio.h>
33#include <assert.h>
34#include <err.h>
35#include "epoxy/gl.h"
36#include "epoxy/glx.h"
37#include <X11/Xlib.h>
38
39#include "glx_common.h"
40
41static Display *dpy;
42
43static int last_call;
44
45#define CORE_FUNC_VAL 100
46#define EXT_FUNC_VAL 101
47
48void
49override_GL_glBindTexture(GLenum target);
50void
51override_GL_glBindTextureEXT(GLenum target);
52
53void
54override_GL_glBindTexture(GLenum target)
55{
56 last_call = CORE_FUNC_VAL;
57}
58
59void
60override_GL_glBindTextureEXT(GLenum target)
61{
62 last_call = EXT_FUNC_VAL;
63}
64
65int
66main(int argc, char **argv)
67{
68 bool pass = true;
69
70 dpy = get_display_or_skip();
71 make_glx_context_current_or_skip(dpy);
72
73 if (!epoxy_has_gl_extension(extension: "GL_EXT_texture_object"))
74 errx(status: 77, format: "Test requires GL_EXT_texture_object");
75
76 glBindTexture(GL_TEXTURE_2D, 1);
77 pass = pass && last_call == CORE_FUNC_VAL;
78 glBindTextureEXT(GL_TEXTURE_2D, 1);
79 pass = pass && last_call == EXT_FUNC_VAL;
80
81 return pass != true;
82}
83

source code of gtk/subprojects/libepoxy/test/glx_alias_prefer_same_name.c