| 1007 | } |
| 1008 | |
| 1009 | int extensionQueryTest(void) |
| 1010 | { |
| 1011 | Display *dpy = NULL; int retval = 1; |
| 1012 | EGLDisplay edpy = EGL_NO_DISPLAY; |
| 1013 | int n = 0; |
| 1014 | EGLContext ctx = 0; |
| 1015 | EGLSurface surface = 0; |
| 1016 | |
| 1017 | printf("Extension query and error handling test:\n\n"); |
| 1018 | |
| 1019 | try |
| 1020 | { |
| 1021 | int major = -1, minor = -1, dummy1; |
| 1022 | EGLConfig config = 0; |
| 1023 | |
| 1024 | if((dpy = XkbOpenDisplay(0, &dummy1, &dummy1, NULL, NULL, |
| 1025 | &dummy1)) == NULL) |
| 1026 | THROW("Could not open display"); |
| 1027 | |
| 1028 | if((edpy = eglGetDisplay(dpy)) == EGL_NO_DISPLAY) |
| 1029 | THROW_EGL("eglGetDisplay()"); |
| 1030 | if(!eglInitialize(edpy, &major, &minor)) |
| 1031 | THROW_EGL("eglInitialize()"); |
| 1032 | if(major != 1 || minor != 5) |
| 1033 | THROW("Incorrect EGL version returned from eglInitialize()"); |
| 1034 | |
| 1035 | char *vendor = XServerVendor(dpy); |
| 1036 | if(!vendor || strcmp(vendor, "Spacely Sprockets, Inc.")) |
| 1037 | THROW("XServerVendor()"); |
| 1038 | vendor = ServerVendor(dpy); |
| 1039 | if(!vendor || strcmp(vendor, "Spacely Sprockets, Inc.")) |
| 1040 | THROW("ServerVendor()"); |
| 1041 | |
| 1042 | vendor = (char *)eglQueryString(edpy, EGL_VENDOR); |
| 1043 | if(!vendor || strcmp(vendor, "VirtualGL")) |
| 1044 | THROW_EGL("eglQueryString(..., EGL_VENDOR)"); |
| 1045 | const char *version = eglQueryString(edpy, EGL_VERSION); |
| 1046 | if(!version || strcmp(version, "1.5")) |
| 1047 | THROW_EGL("eglQueryString(..., EGL_VERSION)"); |
| 1048 | |
| 1049 | // Make sure that GL_EXT_x11_sync_object isn't exposed. Since that |
| 1050 | // extension allows OpenGL functions (which live on the GPU) to operate on |
| 1051 | // XSyncFence objects (which live on the 2D X server), the extension does |
| 1052 | // not currently work with the VirtualGL Faker. |
| 1053 | |
| 1054 | EGLint nc; |
| 1055 | if(!eglChooseConfig(edpy, NULL, &config, 1, &nc) || nc < 1) |
| 1056 | THROW_EGL("eglChooseConfig()"); |
| 1057 | if(!(ctx = eglCreateContext(edpy, config, NULL, NULL))) |
| 1058 | THROW_EGL("eglCreateContext()"); |
| 1059 | EGLint pbAttribs[] = { EGL_WIDTH, 10, EGL_HEIGHT, 10, EGL_NONE }; |
| 1060 | if(!(surface = eglCreatePbufferSurface(edpy, config, pbAttribs))) |
| 1061 | THROW_EGL("eglCreatePbufferSurface()"); |
| 1062 | if(!eglMakeCurrent(edpy, surface, surface, ctx)) |
| 1063 | THROW_EGL("eglMakeCurrent()"); |
| 1064 | |
| 1065 | char *exts = (char *)glGetString(GL_EXTENSIONS); |
| 1066 | if(!exts) THROW("Could not get OpenGL extensions"); |
no test coverage detected