summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/GLX_dummy/GLX_dummy.c381
-rw-r--r--tests/GLX_dummy/GLX_dummy.h40
-rw-r--r--tests/GLX_dummy/Makefile.am19
-rw-r--r--tests/GLX_dummy/README (renamed from tests/GLX_dummy/TODO)0
4 files changed, 440 insertions, 0 deletions
diff --git a/tests/GLX_dummy/GLX_dummy.c b/tests/GLX_dummy/GLX_dummy.c
new file mode 100644
index 0000000..4448025
--- /dev/null
+++ b/tests/GLX_dummy/GLX_dummy.c
@@ -0,0 +1,381 @@
+/*
+ * Copyright (c) 2013, NVIDIA CORPORATION.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and/or associated documentation files (the
+ * "Materials"), to deal in the Materials without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Materials, and to
+ * permit persons to whom the Materials are furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * unaltered in all copies or substantial portions of the Materials.
+ * Any additions, deletions, or changes to the original source files
+ * must be clearly indicated in accompanying documentation.
+ *
+ * If only executable code is distributed, then the accompanying
+ * documentation must state that "this software is based in part on the
+ * work of the Khronos Group."
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <GL/glx.h>
+#include <GL/glxint.h>
+
+#include "GLX_dummy.h"
+#include "libglxabi.h"
+#include "utils_misc.h"
+#include "compiler.h"
+
+
+static char *thisVendorName;
+static __GLXapiExports apiExports;
+
+static XVisualInfo* dummyChooseVisual (Display *dpy,
+ int screen,
+ int *attrib_list)
+{
+ return NULL;
+}
+
+static void dummyCopyContext (Display *dpy,
+ GLXContext src,
+ GLXContext dst,
+ unsigned long mask)
+{
+ // nop
+}
+
+static GLXContext dummyCreateContext (Display *dpy,
+ XVisualInfo *vis,
+ GLXContext share_list,
+ Bool direct)
+{
+ return NULL;
+}
+
+static GLXPixmap dummyCreateGLXPixmap (Display *dpy,
+ XVisualInfo *vis,
+ Pixmap pixmap)
+{
+ return None;
+}
+
+static void dummyDestroyContext (Display *dpy,
+ GLXContext ctx)
+{
+ free(ctx);
+}
+
+static void dummyDestroyGLXPixmap (Display *dpy,
+ GLXPixmap pix)
+{
+ // nop
+}
+
+static int dummyGetConfig (Display *dpy,
+ XVisualInfo *vis,
+ int attrib,
+ int *value)
+{
+ return 0;
+}
+
+static Bool dummyIsDirect (Display *dpy,
+ GLXContext ctx)
+{
+ return False;
+}
+
+static Bool dummyMakeCurrent (Display *dpy,
+ GLXDrawable drawable,
+ GLXContext ctx)
+{
+ // This doesn't do anything, but fakes success
+ return True;
+}
+
+static void dummySwapBuffers (Display *dpy,
+ GLXDrawable drawable)
+{
+ // nop
+}
+
+static void dummyUseXFont (Font font,
+ int first,
+ int count,
+ int list_base)
+{
+ // nop
+}
+
+static void dummyWaitGL (void)
+{
+ // nop
+}
+
+static void dummyWaitX (void)
+{
+ // nop
+}
+
+static const char* dummyQueryServerString (Display *dpy,
+ int screen,
+ int name)
+{
+ return NULL;
+}
+
+static const char* dummyGetClientString (Display *dpy,
+ int name)
+{
+ return NULL;
+}
+
+static const char* dummyQueryExtensionsString (Display *dpy,
+ int screen)
+{
+ return NULL;
+}
+
+static GLXFBConfig* dummyChooseFBConfig (Display *dpy,
+ int screen,
+ const int *attrib_list,
+ int *nelements)
+{
+ return NULL;
+}
+
+static GLXContext dummyCreateNewContext (Display *dpy,
+ GLXFBConfig config,
+ int render_type,
+ GLXContext share_list,
+ Bool direct)
+{
+ return NULL;
+}
+
+static GLXPbuffer dummyCreatePbuffer (Display *dpy,
+ GLXFBConfig config,
+ const int *attrib_list)
+{
+ return None;
+}
+
+static GLXPixmap dummyCreatePixmap (Display *dpy,
+ GLXFBConfig config,
+ Pixmap pixmap,
+ const int *attrib_list)
+{
+ return None;
+}
+
+static GLXWindow dummyCreateWindow (Display *dpy,
+ GLXFBConfig config,
+ Window win,
+ const int *attrib_list)
+{
+ return None;
+}
+
+static void dummyDestroyPbuffer (Display *dpy,
+ GLXPbuffer pbuf)
+{
+ // nop
+}
+
+static void dummyDestroyPixmap (Display *dpy,
+ GLXPixmap pixmap)
+{
+ // nop
+}
+
+static void dummyDestroyWindow (Display *dpy,
+ GLXWindow win)
+{
+ // nop
+}
+
+static int dummyGetFBConfigAttrib (Display *dpy,
+ GLXFBConfig config,
+ int attribute,
+ int *value)
+{
+ return 0;
+}
+
+static GLXFBConfig* dummyGetFBConfigs (Display *dpy,
+ int screen,
+ int *nelements)
+{
+ return NULL;
+}
+
+static void dummyGetSelectedEvent (Display *dpy,
+ GLXDrawable draw,
+ unsigned long *event_mask)
+{
+ // nop
+}
+
+static XVisualInfo* dummyGetVisualFromFBConfig (Display *dpy,
+ GLXFBConfig config)
+{
+ return NULL;
+}
+
+static Bool dummyMakeContextCurrent (Display *dpy, GLXDrawable draw,
+ GLXDrawable read, GLXContext ctx)
+{
+ // This doesn't do anything, but fakes success
+ return True;
+}
+
+static int dummyQueryContext (Display *dpy,
+ GLXContext ctx,
+ int attribute,
+ int *value)
+{
+ return 0;
+}
+
+static void dummyQueryDrawable (Display *dpy,
+ GLXDrawable draw,
+ int attribute,
+ unsigned int *value)
+{
+ // nop
+}
+
+static void dummySelectEvent (Display *dpy,
+ GLXDrawable draw,
+ unsigned long event_mask)
+{
+ // nop
+}
+
+/*
+ * Some immediate-mode GL functions which will be part of the static dispatch
+ * table.
+ */
+static void dummy_glBegin (void)
+{
+ // TODO
+}
+
+static void dummy_glVertex3fv(GLfloat *v)
+{
+ // TODO
+}
+
+static void dummy_glEnd (void)
+{
+ // TODO
+}
+
+
+static void dummyNopStub (void)
+{
+ // nop
+}
+
+// XXX non-entry point ABI functions
+static void *dummyGetProcAddress (const GLubyte *procName, void *data)
+{
+ return (void *)dummyNopStub;
+}
+
+static void dummyDestroyDispatchData(void *data)
+{
+ // nop
+}
+
+static void *dummyGetDispatchAddress (const GLubyte *procName)
+{
+ return NULL;
+}
+
+static void dummySetDispatchIndex (const GLubyte *procName, int index)
+{
+ // nop
+}
+
+static GLboolean dummyGetDispatchProto (const GLubyte *procName,
+ char ***function_names,
+ char **parameter_signature)
+{
+ return GL_FALSE;
+}
+
+
+static const __GLXapiImports dummyImports =
+{
+ /* Entry points */
+ .glx14ep = {
+ .chooseVisual = dummyChooseVisual,
+ .copyContext = dummyCopyContext,
+ .createContext = dummyCreateContext,
+ .createGLXPixmap = dummyCreateGLXPixmap,
+ .destroyContext = dummyDestroyContext,
+ .destroyGLXPixmap = dummyDestroyGLXPixmap,
+ .getConfig = dummyGetConfig,
+ .isDirect = dummyIsDirect,
+ .makeCurrent = dummyMakeCurrent,
+ .swapBuffers = dummySwapBuffers,
+ .useXFont = dummyUseXFont,
+ .waitGL = dummyWaitGL,
+ .waitX = dummyWaitX,
+ .queryServerString = dummyQueryServerString,
+ .getClientString = dummyGetClientString,
+ .queryExtensionsString = dummyQueryExtensionsString,
+ .chooseFBConfig = dummyChooseFBConfig,
+ .createNewContext = dummyCreateNewContext,
+ .createPbuffer = dummyCreatePbuffer,
+ .createPixmap = dummyCreatePixmap,
+ .createWindow = dummyCreateWindow,
+ .destroyPbuffer = dummyDestroyPbuffer,
+ .destroyPixmap = dummyDestroyPixmap,
+ .destroyWindow = dummyDestroyWindow,
+ .getFBConfigAttrib = dummyGetFBConfigAttrib,
+ .getFBConfigs = dummyGetFBConfigs,
+ .getSelectedEvent = dummyGetSelectedEvent,
+ .getVisualFromFBConfig = dummyGetVisualFromFBConfig,
+ .makeContextCurrent = dummyMakeContextCurrent,
+ .queryContext = dummyQueryContext,
+ .queryDrawable = dummyQueryDrawable,
+ .selectEvent = dummySelectEvent,
+ },
+
+ /* Non-entry points */
+ .glxvc = {
+ .getProcAddress = dummyGetProcAddress,
+ .destroyDispatchData = dummyDestroyDispatchData,
+ .getDispatchAddress = dummyGetDispatchAddress,
+ .setDispatchIndex = dummySetDispatchIndex,
+ .getDispatchProto = dummyGetDispatchProto
+ }
+};
+
+PUBLIC __GLX_MAIN_PROTO(version, exports, vendorName)
+{
+ thisVendorName = strdup(vendorName);
+ if (version <= GLX_VENDOR_ABI_VERSION) {
+ memcpy(&apiExports, exports, sizeof(*exports));
+ return &dummyImports;
+ } else {
+ return NULL;
+ }
+}
diff --git a/tests/GLX_dummy/GLX_dummy.h b/tests/GLX_dummy/GLX_dummy.h
new file mode 100644
index 0000000..c479028
--- /dev/null
+++ b/tests/GLX_dummy/GLX_dummy.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2013, NVIDIA CORPORATION.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and/or associated documentation files (the
+ * "Materials"), to deal in the Materials without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Materials, and to
+ * permit persons to whom the Materials are furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * unaltered in all copies or substantial portions of the Materials.
+ * Any additions, deletions, or changes to the original source files
+ * must be clearly indicated in accompanying documentation.
+ *
+ * If only executable code is distributed, then the accompanying
+ * documentation must state that "this software is based in part on the
+ * work of the Khronos Group."
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ */
+
+#ifndef __GLX_MAKECURRENT_H__
+#define __GLX_MAKECURRENT_H__
+
+#include <GL/gl.h>
+
+/*
+ * TODO: Will contain definition of the fake GL extension functions exported by
+ * the GLX_makecurrent vendor library used in the testglxmakecurrent test.
+ */
+
+#endif
diff --git a/tests/GLX_dummy/Makefile.am b/tests/GLX_dummy/Makefile.am
new file mode 100644
index 0000000..b15ee36
--- /dev/null
+++ b/tests/GLX_dummy/Makefile.am
@@ -0,0 +1,19 @@
+lib_LTLIBRARIES = libGLX_dummy.la
+
+check-local: libGLX_dummy_copy
+
+.PHONY : libGLX_dummy_copy
+
+# HACK to get multiple copies of the dummy library for testing
+libGLX_dummy_copy : libGLX_dummy.la
+ cp .libs/libGLX_dummy.so.0.0.0 .libs/libGLX_dummy_0.so.0
+ cp .libs/libGLX_dummy.so.0.0.0 .libs/libGLX_dummy_1.so.0
+
+GLX_ABI_DIR = $(top_builddir)/src/GLX
+
+libGLX_dummy_la_CFLAGS = \
+ -I$(GLX_ABI_DIR) \
+ -I$(top_builddir)/src/util \
+ -I$(top_builddir)/include \
+ -Wno-error=unused-function
+libGLX_dummy_la_SOURCES = GLX_dummy.c
diff --git a/tests/GLX_dummy/TODO b/tests/GLX_dummy/README
index 2356cf6..2356cf6 100644
--- a/tests/GLX_dummy/TODO
+++ b/tests/GLX_dummy/README