Add Cocoa graphics switching to glfwinfo

This commit is contained in:
Camilla Löwy 2019-03-27 15:59:36 +01:00
parent 056c5d3f90
commit 9e54b97cfa

View File

@ -100,6 +100,7 @@ static void usage(void)
printf(" --srgb request an sRGB capable framebuffer\n"); printf(" --srgb request an sRGB capable framebuffer\n");
printf(" --singlebuffer request single-buffering\n"); printf(" --singlebuffer request single-buffering\n");
printf(" --no-error request a context that does not emit errors\n"); printf(" --no-error request a context that does not emit errors\n");
printf(" --graphics-switching request macOS graphics switching\n");
} }
static void error_callback(int error, const char* description) static void error_callback(int error, const char* description)
@ -369,38 +370,40 @@ int main(int argc, char** argv)
MAJOR, MINOR, PROFILE, ROBUSTNESS, VERSION, MAJOR, MINOR, PROFILE, ROBUSTNESS, VERSION,
REDBITS, GREENBITS, BLUEBITS, ALPHABITS, DEPTHBITS, STENCILBITS, REDBITS, GREENBITS, BLUEBITS, ALPHABITS, DEPTHBITS, STENCILBITS,
ACCUMREDBITS, ACCUMGREENBITS, ACCUMBLUEBITS, ACCUMALPHABITS, ACCUMREDBITS, ACCUMGREENBITS, ACCUMBLUEBITS, ACCUMALPHABITS,
AUXBUFFERS, SAMPLES, STEREO, SRGB, SINGLEBUFFER, NOERROR_SRSLY }; AUXBUFFERS, SAMPLES, STEREO, SRGB, SINGLEBUFFER, NOERROR_SRSLY,
GRAPHICS_SWITCHING };
const struct option options[] = const struct option options[] =
{ {
{ "behavior", 1, NULL, BEHAVIOR }, { "behavior", 1, NULL, BEHAVIOR },
{ "client-api", 1, NULL, CLIENT }, { "client-api", 1, NULL, CLIENT },
{ "context-api", 1, NULL, CONTEXT }, { "context-api", 1, NULL, CONTEXT },
{ "debug", 0, NULL, DEBUG }, { "debug", 0, NULL, DEBUG },
{ "forward", 0, NULL, FORWARD }, { "forward", 0, NULL, FORWARD },
{ "help", 0, NULL, HELP }, { "help", 0, NULL, HELP },
{ "list-extensions", 0, NULL, EXTENSIONS }, { "list-extensions", 0, NULL, EXTENSIONS },
{ "list-layers", 0, NULL, LAYERS }, { "list-layers", 0, NULL, LAYERS },
{ "major", 1, NULL, MAJOR }, { "major", 1, NULL, MAJOR },
{ "minor", 1, NULL, MINOR }, { "minor", 1, NULL, MINOR },
{ "profile", 1, NULL, PROFILE }, { "profile", 1, NULL, PROFILE },
{ "robustness", 1, NULL, ROBUSTNESS }, { "robustness", 1, NULL, ROBUSTNESS },
{ "version", 0, NULL, VERSION }, { "version", 0, NULL, VERSION },
{ "red-bits", 1, NULL, REDBITS }, { "red-bits", 1, NULL, REDBITS },
{ "green-bits", 1, NULL, GREENBITS }, { "green-bits", 1, NULL, GREENBITS },
{ "blue-bits", 1, NULL, BLUEBITS }, { "blue-bits", 1, NULL, BLUEBITS },
{ "alpha-bits", 1, NULL, ALPHABITS }, { "alpha-bits", 1, NULL, ALPHABITS },
{ "depth-bits", 1, NULL, DEPTHBITS }, { "depth-bits", 1, NULL, DEPTHBITS },
{ "stencil-bits", 1, NULL, STENCILBITS }, { "stencil-bits", 1, NULL, STENCILBITS },
{ "accum-red-bits", 1, NULL, ACCUMREDBITS }, { "accum-red-bits", 1, NULL, ACCUMREDBITS },
{ "accum-green-bits", 1, NULL, ACCUMGREENBITS }, { "accum-green-bits", 1, NULL, ACCUMGREENBITS },
{ "accum-blue-bits", 1, NULL, ACCUMBLUEBITS }, { "accum-blue-bits", 1, NULL, ACCUMBLUEBITS },
{ "accum-alpha-bits", 1, NULL, ACCUMALPHABITS }, { "accum-alpha-bits", 1, NULL, ACCUMALPHABITS },
{ "aux-buffers", 1, NULL, AUXBUFFERS }, { "aux-buffers", 1, NULL, AUXBUFFERS },
{ "samples", 1, NULL, SAMPLES }, { "samples", 1, NULL, SAMPLES },
{ "stereo", 0, NULL, STEREO }, { "stereo", 0, NULL, STEREO },
{ "srgb", 0, NULL, SRGB }, { "srgb", 0, NULL, SRGB },
{ "singlebuffer", 0, NULL, SINGLEBUFFER }, { "singlebuffer", 0, NULL, SINGLEBUFFER },
{ "no-error", 0, NULL, NOERROR_SRSLY }, { "no-error", 0, NULL, NOERROR_SRSLY },
{ "graphics-switching", 0, NULL, GRAPHICS_SWITCHING },
{ NULL, 0, NULL, 0 } { NULL, 0, NULL, 0 }
}; };
@ -615,6 +618,9 @@ int main(int argc, char** argv)
case NOERROR_SRSLY: case NOERROR_SRSLY:
glfwWindowHint(GLFW_CONTEXT_NO_ERROR, GLFW_TRUE); glfwWindowHint(GLFW_CONTEXT_NO_ERROR, GLFW_TRUE);
break; break;
case GRAPHICS_SWITCHING:
glfwWindowHint(GLFW_COCOA_GRAPHICS_SWITCHING, GLFW_TRUE);
break;
default: default:
usage(); usage();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);