vtest: allow controlling context-flags from options

This is easier than having to remember environment variables.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
macos/master
Erik Faye-Lund 6 years ago
parent cfc702c674
commit 0ee5a88a8f
  1. 22
      vtest/vtest_server.c

@ -146,14 +146,20 @@ start:
#define OPT_NO_FORK 'f' #define OPT_NO_FORK 'f'
#define OPT_NO_LOOP_OR_FORK 'l' #define OPT_NO_LOOP_OR_FORK 'l'
#define OPT_USE_GLX 'x'
#define OPT_USE_EGL_SURFACELESS 's'
#define OPT_USE_GLES 'e'
static void vtest_main_parse_args(int argc, char **argv) static void vtest_main_parse_args(int argc, char **argv)
{ {
int ret; int ret;
static struct option long_options[] = { static struct option long_options[] = {
{"no-fork", no_argument, NULL, OPT_NO_FORK}, {"no-fork", no_argument, NULL, OPT_NO_FORK},
{"no-loop-or-fork", no_argument, NULL, OPT_NO_LOOP_OR_FORK}, {"no-loop-or-fork", no_argument, NULL, OPT_NO_LOOP_OR_FORK},
{"use-glx", no_argument, NULL, OPT_USE_GLX},
{"use-egl-surfaceless", no_argument, NULL, OPT_USE_EGL_SURFACELESS},
{"use-gles", no_argument, NULL, OPT_USE_GLES},
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
@ -173,8 +179,18 @@ static void vtest_main_parse_args(int argc, char **argv)
prog.do_fork = false; prog.do_fork = false;
prog.loop = false; prog.loop = false;
break; break;
case OPT_USE_GLX:
prog.use_glx = true;
break;
case OPT_USE_EGL_SURFACELESS:
prog.use_egl_surfaceless = true;
break;
case OPT_USE_GLES:
prog.use_gles = true;
break;
default: default:
printf("Usage: %s [--no-fork] [--no-loop-or-fork] [file]\n", argv[0]); printf("Usage: %s [--no-fork] [--no-loop-or-fork] [--use-glx] "
"[--use-egl-surfaceless] [--use-egl] [file]\n", argv[0]);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
break; break;
} }

Loading…
Cancel
Save