diff options
Diffstat (limited to 'xorg-server/glx')
30 files changed, 191 insertions, 1 deletions
diff --git a/xorg-server/glx/glheader.h b/xorg-server/glx/glheader.h new file mode 100644 index 000000000..1c0ee2c9e --- /dev/null +++ b/xorg-server/glx/glheader.h @@ -0,0 +1,24 @@ +#ifndef __GLHEADER_H__
+#define __GLHEADER_H__
+
+#define STDC_HEADERS 1
+
+#include <X11/Xwinsock.h>
+#include <X11/Xwindows.h>
+#include <assert.h>
+#define strcasecmp _stricmp
+
+#undef MINSHORT
+#undef MAXSHORT
+
+#define MINSHORT -32768
+#define MAXSHORT 32767
+
+#define PUBLIC
+
+#define GL_GLEXT_PROTOTYPES
+
+#define DRI_DRIVER_PATH "/usr/lib/dri"
+
+#endif
+
diff --git a/xorg-server/glx/glxcmds.c b/xorg-server/glx/glxcmds.c index ff8b126be..d95d0b116 100644 --- a/xorg-server/glx/glxcmds.c +++ b/xorg-server/glx/glxcmds.c @@ -32,6 +32,10 @@ #define FONT_PCF #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> +#else + +#include "glheader.h" + #endif #include <string.h> diff --git a/xorg-server/glx/glxcmdsswap.c b/xorg-server/glx/glxcmdsswap.c index 65edf6991..04b0a380b 100644 --- a/xorg-server/glx/glxcmdsswap.c +++ b/xorg-server/glx/glxcmdsswap.c @@ -32,6 +32,10 @@ #define FONT_PCF #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> +#else + +#include "glheader.h" + #endif #include <string.h> diff --git a/xorg-server/glx/glxdri.c b/xorg-server/glx/glxdri.c index 64606ab5a..ca868d2fc 100644 --- a/xorg-server/glx/glxdri.c +++ b/xorg-server/glx/glxdri.c @@ -29,10 +29,13 @@ #include <stdio.h> #include <string.h> #include <errno.h> +#ifndef _MSC_VER #include <sys/time.h> #include <dlfcn.h> #include <drm.h> +#endif + #include <GL/gl.h> #include <GL/internal/dri_interface.h> diff --git a/xorg-server/glx/glxdricommon.c b/xorg-server/glx/glxdricommon.c index faaa3b7ae..028c77842 100644 --- a/xorg-server/glx/glxdricommon.c +++ b/xorg-server/glx/glxdricommon.c @@ -25,6 +25,10 @@ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> +#else + +#include "glheader.h" + #endif #include <stdint.h> @@ -47,12 +51,16 @@ getUST(int64_t *ust) if (ust == NULL) return -EFAULT; +#ifdef _MSC_VER + __asm int 3; +#else if (gettimeofday(&tv, NULL) == 0) { ust[0] = (tv.tv_sec * 1000000) + tv.tv_usec; return 0; } else { return -errno; } + #endif } const __DRIsystemTimeExtension systemTimeExtension = { diff --git a/xorg-server/glx/glxdriswrast.c b/xorg-server/glx/glxdriswrast.c index f8c441e65..0a122d90a 100644 --- a/xorg-server/glx/glxdriswrast.c +++ b/xorg-server/glx/glxdriswrast.c @@ -26,6 +26,10 @@ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> +#else + +#include "glheader.h" + #endif #include <stdint.h> @@ -55,6 +59,14 @@ #include "dispatch.h" #include "extension_string.h" +#ifndef RTLD_LOCAL +#define RTLD_LOCAL 0 +#endif + +#ifdef _MSC_VER +#define dlerror() "Getting loadlibrary error string not implemented" +#endif + typedef struct __GLXDRIscreen __GLXDRIscreen; typedef struct __GLXDRIcontext __GLXDRIcontext; typedef struct __GLXDRIdrawable __GLXDRIdrawable; @@ -243,7 +255,11 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen) (*screen->core->destroyScreen)(screen->driScreen); +#ifdef _MSC_VER + FreeLibrary(screen->driver); +#else dlclose(screen->driver); +#endif __glXScreenDestroy(baseScreen); @@ -454,14 +470,22 @@ __glXDRIscreenProbe(ScreenPtr pScreen) snprintf(filename, sizeof filename, "%s/%s_dri.so", dri_driver_path, driverName); +#ifdef _MSC_VER + screen->driver = LoadLibrary(filename); +#else screen->driver = dlopen(filename, RTLD_LAZY | RTLD_LOCAL); +#endif if (screen->driver == NULL) { LogMessage(X_ERROR, "AIGLX error: dlopen of %s failed (%s)\n", filename, dlerror()); goto handle_error; } +#ifdef _MSC_VER + extensions = GetProcAddress(screen->driver, __DRI_DRIVER_EXTENSIONS); +#else extensions = dlsym(screen->driver, __DRI_DRIVER_EXTENSIONS); +#endif if (extensions == NULL) { LogMessage(X_ERROR, "AIGLX error: %s exports no extensions (%s)\n", driverName, dlerror()); @@ -509,7 +533,11 @@ __glXDRIscreenProbe(ScreenPtr pScreen) handle_error: if (screen->driver) +#ifdef _MSC_VER + FreeLibrary(screen->driver); +#else dlclose(screen->driver); +#endif xfree(screen); diff --git a/xorg-server/glx/glxext.c b/xorg-server/glx/glxext.c index ca1d2ec8d..1598e27a6 100644 --- a/xorg-server/glx/glxext.c +++ b/xorg-server/glx/glxext.c @@ -31,6 +31,10 @@ #define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> +#else + +#include "glheader.h" + #endif #include <string.h> diff --git a/xorg-server/glx/glxscreens.c b/xorg-server/glx/glxscreens.c index 95d35eb67..d232e888c 100644 --- a/xorg-server/glx/glxscreens.c +++ b/xorg-server/glx/glxscreens.c @@ -30,6 +30,10 @@ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> +#else + +#include "glheader.h" + #endif #include <GL/glxtokens.h> diff --git a/xorg-server/glx/glxserver.h b/xorg-server/glx/glxserver.h index a5ca0a20b..824bac07b 100644 --- a/xorg-server/glx/glxserver.h +++ b/xorg-server/glx/glxserver.h @@ -54,6 +54,7 @@ #define GL_GLEXT_PROTOTYPES /* we want prototypes */ #include <GL/gl.h> +#include <GL/glext.h> #include <GL/glxproto.h> #include <GL/glxint.h> diff --git a/xorg-server/glx/indirect_dispatch.c b/xorg-server/glx/indirect_dispatch.c index 6547f5d96..adb67c41c 100644 --- a/xorg-server/glx/indirect_dispatch.c +++ b/xorg-server/glx/indirect_dispatch.c @@ -24,6 +24,13 @@ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#else + +#include "glheader.h" + +#endif #include <X11/Xmd.h> #include <GL/gl.h> diff --git a/xorg-server/glx/indirect_dispatch_swap.c b/xorg-server/glx/indirect_dispatch_swap.c index 0b8c27cac..02fed4872 100644 --- a/xorg-server/glx/indirect_dispatch_swap.c +++ b/xorg-server/glx/indirect_dispatch_swap.c @@ -24,6 +24,13 @@ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#else + +#include "glheader.h" + +#endif #include <X11/Xmd.h> #include <GL/gl.h> diff --git a/xorg-server/glx/indirect_program.c b/xorg-server/glx/indirect_program.c index d23a0a9e6..421d9a0cb 100644 --- a/xorg-server/glx/indirect_program.c +++ b/xorg-server/glx/indirect_program.c @@ -32,6 +32,10 @@ #define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> +#else + +#include "glheader.h" + #endif #include "glxserver.h" diff --git a/xorg-server/glx/indirect_reqsize.c b/xorg-server/glx/indirect_reqsize.c index c47f01ee9..562b8e371 100644 --- a/xorg-server/glx/indirect_reqsize.c +++ b/xorg-server/glx/indirect_reqsize.c @@ -25,6 +25,13 @@ * SOFTWARE. */ +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#else + +#include "glheader.h" + +#endif #include <GL/gl.h> #include "glxserver.h" diff --git a/xorg-server/glx/indirect_size_get.c b/xorg-server/glx/indirect_size_get.c index 80f81dec6..7b8fa49cd 100644 --- a/xorg-server/glx/indirect_size_get.c +++ b/xorg-server/glx/indirect_size_get.c @@ -25,6 +25,13 @@ * SOFTWARE. */ +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#else + +#include "glheader.h" + +#endif #include <GL/gl.h> #include "indirect_size_get.h" @@ -888,7 +895,9 @@ __glGetTexLevelParameterfv_size(GLenum e) case GL_TEXTURE_INTENSITY_SIZE: /* case GL_TEXTURE_INTENSITY_SIZE_EXT:*/ case GL_TEXTURE_DEPTH: +#ifndef _MSC_VER case GL_TEXTURE_INDEX_SIZE_EXT: +#endif case GL_TEXTURE_COMPRESSED_IMAGE_SIZE: /* case GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB:*/ case GL_TEXTURE_COMPRESSED: diff --git a/xorg-server/glx/indirect_table.c b/xorg-server/glx/indirect_table.c index cb3202605..b5ac86a5a 100644 --- a/xorg-server/glx/indirect_table.c +++ b/xorg-server/glx/indirect_table.c @@ -25,6 +25,10 @@ * SOFTWARE. */ +#ifndef HAVE_DIX_CONFIG_H +#include "glheader.h" +#endif + #include <inttypes.h> #include "glxserver.h" #include "glxext.h" diff --git a/xorg-server/glx/indirect_texture_compression.c b/xorg-server/glx/indirect_texture_compression.c index 3c09663fc..bae82c360 100644 --- a/xorg-server/glx/indirect_texture_compression.c +++ b/xorg-server/glx/indirect_texture_compression.c @@ -26,6 +26,10 @@ #define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> +#else + +#include "glheader.h" + #endif #include "glxserver.h" diff --git a/xorg-server/glx/indirect_util.c b/xorg-server/glx/indirect_util.c index 58c194c99..b2ecc2578 100644 --- a/xorg-server/glx/indirect_util.c +++ b/xorg-server/glx/indirect_util.c @@ -25,6 +25,10 @@ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> +#else + +#include "glheader.h" + #endif #include <string.h> diff --git a/xorg-server/glx/makefile b/xorg-server/glx/makefile new file mode 100644 index 000000000..0debc92a0 --- /dev/null +++ b/xorg-server/glx/makefile @@ -0,0 +1,7 @@ +CSRCS=glapi.c glthread.c glxcmds.c glxcmdsswap.c glxdricommon.c glxext.c glxscreens.c \
+indirect_dispatch.c indirect_dispatch_swap.c indirect_program.c indirect_reqsize.c indirect_size_get.c indirect_table.c indirect_texture_compression.c \
+indirect_util.c render2.c render2swap.c renderpix.c renderpixswap.c rensize.c single2.c single2swap.c singlepix.c singlepixswap.c singlesize.c \
+swap_interval.c xfont.c glxdriswrast.c
+
+LIBRARY=libglx
+
diff --git a/xorg-server/glx/render2.c b/xorg-server/glx/render2.c index a86a22acb..db285f430 100644 --- a/xorg-server/glx/render2.c +++ b/xorg-server/glx/render2.c @@ -31,6 +31,10 @@ /* #define NEED_REPLIES */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> +#else + +#include "glheader.h" + #endif #include <glxserver.h> diff --git a/xorg-server/glx/render2swap.c b/xorg-server/glx/render2swap.c index 49449ff6f..f13b765eb 100644 --- a/xorg-server/glx/render2swap.c +++ b/xorg-server/glx/render2swap.c @@ -31,6 +31,10 @@ /* #define NEED_REPLIES */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> +#else + +#include "glheader.h" + #endif #include "glxserver.h" diff --git a/xorg-server/glx/renderpix.c b/xorg-server/glx/renderpix.c index 17deb33c4..b3ce012f7 100644 --- a/xorg-server/glx/renderpix.c +++ b/xorg-server/glx/renderpix.c @@ -31,6 +31,10 @@ #define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> +#else + +#include "glheader.h" + #endif #include "glxserver.h" diff --git a/xorg-server/glx/renderpixswap.c b/xorg-server/glx/renderpixswap.c index ebb20cfda..b71ca356e 100644 --- a/xorg-server/glx/renderpixswap.c +++ b/xorg-server/glx/renderpixswap.c @@ -31,6 +31,10 @@ #define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> +#else + +#include "glheader.h" + #endif #include "glxserver.h" diff --git a/xorg-server/glx/rensize.c b/xorg-server/glx/rensize.c index 5c6b1500d..aa8c6a0ab 100644 --- a/xorg-server/glx/rensize.c +++ b/xorg-server/glx/rensize.c @@ -30,6 +30,10 @@ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> +#else + +#include "glheader.h" + #endif #include <GL/gl.h> @@ -219,7 +223,9 @@ int __glXImageSize( GLenum format, GLenum type, GLenum target, case GL_422_AVERAGE_EXT: case GL_422_REV_AVERAGE_EXT: case GL_DEPTH_STENCIL_NV: +#ifndef _MSC_VER case GL_DEPTH_STENCIL_MESA: +#endif case GL_YCBCR_MESA: case GL_LUMINANCE_ALPHA: elementsPerGroup = 2; @@ -258,11 +264,13 @@ int __glXImageSize( GLenum format, GLenum type, GLenum target, case GL_UNSIGNED_SHORT_1_5_5_5_REV: case GL_UNSIGNED_SHORT_8_8_APPLE: case GL_UNSIGNED_SHORT_8_8_REV_APPLE: +#ifndef _MSC_VER case GL_UNSIGNED_SHORT_15_1_MESA: case GL_UNSIGNED_SHORT_1_15_REV_MESA: bytesPerElement = 2; elementsPerGroup = 1; break; +#endif case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: @@ -273,8 +281,10 @@ int __glXImageSize( GLenum format, GLenum type, GLenum target, case GL_UNSIGNED_INT_10_10_10_2: case GL_UNSIGNED_INT_2_10_10_10_REV: case GL_UNSIGNED_INT_24_8_NV: +#ifndef _MSC_VER case GL_UNSIGNED_INT_24_8_MESA: case GL_UNSIGNED_INT_8_24_REV_MESA: +#endif bytesPerElement = 4; elementsPerGroup = 1; break; diff --git a/xorg-server/glx/single2.c b/xorg-server/glx/single2.c index d8b259269..590efaa23 100644 --- a/xorg-server/glx/single2.c +++ b/xorg-server/glx/single2.c @@ -31,6 +31,10 @@ #define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> +#else + +#include "glheader.h" + #endif #include <string.h> @@ -336,6 +340,9 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap) string = (const char *) CALL_GetString( GET_DISPATCH(), (name) ); client = cl->client; + if (string == NULL) + string = ""; + /* ** Restrict extensions to those that are supported by both the ** implementation and the connection. That is, return the diff --git a/xorg-server/glx/single2swap.c b/xorg-server/glx/single2swap.c index fcb0657d4..9a716e041 100644 --- a/xorg-server/glx/single2swap.c +++ b/xorg-server/glx/single2swap.c @@ -31,6 +31,10 @@ #define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> +#else + +#include "glheader.h" + #endif #include "glxserver.h" diff --git a/xorg-server/glx/singlepix.c b/xorg-server/glx/singlepix.c index 6611b0380..24ee61d1a 100644 --- a/xorg-server/glx/singlepix.c +++ b/xorg-server/glx/singlepix.c @@ -31,6 +31,10 @@ #define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> +#else + +#include "glheader.h" + #endif #include "glxserver.h" diff --git a/xorg-server/glx/singlepixswap.c b/xorg-server/glx/singlepixswap.c index b546ec864..77ca7c479 100644 --- a/xorg-server/glx/singlepixswap.c +++ b/xorg-server/glx/singlepixswap.c @@ -31,6 +31,10 @@ #define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> +#else + +#include "glheader.h" + #endif #include "glxserver.h" diff --git a/xorg-server/glx/singlesize.c b/xorg-server/glx/singlesize.c index 9e95dd3d3..a9a2be66b 100644 --- a/xorg-server/glx/singlesize.c +++ b/xorg-server/glx/singlesize.c @@ -30,6 +30,10 @@ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> +#else + +#include "glheader.h" + #endif #include <GL/gl.h> diff --git a/xorg-server/glx/swap_interval.c b/xorg-server/glx/swap_interval.c index 24abd69fa..a136c950f 100644 --- a/xorg-server/glx/swap_interval.c +++ b/xorg-server/glx/swap_interval.c @@ -25,6 +25,10 @@ #define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> +#else + +#include "glheader.h" + #endif #include "glxserver.h" @@ -54,7 +58,7 @@ int DoSwapInterval(__GLXclientState *cl, GLbyte *pc, int do_swap) cx = __glXLookupContextByTag(cl, tag); - LogMessage(X_ERROR, "%s: cx = %p, GLX screen = %p\n", __func__, + LogMessage(X_ERROR, "%s: cx = %p, GLX screen = %p\n", __FUNCTION__ , cx, (cx == NULL) ? NULL : cx->pGlxScreen); if ((cx == NULL) || (cx->pGlxScreen == NULL)) { client->errorValue = tag; diff --git a/xorg-server/glx/xfont.c b/xorg-server/glx/xfont.c index 6df373a16..1230abe5b 100644 --- a/xorg-server/glx/xfont.c +++ b/xorg-server/glx/xfont.c @@ -31,6 +31,10 @@ #define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> +#else + +#include "glheader.h" + #endif #include "glxserver.h" |