Revision: 159 http://trac.macosforge.org/projects/xquartz/changeset/159 Author: gstaplin@apple.com Date: 2009-02-16 22:08:47 -0800 (Mon, 16 Feb 2009) Log Message: ----------- Add a render_types test to the test suite. This is used to determine what our GLXFBConfigs are reporting is available. All GLXFBConfig currently say GLX_WINDOW_BIT. We need these to support GLX_WINDOW_BIT, GLX_PIXMAP_BIT, and GLX_PBUFFER_BIT now. This will require indirect.c changes in the 1.6 branch, unless we modify the pairs from the X server in libGL. In hindsight it might make more sense to just support Pbuffers and Pixmaps on the client side, because the server side indirect implementation lacks those at the moment. Modified Paths: -------------- AppleSGLX/trunk/tests/simple/simple.mk AppleSGLX/trunk/tests/tests.mk Added Paths: ----------- AppleSGLX/trunk/tests/simple/render_types.c Added: AppleSGLX/trunk/tests/simple/render_types.c =================================================================== --- AppleSGLX/trunk/tests/simple/render_types.c (rev 0) +++ AppleSGLX/trunk/tests/simple/render_types.c 2009-02-17 06:08:47 UTC (rev 159) @@ -0,0 +1,54 @@ +#include <stdio.h> +#include <stdlib.h> +#include <X11/Xlib.h> +#include <GL/glx.h> + +int main(int argc, char *argv[]) { + Display *dpy; + int eventbase, errorbase; + int major, minor; + GLXFBConfig *fbconfigs; + int i, numfbconfigs; + + dpy = XOpenDisplay(NULL); + + if(NULL == dpy) { + fprintf(stderr, "error: unable to open display!\n"); + return EXIT_FAILURE; + } + + if(!glXQueryExtension(dpy, &eventbase, &errorbase)) { + fprintf(stderr, "GLX is not available!\n"); + return EXIT_FAILURE; + } + + printf("GLX eventbase %d errorbase %d\n", eventbase, errorbase); + + if(!glXQueryVersion(dpy, &major, &minor)) { + fprintf(stderr, "GLX version query error!\n"); + return EXIT_FAILURE; + } + + printf("GLX version: %d.%d\n", major, minor); + + fbconfigs = glXGetFBConfigs(dpy, DefaultScreen(dpy), &numfbconfigs); + + if(NULL == fbconfigs) { + fprintf(stderr, "%s: failed to get GLXFBConfigs!\n", __func__); + return EXIT_FAILURE; + } + + for(i = 0; i < numfbconfigs; ++i) { + int r, value; + + r = glXGetFBConfigAttrib(dpy, fbconfigs[i], GLX_RENDER_TYPE, &value); + + printf("fbconfigs[%d] GLX_RENDER_TYPE is %x supporting: %s %s %s\n", + i, value, + value & GLX_WINDOW_BIT ? "GLX_WINDOW_BIT" : "", + value & GLX_PIXMAP_BIT ? "GLX_PIXMAP_BIT" : "", + value & GLX_PBUFFER_BIT ? "GLX_PBUFFER_BIT" : ""); + } + + return EXIT_SUCCESS; +} Modified: AppleSGLX/trunk/tests/simple/simple.mk =================================================================== --- AppleSGLX/trunk/tests/simple/simple.mk 2009-02-16 23:58:49 UTC (rev 158) +++ AppleSGLX/trunk/tests/simple/simple.mk 2009-02-17 06:08:47 UTC (rev 159) @@ -1,2 +1,6 @@ $(TEST_BUILD_DIR)/simple: tests/simple/simple.c $(LIBGL) $(CC) tests/simple/simple.c -Iinclude -I/usr/X11/include -o $(TEST_BUILD_DIR)/simple $(LINK_TEST) + +$(TEST_BUILD_DIR)/render_types: tests/simple/render_types.c $(LIBGL) + $(CC) tests/simple/render_types.c -Iinclude -I/usr/X11/include -o $(TEST_BUILD_DIR)/render_types $(LINK_TEST) + Modified: AppleSGLX/trunk/tests/tests.mk =================================================================== --- AppleSGLX/trunk/tests/tests.mk 2009-02-16 23:58:49 UTC (rev 158) +++ AppleSGLX/trunk/tests/tests.mk 2009-02-17 06:08:47 UTC (rev 159) @@ -16,6 +16,7 @@ include tests/glxpixmap/glxpixmap.mk include tests/triangle_glx_single/triangle_glx.mk + tests: $(TEST_BUILD_DIR)/simple $(TEST_BUILD_DIR)/fbconfigs $(TEST_BUILD_DIR)/triangle_glx \ $(TEST_BUILD_DIR)/create_destroy_context $(TEST_BUILD_DIR)/glxgears $(TEST_BUILD_DIR)/glxinfo \ $(TEST_BUILD_DIR)/pbuffer $(TEST_BUILD_DIR)/pbuffer_destroy \ @@ -23,4 +24,5 @@ $(TEST_BUILD_DIR)/triangle_glx_single \ $(TEST_BUILD_DIR)/create_destroy_context_alone \ $(TEST_BUILD_DIR)/create_destroy_context_with_drawable \ - $(TEST_BUILD_DIR)/create_destroy_context_with_drawable_2 + $(TEST_BUILD_DIR)/create_destroy_context_with_drawable_2 \ + $(TEST_BUILD_DIR)/render_types
participants (1)
-
source_changes@macosforge.org