1e52adb7bSmrg/* 2e52adb7bSmrg * Copyright © 2013 Intel Corporation 3e52adb7bSmrg * 4e52adb7bSmrg * Permission is hereby granted, free of charge, to any person obtaining a 5e52adb7bSmrg * copy of this software and associated documentation files (the "Software"), 6e52adb7bSmrg * to deal in the Software without restriction, including without limitation 7e52adb7bSmrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8e52adb7bSmrg * and/or sell copies of the Software, and to permit persons to whom the 9e52adb7bSmrg * Software is furnished to do so, subject to the following conditions: 10e52adb7bSmrg * 11e52adb7bSmrg * The above copyright notice and this permission notice (including the next 12e52adb7bSmrg * paragraph) shall be included in all copies or substantial portions of the 13e52adb7bSmrg * Software. 14e52adb7bSmrg * 15e52adb7bSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16e52adb7bSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17e52adb7bSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18e52adb7bSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19e52adb7bSmrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20e52adb7bSmrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21e52adb7bSmrg * IN THE SOFTWARE. 22e52adb7bSmrg */ 23e52adb7bSmrg 24e52adb7bSmrg/** 25e52adb7bSmrg * @file glx_gles2.c 26e52adb7bSmrg * 27e52adb7bSmrg * Catches a bug where a GLES2 context using 28e52adb7bSmrg * GLX_EXT_create_context_es2_profile would try to find the symbols in 29e52adb7bSmrg * libGLESv2.so.2 instead of libGL.so.1. 30e52adb7bSmrg */ 31e52adb7bSmrg 32e52adb7bSmrg#include <stdio.h> 33e52adb7bSmrg#include <assert.h> 34e52adb7bSmrg#include <err.h> 35e52adb7bSmrg#include "epoxy/gl.h" 36e52adb7bSmrg#include "epoxy/glx.h" 37e52adb7bSmrg#include <X11/Xlib.h> 38e52adb7bSmrg 39e52adb7bSmrg#include "glx_common.h" 40e52adb7bSmrg 41e52adb7bSmrgstatic Display *dpy; 42e52adb7bSmrg 43e52adb7bSmrgstatic int last_call; 44e52adb7bSmrg 45e52adb7bSmrg#define CORE_FUNC_VAL 100 46e52adb7bSmrg#define EXT_FUNC_VAL 101 47e52adb7bSmrg 48e52adb7bSmrgvoid 49f71742dfSmrgoverride_GL_glBindTexture(GLenum target); 50e52adb7bSmrgvoid 51f71742dfSmrgoverride_GL_glBindTextureEXT(GLenum target); 52e52adb7bSmrg 53e52adb7bSmrgvoid 54e52adb7bSmrgoverride_GL_glBindTexture(GLenum target) 55e52adb7bSmrg{ 56e52adb7bSmrg last_call = CORE_FUNC_VAL; 57e52adb7bSmrg} 58e52adb7bSmrg 59e52adb7bSmrgvoid 60f71742dfSmrgoverride_GL_glBindTextureEXT(GLenum target) 61e52adb7bSmrg{ 62e52adb7bSmrg last_call = EXT_FUNC_VAL; 63e52adb7bSmrg} 64e52adb7bSmrg 65e52adb7bSmrgint 66e52adb7bSmrgmain(int argc, char **argv) 67e52adb7bSmrg{ 68e52adb7bSmrg bool pass = true; 69e52adb7bSmrg 70e52adb7bSmrg dpy = get_display_or_skip(); 71e52adb7bSmrg make_glx_context_current_or_skip(dpy); 72e52adb7bSmrg 73f71742dfSmrg if (!epoxy_has_gl_extension("GL_EXT_texture_object")) 74f71742dfSmrg errx(77, "Test requires GL_EXT_texture_object"); 75e52adb7bSmrg 76e52adb7bSmrg glBindTexture(GL_TEXTURE_2D, 1); 77f71742dfSmrg pass = pass && last_call == CORE_FUNC_VAL; 78e52adb7bSmrg glBindTextureEXT(GL_TEXTURE_2D, 1); 79f71742dfSmrg pass = pass && last_call == EXT_FUNC_VAL; 80e52adb7bSmrg 81e52adb7bSmrg return pass != true; 82e52adb7bSmrg} 83