[Piglit] [PATCH 5/9] glx: Convert tests to using epoxy for GLX function pointer management.
Ian Romanick
idr at freedesktop.org
Mon Feb 10 19:10:15 PST 2014
How does epoxy handle GetProcAddress returning NULL?
tests/spec/glx_arb_create_context/indirect-es2-profile.c *really* wants
to know if it got NULL for a function pointer. There are a couple other
tests that check for NULL to fail a test, but I'm less concerened about
those.
On 01/28/2014 06:52 PM, Eric Anholt wrote:
> ---
> tests/glx/glx-copy-sub-buffer.c | 13 ++---
> tests/glx/glx-dont-care-mask.c | 9 +---
> tests/glx/glx-fbconfig-compliance.c | 44 ++++++---------
> tests/glx/glx-fbconfig-sanity.c | 63 +++++++++-------------
> tests/glx/glx-pixmap-crosscheck.c | 13 +----
> tests/glx/glx-tfp.c | 17 +-----
> tests/spec/glx_arb_create_context/common.c | 8 ---
> tests/spec/glx_arb_create_context/common.h | 5 --
> .../glx_arb_create_context/indirect-es2-profile.c | 27 +++-------
> .../glx_arb_create_context/require-robustness.c | 15 +-----
> tests/spec/glx_ext_import_context/common.c | 24 ---------
> tests/spec/glx_ext_import_context/common.h | 16 ------
> .../query-renderer-common.c | 5 --
> .../query-renderer-common.h | 4 --
> tests/spec/glx_oml_sync_control/common.c | 24 ---------
> tests/spec/glx_oml_sync_control/common.h | 12 -----
> tests/util/piglit-glx-util.h | 2 +-
> 17 files changed, 63 insertions(+), 238 deletions(-)
>
> diff --git a/tests/glx/glx-copy-sub-buffer.c b/tests/glx/glx-copy-sub-buffer.c
> index ef8bd93..b213f6e 100644
> --- a/tests/glx/glx-copy-sub-buffer.c
> +++ b/tests/glx/glx-copy-sub-buffer.c
> @@ -40,7 +40,6 @@ int piglit_width = 100, piglit_height = 100;
> static Display *dpy;
> static Window win_one;
> static XVisualInfo *visinfo;
> -static PFNGLXCOPYSUBBUFFERMESAPROC CopySubBuffer;
>
> enum piglit_result
> draw(Display *dpy)
> @@ -59,11 +58,11 @@ draw(Display *dpy)
>
> glClearColor(0.0, 1.0, 0.0, 0.0);
> glClear(GL_COLOR_BUFFER_BIT);
> - CopySubBuffer(dpy, win_one,
> - piglit_width / 4,
> - piglit_height / 4,
> - piglit_width / 2,
> - piglit_height / 2);
> + glXCopySubBufferMESA(dpy, win_one,
> + piglit_width / 4,
> + piglit_height / 4,
> + piglit_width / 2,
> + piglit_height / 2);
>
> glReadBuffer(GL_FRONT);
>
> @@ -129,8 +128,6 @@ main(int argc, char **argv)
> }
>
> piglit_require_glx_extension(dpy, "MESA_copy_sub_buffer");
> - CopySubBuffer = (PFNGLXCOPYSUBBUFFERMESAPROC)
> - glXGetProcAddressARB((GLubyte *)"glXCopySubBufferMESA");
>
> visinfo = get_glx_visual(dpy, samples);
> win_one = piglit_get_glx_window(dpy, visinfo);
> diff --git a/tests/glx/glx-dont-care-mask.c b/tests/glx/glx-dont-care-mask.c
> index dace558..576f15b 100644
> --- a/tests/glx/glx-dont-care-mask.c
> +++ b/tests/glx/glx-dont-care-mask.c
> @@ -43,8 +43,6 @@
> int piglit_width = 10;
> int piglit_height = 10;
>
> -static PFNGLXCHOOSEFBCONFIGPROC ChooseFBConfig = NULL;
> -
> int
> main(int argc, char **argv)
> {
> @@ -70,11 +68,8 @@ main(int argc, char **argv)
> piglit_require_glx_version(dpy, 1, 3);
> piglit_require_glx_extension(dpy, "GLX_ARB_get_proc_address");
>
> - ChooseFBConfig = (PFNGLXCHOOSEFBCONFIGPROC)
> - glXGetProcAddressARB((GLubyte *) "glXChooseFBConfig");
> -
> - configs = ChooseFBConfig(dpy, DefaultScreen(dpy), attrib_list,
> - &num_configs);
> + configs = glXChooseFBConfig(dpy, DefaultScreen(dpy), attrib_list,
> + &num_configs);
>
> result = (num_configs > 0 && configs != NULL)
> ? PIGLIT_PASS : PIGLIT_FAIL;
> diff --git a/tests/glx/glx-fbconfig-compliance.c b/tests/glx/glx-fbconfig-compliance.c
> index 0cd2183..c31997c 100644
> --- a/tests/glx/glx-fbconfig-compliance.c
> +++ b/tests/glx/glx-fbconfig-compliance.c
> @@ -30,11 +30,6 @@
> #include "piglit-util-gl-common.h"
> #include "piglit-glx-util.h"
>
> -static PFNGLXGETFBCONFIGSPROC GetFBConfigs = NULL;
> -static PFNGLXGETFBCONFIGATTRIBPROC GetFBConfigAttrib = NULL;
> -static PFNGLXGETVISUALFROMFBCONFIGPROC GetVisualFromFBConfig = NULL;
> -static PFNGLXCHOOSEFBCONFIGPROC ChooseFBConfig = NULL;
> -
> int piglit_width = 10;
> int piglit_height = 10;
>
> @@ -51,19 +46,19 @@ config_is_sufficient(Display *dpy, GLXFBConfig config, int vdepth, int rgba)
> int color_buffer_size;
> int level;
>
> - GetFBConfigAttrib(dpy, config, GLX_DRAWABLE_TYPE, &draw_type);
> - GetFBConfigAttrib(dpy, config, GLX_RENDER_TYPE, &render_type);
> - GetFBConfigAttrib(dpy, config, GLX_CONFIG_CAVEAT, &caveat);
> - GetFBConfigAttrib(dpy, config, GLX_RED_SIZE, &color_red);
> - GetFBConfigAttrib(dpy, config, GLX_GREEN_SIZE, &color_green);
> - GetFBConfigAttrib(dpy, config, GLX_BLUE_SIZE, &color_blue);
> - GetFBConfigAttrib(dpy, config, GLX_STENCIL_SIZE, &stencil);
> - GetFBConfigAttrib(dpy, config, GLX_DEPTH_SIZE, &depth);
> - GetFBConfigAttrib(dpy, config, GLX_ACCUM_RED_SIZE, &accum_red);
> - GetFBConfigAttrib(dpy, config, GLX_ACCUM_GREEN_SIZE, &accum_green);
> - GetFBConfigAttrib(dpy, config, GLX_ACCUM_BLUE_SIZE, &accum_blue);
> - GetFBConfigAttrib(dpy, config, GLX_BUFFER_SIZE, &color_buffer_size);
> - GetFBConfigAttrib(dpy, config, GLX_LEVEL, &level);
> + glXGetFBConfigAttrib(dpy, config, GLX_DRAWABLE_TYPE, &draw_type);
> + glXGetFBConfigAttrib(dpy, config, GLX_RENDER_TYPE, &render_type);
> + glXGetFBConfigAttrib(dpy, config, GLX_CONFIG_CAVEAT, &caveat);
> + glXGetFBConfigAttrib(dpy, config, GLX_RED_SIZE, &color_red);
> + glXGetFBConfigAttrib(dpy, config, GLX_GREEN_SIZE, &color_green);
> + glXGetFBConfigAttrib(dpy, config, GLX_BLUE_SIZE, &color_blue);
> + glXGetFBConfigAttrib(dpy, config, GLX_STENCIL_SIZE, &stencil);
> + glXGetFBConfigAttrib(dpy, config, GLX_DEPTH_SIZE, &depth);
> + glXGetFBConfigAttrib(dpy, config, GLX_ACCUM_RED_SIZE, &accum_red);
> + glXGetFBConfigAttrib(dpy, config, GLX_ACCUM_GREEN_SIZE, &accum_green);
> + glXGetFBConfigAttrib(dpy, config, GLX_ACCUM_BLUE_SIZE, &accum_blue);
> + glXGetFBConfigAttrib(dpy, config, GLX_BUFFER_SIZE, &color_buffer_size);
> + glXGetFBConfigAttrib(dpy, config, GLX_LEVEL, &level);
>
> /* must support window rendering */
> if ((draw_type & GLX_WINDOW_BIT) == 0) {
> @@ -169,14 +164,7 @@ main(int argc, char **argv)
> piglit_require_glx_version(dpy, 1, 3);
> piglit_require_glx_extension(dpy, "GLX_ARB_get_proc_address");
>
> - GetFBConfigs = (PFNGLXGETFBCONFIGSPROC)
> - glXGetProcAddressARB((GLubyte *) "glXGetFBConfigs");
> - GetFBConfigAttrib = (PFNGLXGETFBCONFIGATTRIBPROC)
> - glXGetProcAddressARB((GLubyte *) "glXGetFBConfigAttrib");
> - GetVisualFromFBConfig = (PFNGLXGETVISUALFROMFBCONFIGPROC)
> - glXGetProcAddressARB((GLubyte *) "glXGetVisualFromFBConfig");
> -
> - configs = GetFBConfigs(dpy, DefaultScreen(dpy), &num_configs);
> + configs = glXGetFBConfigs(dpy, DefaultScreen(dpy), &num_configs);
>
> /* rgba support is mandatory */
> visual_depth = get_max_visual_depth(dpy, 1);
> @@ -200,8 +188,8 @@ main(int argc, char **argv)
> };
>
> /* even if you have CI visuals, you needn't have CI fbconfigs */
> - ci_configs = ChooseFBConfig(dpy, DefaultScreen(dpy),
> - ci_attribs, &num_ci_configs);
> + ci_configs = glXChooseFBConfig(dpy, DefaultScreen(dpy),
> + ci_attribs, &num_ci_configs);
> if (!ci_configs)
> goto out;
>
> diff --git a/tests/glx/glx-fbconfig-sanity.c b/tests/glx/glx-fbconfig-sanity.c
> index 9e570aa..0b39598 100644
> --- a/tests/glx/glx-fbconfig-sanity.c
> +++ b/tests/glx/glx-fbconfig-sanity.c
> @@ -33,10 +33,6 @@
> int piglit_width = 10;
> int piglit_height = 10;
>
> -static PFNGLXGETFBCONFIGSPROC GetFBConfigs = NULL;
> -static PFNGLXGETFBCONFIGATTRIBPROC GetFBConfigAttrib = NULL;
> -static PFNGLXGETVISUALFROMFBCONFIGPROC GetVisualFromFBConfig = NULL;
> -
> static void
> fbconfig_sanity_warn(int *result)
> {
> @@ -65,14 +61,7 @@ main(int argc, char **argv)
> piglit_require_glx_version(dpy, 1, 3);
> piglit_require_glx_extension(dpy, "GLX_ARB_get_proc_address");
>
> - GetFBConfigs = (PFNGLXGETFBCONFIGSPROC)
> - glXGetProcAddressARB((GLubyte *) "glXGetFBConfigs");
> - GetFBConfigAttrib = (PFNGLXGETFBCONFIGATTRIBPROC)
> - glXGetProcAddressARB((GLubyte *) "glXGetFBConfigAttrib");
> - GetVisualFromFBConfig = (PFNGLXGETVISUALFROMFBCONFIGPROC)
> - glXGetProcAddressARB((GLubyte *) "glXGetVisualFromFBConfig");
> -
> - configs = GetFBConfigs(dpy, DefaultScreen(dpy), &num_configs);
> + configs = glXGetFBConfigs(dpy, DefaultScreen(dpy), &num_configs);
>
> /* Iterate over the list of fbconfigs. Check that each fbconfig that
> * has the GLX_WINDOW_BIT or GLX_PIXMAP_BIT set also has a non-zero
> @@ -91,24 +80,24 @@ main(int argc, char **argv)
> int transparency;
> XVisualInfo *vinfo;
>
> - GetFBConfigAttrib(dpy, configs[i], GLX_FBCONFIG_ID,
> - &config_id);
> - GetFBConfigAttrib(dpy, configs[i], GLX_DRAWABLE_TYPE,
> - &draw_type);
> - GetFBConfigAttrib(dpy, configs[i], GLX_VISUAL_ID,
> - &visual_id);
> - GetFBConfigAttrib(dpy, configs[i], GLX_SAMPLE_BUFFERS,
> - &sample_buffers);
> - GetFBConfigAttrib(dpy, configs[i], GLX_RENDER_TYPE,
> - &render_type);
> - GetFBConfigAttrib(dpy, configs[i], GLX_X_RENDERABLE,
> - &x_renderable);
> - GetFBConfigAttrib(dpy, configs[i], GLX_CONFIG_CAVEAT,
> - &caveat);
> - GetFBConfigAttrib(dpy, configs[i], GLX_TRANSPARENT_TYPE,
> - &transparency);
> - GetFBConfigAttrib(dpy, configs[i], GLX_X_VISUAL_TYPE,
> - &vtype);
> + glXGetFBConfigAttrib(dpy, configs[i], GLX_FBCONFIG_ID,
> + &config_id);
> + glXGetFBConfigAttrib(dpy, configs[i], GLX_DRAWABLE_TYPE,
> + &draw_type);
> + glXGetFBConfigAttrib(dpy, configs[i], GLX_VISUAL_ID,
> + &visual_id);
> + glXGetFBConfigAttrib(dpy, configs[i], GLX_SAMPLE_BUFFERS,
> + &sample_buffers);
> + glXGetFBConfigAttrib(dpy, configs[i], GLX_RENDER_TYPE,
> + &render_type);
> + glXGetFBConfigAttrib(dpy, configs[i], GLX_X_RENDERABLE,
> + &x_renderable);
> + glXGetFBConfigAttrib(dpy, configs[i], GLX_CONFIG_CAVEAT,
> + &caveat);
> + glXGetFBConfigAttrib(dpy, configs[i], GLX_TRANSPARENT_TYPE,
> + &transparency);
> + glXGetFBConfigAttrib(dpy, configs[i], GLX_X_VISUAL_TYPE,
> + &vtype);
>
> if (!draw_type) {
> fprintf(stderr, "FBConfig 0x%x supports no "
> @@ -124,9 +113,9 @@ main(int argc, char **argv)
> result = PIGLIT_FAIL;
> }
>
> - GetFBConfigAttrib(dpy, configs[i], GLX_TRANSPARENT_TYPE,
> - &transparency);
> - vinfo = GetVisualFromFBConfig(dpy, configs[i]);
> + glXGetFBConfigAttrib(dpy, configs[i], GLX_TRANSPARENT_TYPE,
> + &transparency);
> + vinfo = glXGetVisualFromFBConfig(dpy, configs[i]);
> if ((vinfo == NULL) != (visual_id == 0)) {
> fprintf(stderr, "FBconfig 0x%x has vinfo = %p and "
> "visual ID = 0x%x. Both or neither must be "
> @@ -145,8 +134,8 @@ main(int argc, char **argv)
>
> if (vinfo) {
> int depth;
> - GetFBConfigAttrib(dpy, configs[i], GLX_BUFFER_SIZE,
> - &depth);
> + glXGetFBConfigAttrib(dpy, configs[i], GLX_BUFFER_SIZE,
> + &depth);
> if (vinfo->class == StaticColor ||
> vinfo->class == PseudoColor) {
> if (depth != vinfo->depth) {
> @@ -241,8 +230,8 @@ main(int argc, char **argv)
>
> if (sample_buffers == 0) {
> int samples;
> - GetFBConfigAttrib(dpy, configs[i],
> - GLX_SAMPLES, &samples);
> + glXGetFBConfigAttrib(dpy, configs[i],
> + GLX_SAMPLES, &samples);
> if (samples != 0) {
> fprintf(stderr, "FBConfig 0x%x has "
> "0 sample buffers but %d "
> diff --git a/tests/glx/glx-pixmap-crosscheck.c b/tests/glx/glx-pixmap-crosscheck.c
> index 0b3f1bd..32099f2 100644
> --- a/tests/glx/glx-pixmap-crosscheck.c
> +++ b/tests/glx/glx-pixmap-crosscheck.c
> @@ -59,11 +59,9 @@ typedef GLXPixmap (*pfn_create_pixmap)(Display *, GLXFBConfigSGIX, Pixmap);
> int
> main(int argc, char **argv)
> {
> - const char *extensions;
> GLXFBConfig fbc;
> Pixmap p;
> GLXPixmap g;
> - pfn_create_pixmap create_pixmap_with_config = NULL;
>
> dpy = XOpenDisplay(NULL);
> if (dpy == NULL) {
> @@ -79,13 +77,6 @@ main(int argc, char **argv)
> p = XCreatePixmap(dpy, DefaultRootWindow(dpy), piglit_width,
> piglit_height, visinfo->depth);
>
> - extensions = glXQueryExtensionsString(dpy, DefaultScreen(dpy));
> - if (strstr(extensions, "GLX_SGIX_fbconfig")) {
> - const GLubyte entrypoint[] = "glXCreateGLXPixmapWithConfigSGIX";
> - create_pixmap_with_config =
> - (pfn_create_pixmap)glXGetProcAddressARB(entrypoint);
> - }
> -
> XSetErrorHandler(expect_no_error);
>
> /* pre-1.3 ctor, 1.3 dtor */
> @@ -94,8 +85,8 @@ main(int argc, char **argv)
> XSync(dpy, 0);
>
> /* extension ctor, 1.3 dtor */
> - if (create_pixmap_with_config) {
> - g = create_pixmap_with_config(dpy, fbc, p);
> + if (piglit_is_glx_extension_supported(dpy, "GLX_SGIX_fbconfig")) {
> + g = glXCreateGLXPixmapWithConfigSGIX(dpy, fbc, p);
> glXDestroyPixmap(dpy, g);
> XSync(dpy, 0);
> }
> diff --git a/tests/glx/glx-tfp.c b/tests/glx/glx-tfp.c
> index 3336c51..e8b09f9 100644
> --- a/tests/glx/glx-tfp.c
> +++ b/tests/glx/glx-tfp.c
> @@ -56,9 +56,6 @@ static Window win;
> int piglit_width = WIN_WIDTH;
> int piglit_height = WIN_HEIGHT;
>
> -static PFNGLXBINDTEXIMAGEEXTPROC pglXBindTexImageEXT;
> -static PFNGLXRELEASETEXIMAGEEXTPROC pglXReleaseTexImageEXT;
> -
> static GLboolean
> check_pixel(GLboolean has_alpha, GLfloat *tex_color, int x, int y)
> {
> @@ -140,7 +137,7 @@ draw_pixmap(GLXPixmap pixmap, int x, int y, int w, int h)
> glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_TEXTURE);
> glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA, GL_TEXTURE); /* ignored */
>
> - pglXBindTexImageEXT(dpy, pixmap, GLX_FRONT_LEFT_EXT, NULL);
> + glXBindTexImageEXT(dpy, pixmap, GLX_FRONT_LEFT_EXT, NULL);
>
> glEnableClientState(GL_TEXTURE_COORD_ARRAY);
> glTexCoordPointer(2, GL_FLOAT, 0, tex_coords);
> @@ -150,7 +147,7 @@ draw_pixmap(GLXPixmap pixmap, int x, int y, int w, int h)
>
> glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
>
> - pglXReleaseTexImageEXT(dpy, pixmap, GLX_FRONT_LEFT_EXT);
> + glXReleaseTexImageEXT(dpy, pixmap, GLX_FRONT_LEFT_EXT);
> glDeleteTextures(1, &texname);
> glDisableClientState(GL_VERTEX_ARRAY);
> glDisableClientState(GL_TEXTURE_COORD_ARRAY);
> @@ -331,16 +328,6 @@ int main(int argc, char**argv)
> piglit_report_result(PIGLIT_SKIP);
> }
>
> - pglXBindTexImageEXT = (PFNGLXBINDTEXIMAGEEXTPROC)
> - glXGetProcAddress((GLubyte *)"glXBindTexImageEXT");
> - pglXReleaseTexImageEXT = (PFNGLXRELEASETEXIMAGEEXTPROC)
> - glXGetProcAddress((GLubyte *)"glXReleaseTexImageEXT");
> - if (pglXBindTexImageEXT == NULL || pglXReleaseTexImageEXT == NULL) {
> - fprintf(stderr, "Couldn't get TFP functions\n");
> - piglit_report_result(PIGLIT_FAIL);
> - exit(1);
> - }
> -
> init();
>
> if (!piglit_automatic) {
> diff --git a/tests/spec/glx_arb_create_context/common.c b/tests/spec/glx_arb_create_context/common.c
> index 7188a66..685c8b0 100644
> --- a/tests/spec/glx_arb_create_context/common.c
> +++ b/tests/spec/glx_arb_create_context/common.c
> @@ -25,8 +25,6 @@
> #include "piglit-glx-util.h"
> #include "common.h"
>
> -PFNGLXCREATECONTEXTATTRIBSARBPROC __piglit_glXCreateContextAttribsARB = NULL;
> -
> Display *dpy = NULL;
> GLXFBConfig fbconfig = None;
> XVisualInfo *visinfo = NULL;
> @@ -88,12 +86,6 @@ GLX_ARB_create_context_setup(void)
> piglit_require_glx_version(dpy, 1, 4);
> piglit_require_glx_extension(dpy, "GLX_ARB_create_context");
>
> - __piglit_glXCreateContextAttribsARB =
> - (PFNGLXCREATECONTEXTATTRIBSARBPROC)
> - glXGetProcAddress((const GLubyte *)
> - "glXCreateContextAttribsARB");
> - assert(__piglit_glXCreateContextAttribsARB != NULL);
> -
> visinfo = piglit_get_glx_visual(dpy);
> fbconfig = piglit_glx_get_fbconfig_for_visinfo(dpy, visinfo);
>
> diff --git a/tests/spec/glx_arb_create_context/common.h b/tests/spec/glx_arb_create_context/common.h
> index 2e58b16..e8d16b0 100644
> --- a/tests/spec/glx_arb_create_context/common.h
> +++ b/tests/spec/glx_arb_create_context/common.h
> @@ -20,11 +20,6 @@
> * IN THE SOFTWARE.
> */
>
> -extern PFNGLXCREATECONTEXTATTRIBSARBPROC __piglit_glXCreateContextAttribsARB;
> -#define glXCreateContextAttribsARB(dpy, config, share, direct, attrib) \
> - (*__piglit_glXCreateContextAttribsARB)(dpy, config, share, direct, \
> - attrib)
> -
> extern Display *dpy;
> extern GLXFBConfig fbconfig;
> extern XVisualInfo *visinfo;
> diff --git a/tests/spec/glx_arb_create_context/indirect-es2-profile.c b/tests/spec/glx_arb_create_context/indirect-es2-profile.c
> index bda1aa0..9d254cf 100644
> --- a/tests/spec/glx_arb_create_context/indirect-es2-profile.c
> +++ b/tests/spec/glx_arb_create_context/indirect-es2-profile.c
> @@ -50,28 +50,9 @@ int main(int argc, char **argv)
> XSync(dpy, 0);
>
> if (ctx != NULL) {
> - PFNGLGETSHADERPRECISIONFORMATPROC func;
> GLint r[] = { ~0, ~0 };
> GLint p = ~0;
>
> - /* Try to call an ES2 function that does not exist in desktop
> - * OpenGL or have GLX protocol defined. If this works, then
> - * we'll assume the implementation is using some magic
> - * protocol for ES2. If it doesn't work, then the test fails.
> - */
> - func = (PFNGLGETSHADERPRECISIONFORMATPROC)
> - glXGetProcAddress((const GLubyte *)
> - "glGetShaderPrecisionFormat");
> - if (func == NULL) {
> - fprintf(stderr,
> - "Indirect rendering OpenGL ES 2.0 context was "
> - "created, but could not get\n"
> - "function address for "
> - "glGetShaderPrecisionFormat.\n");
> - pass = false;
> - goto done;
> - }
> -
> if (!glXMakeCurrent(dpy, glxWin, ctx)) {
> fprintf(stderr,
> "Indirect rendering OpenGL ES 2.0 "
> @@ -81,7 +62,13 @@ int main(int argc, char **argv)
> goto done;
> }
>
> - (*func)(GL_VERTEX_SHADER, GL_MEDIUM_FLOAT, r, &p);
> + /* Try to call an ES2 function that does not exist in desktop
> + * OpenGL or have GLX protocol defined. If this works, then
> + * we'll assume the implementation is using some magic
> + * protocol for ES2. If it doesn't work, then the test fails.
> + */
> + glGetShaderPrecisionFormat(GL_VERTEX_SHADER, GL_MEDIUM_FLOAT,
> + r, &p);
> if (r[0] < 14 || r[1] < 14 || p < 10) {
> fprintf(stderr,
> "Indirect rendering OpenGL ES 2.0 "
> diff --git a/tests/spec/glx_arb_create_context/require-robustness.c b/tests/spec/glx_arb_create_context/require-robustness.c
> index 6093b87..f10596b 100644
> --- a/tests/spec/glx_arb_create_context/require-robustness.c
> +++ b/tests/spec/glx_arb_create_context/require-robustness.c
> @@ -19,12 +19,11 @@
> * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> * IN THE SOFTWARE.
> */
> +
> #include "piglit-util.h"
> #include "piglit-glx-util.h"
> #include "common.h"
>
> -static PFNGLGETSTRINGIPROC GetStringi = NULL;
> -
> static bool try_context(int reset_strategy, int flags)
> {
> const int attribs[] = {
> @@ -59,19 +58,9 @@ static bool try_context(int reset_strategy, int flags)
> goto done;
> }
>
> - GetStringi = (PFNGLGETSTRINGIPROC)
> - glXGetProcAddress((const GLubyte *) "glGetStringi");
> - if (GetStringi == NULL) {
> - fprintf(stderr,
> - "Created OpenGL 3.0+ context, but could not "
> - "get glGetStringi function.\n");
> - pass = false;
> - goto done;
> - }
> -
> glGetIntegerv(GL_NUM_EXTENSIONS, &num_extensions);
> for (i = 0; i < num_extensions; i++) {
> - const char *ext = (const char *) GetStringi(GL_EXTENSIONS, i);
> + const char *ext = (const char *) glGetStringi(GL_EXTENSIONS, i);
>
> if (strcmp(ext, "GL_ARB_robustness") == 0) {
> got_robustness = true;
> diff --git a/tests/spec/glx_ext_import_context/common.c b/tests/spec/glx_ext_import_context/common.c
> index 9048472..8084df4 100644
> --- a/tests/spec/glx_ext_import_context/common.c
> +++ b/tests/spec/glx_ext_import_context/common.c
> @@ -25,12 +25,6 @@
> #include "piglit-glx-util.h"
> #include "common.h"
>
> -PFNGLXGETCURRENTDISPLAYEXTPROC __piglit_glXGetCurrentDisplayEXT = NULL;
> -PFNGLXQUERYCONTEXTINFOEXTPROC __piglit_glXQueryContextInfoEXT = NULL;
> -PFNGLXGETCONTEXTIDEXTPROC __piglit_glXGetContextIDEXT = NULL;
> -PFNGLXIMPORTCONTEXTEXTPROC __piglit_glXImportContextEXT = NULL;
> -PFNGLXFREECONTEXTEXTPROC __piglit_glXFreeContextEXT = NULL;
> -
> Display *dpy = NULL;
> XVisualInfo *visinfo = NULL;
> GLXContext directCtx = NULL;
> @@ -63,22 +57,6 @@ void GLX_EXT_import_context_setup_for_child(void)
>
> void GLX_EXT_import_context_setup(void)
> {
> - const char *const names[] = {
> - "glXGetCurrentDisplayEXT",
> - "glXQueryContextInfoEXT",
> - "glXGetContextIDEXT",
> - "glXImportContextEXT",
> - "glXFreeContextEXT"
> - };
> -
> - __GLXextFuncPtr *procedures[ARRAY_SIZE(names)] = {
> - (__GLXextFuncPtr *) & __piglit_glXGetCurrentDisplayEXT,
> - (__GLXextFuncPtr *) & __piglit_glXQueryContextInfoEXT,
> - (__GLXextFuncPtr *) & __piglit_glXGetContextIDEXT,
> - (__GLXextFuncPtr *) & __piglit_glXImportContextEXT,
> - (__GLXextFuncPtr *) & __piglit_glXFreeContextEXT
> - };
> -
> const char *vendor;
>
> dpy = piglit_get_glx_display();
> @@ -113,8 +91,6 @@ void GLX_EXT_import_context_setup(void)
> piglit_require_glx_extension(dpy, "GLX_EXT_import_context");
> }
>
> - piglit_glx_get_all_proc_addresses(procedures, names, ARRAY_SIZE(names));
> -
> visinfo = piglit_get_glx_visual(dpy);
>
> directCtx = glXCreateContext(dpy, visinfo, NULL, True);
> diff --git a/tests/spec/glx_ext_import_context/common.h b/tests/spec/glx_ext_import_context/common.h
> index ec906a2..585c74f 100644
> --- a/tests/spec/glx_ext_import_context/common.h
> +++ b/tests/spec/glx_ext_import_context/common.h
> @@ -20,22 +20,6 @@
> * IN THE SOFTWARE.
> */
>
> -extern PFNGLXGETCURRENTDISPLAYEXTPROC __piglit_glXGetCurrentDisplayEXT;
> -#define glXGetCurrentDisplayEXT() (*__piglit_glXGetCurrentDisplayEXT)()
> -
> -extern PFNGLXQUERYCONTEXTINFOEXTPROC __piglit_glXQueryContextInfoEXT;
> -#define glXQueryContextInfoEXT(dpy, ctx, attrib, value) \
> - (*__piglit_glXQueryContextInfoEXT)(dpy, ctx, attrib, value)
> -
> -extern PFNGLXGETCONTEXTIDEXTPROC __piglit_glXGetContextIDEXT;
> -#define glXGetContextIDEXT(ctx) (*__piglit_glXGetContextIDEXT)(ctx)
> -
> -extern PFNGLXIMPORTCONTEXTEXTPROC __piglit_glXImportContextEXT;
> -#define glXImportContextEXT(dpy, ctx) (*__piglit_glXImportContextEXT)(dpy, ctx)
> -
> -extern PFNGLXFREECONTEXTEXTPROC __piglit_glXFreeContextEXT;
> -#define glXFreeContextEXT(dpy, ctx) (*__piglit_glXFreeContextEXT)(dpy, ctx)
> -
> extern Display *dpy;
> extern XVisualInfo *visinfo;
> extern GLXContext directCtx;
> diff --git a/tests/spec/glx_mesa_query_renderer/query-renderer-common.c b/tests/spec/glx_mesa_query_renderer/query-renderer-common.c
> index 39dc4c6..99fe602 100644
> --- a/tests/spec/glx_mesa_query_renderer/query-renderer-common.c
> +++ b/tests/spec/glx_mesa_query_renderer/query-renderer-common.c
> @@ -27,7 +27,6 @@ PFNGLXQUERYRENDERERSTRINGMESAPROC piglit_glXQueryRendererStringMESA = NULL;
> PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC piglit_glXQueryCurrentRendererStringMESA = NULL;
> PFNGLXQUERYRENDERERINTEGERMESAPROC piglit_glXQueryRendererIntegerMESA = NULL;
> PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC piglit_glXQueryCurrentRendererIntegerMESA = NULL;
> -PFNGLXCREATECONTEXTATTRIBSARBPROC piglit_glXCreateContextAttribsARB = NULL;
>
> static void *
> get_and_verify_proc(const char *name)
> @@ -63,8 +62,4 @@ initialize_function_pointers(Display *dpy)
> get_and_verify_proc("glXQueryCurrentRendererIntegerMESA");
>
> piglit_require_glx_extension(dpy, "GLX_ARB_create_context");
> -
> - piglit_glXCreateContextAttribsARB =
> - (PFNGLXCREATECONTEXTATTRIBSARBPROC)
> - get_and_verify_proc("glXCreateContextAttribsARB");
> }
> diff --git a/tests/spec/glx_mesa_query_renderer/query-renderer-common.h b/tests/spec/glx_mesa_query_renderer/query-renderer-common.h
> index 1121eca..bd2c11e 100644
> --- a/tests/spec/glx_mesa_query_renderer/query-renderer-common.h
> +++ b/tests/spec/glx_mesa_query_renderer/query-renderer-common.h
> @@ -50,7 +50,6 @@ PFNGLXQUERYRENDERERSTRINGMESAPROC piglit_glXQueryRendererStringMESA;
> PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC piglit_glXQueryCurrentRendererStringMESA;
> PFNGLXQUERYRENDERERINTEGERMESAPROC piglit_glXQueryRendererIntegerMESA;
> PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC piglit_glXQueryCurrentRendererIntegerMESA;
> -PFNGLXCREATECONTEXTATTRIBSARBPROC piglit_glXCreateContextAttribsARB;
>
> #define glXQueryRendererStringMESA(dpy, screen, renderer, attribute) \
> (*piglit_glXQueryRendererStringMESA)(dpy, screen, renderer, attribute)
> @@ -64,9 +63,6 @@ PFNGLXCREATECONTEXTATTRIBSARBPROC piglit_glXCreateContextAttribsARB;
> #define glXQueryCurrentRendererIntegerMESA(attribute, value) \
> (*piglit_glXQueryCurrentRendererIntegerMESA)(attribute, value)
>
> -#define glXCreateContextAttribsARB(dpy, fbconfig, share, direct, attrib) \
> - (*piglit_glXCreateContextAttribsARB)(dpy, fbconfig, share, direct, attrib)
> -
> void initialize_function_pointers(Display *);
>
> #endif /* QUERY_RENDERER_COMMON_H */
> diff --git a/tests/spec/glx_oml_sync_control/common.c b/tests/spec/glx_oml_sync_control/common.c
> index 922f080..92a5fad 100644
> --- a/tests/spec/glx_oml_sync_control/common.c
> +++ b/tests/spec/glx_oml_sync_control/common.c
> @@ -34,11 +34,6 @@
> #include "piglit-glx-util.h"
> #include "common.h"
>
> -PFNGLXGETSYNCVALUESOMLPROC __piglit_glXGetSyncValuesOML;
> -PFNGLXGETMSCRATEOMLPROC __piglit_glXGetMscRateOML;
> -PFNGLXSWAPBUFFERSMSCOMLPROC __piglit_glXSwapBuffersMscOML;
> -PFNGLXWAITFORMSCOMLPROC __piglit_glXWaitForMscOML;
> -PFNGLXWAITFORSBCOMLPROC __piglit_glXWaitForSbcOML;
> Window win;
> XVisualInfo *visinfo;
>
> @@ -47,24 +42,6 @@ piglit_oml_sync_control_test_run(enum piglit_result (*draw)(Display *dpy))
> {
> Display *dpy;
> GLXContext ctx;
> - const int proc_count = 5;
> - __GLXextFuncPtr *procs[proc_count];
> - const char *names[proc_count];
> - int i;
> -
> -#define ADD_FUNC(name) \
> - do { \
> - procs[i] = (__GLXextFuncPtr *)&(__piglit_##name); \
> - names[i] = #name; \
> - i++; \
> - } while (0)
> -
> - i = 0;
> - ADD_FUNC(glXGetSyncValuesOML);
> - ADD_FUNC(glXGetMscRateOML);
> - ADD_FUNC(glXSwapBuffersMscOML);
> - ADD_FUNC(glXWaitForMscOML);
> - ADD_FUNC(glXWaitForSbcOML);
>
> dpy = XOpenDisplay(NULL);
> if (dpy == NULL) {
> @@ -73,7 +50,6 @@ piglit_oml_sync_control_test_run(enum piglit_result (*draw)(Display *dpy))
> }
>
> piglit_require_glx_extension(dpy, "GLX_OML_sync_control");
> - piglit_glx_get_all_proc_addresses(procs, names, ARRAY_SIZE(procs));
>
> visinfo = piglit_get_glx_visual(dpy);
> win = piglit_get_glx_window(dpy, visinfo);
> diff --git a/tests/spec/glx_oml_sync_control/common.h b/tests/spec/glx_oml_sync_control/common.h
> index c06bdd7..eb4750a 100644
> --- a/tests/spec/glx_oml_sync_control/common.h
> +++ b/tests/spec/glx_oml_sync_control/common.h
> @@ -1,15 +1,3 @@
> -#define glXGetSyncValuesOML __piglit_glXGetSyncValuesOML
> -#define glXGetMscRateOML __piglit_glXGetMscRateOML
> -#define glXSwapBuffersMscOML __piglit_glXSwapBuffersMscOML
> -#define glXWaitForMscOML __piglit_glXWaitForMscOML
> -#define glXWaitForSbcOML __piglit_glXWaitForSbcOML
> -
> -extern PFNGLXGETSYNCVALUESOMLPROC __piglit_glXGetSyncValuesOML;
> -extern PFNGLXGETMSCRATEOMLPROC __piglit_glXGetMscRateOML;
> -extern PFNGLXSWAPBUFFERSMSCOMLPROC __piglit_glXSwapBuffersMscOML;
> -extern PFNGLXWAITFORMSCOMLPROC __piglit_glXWaitForMscOML;
> -extern PFNGLXWAITFORSBCOMLPROC __piglit_glXWaitForSbcOML;
> -
> extern Window win;
> extern XVisualInfo *visinfo;
>
> diff --git a/tests/util/piglit-glx-util.h b/tests/util/piglit-glx-util.h
> index e74ac29..07481d4 100644
> --- a/tests/util/piglit-glx-util.h
> +++ b/tests/util/piglit-glx-util.h
> @@ -28,7 +28,7 @@
> #pragma once
>
> #include "X11/Xmd.h"
> -#include "GL/glx.h"
> +#include "epoxy/glx.h"
> #include "GL/glxproto.h"
>
> #ifndef GLXBadProfileARB
>
More information about the Piglit
mailing list