diff options
Diffstat (limited to 'xorg-server/glx/glxdriswrast.c')
-rw-r--r-- | xorg-server/glx/glxdriswrast.c | 56 |
1 files changed, 44 insertions, 12 deletions
diff --git a/xorg-server/glx/glxdriswrast.c b/xorg-server/glx/glxdriswrast.c index 30ce19ed1..4cabf6451 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>
@@ -61,6 +65,10 @@ #endif
#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;
@@ -77,7 +85,7 @@ struct __GLXDRIscreen { };
struct __GLXDRIcontext {
- __GLXcontext base;
+ struct glx_context base;
__DRIcontext *driContext;
};
@@ -130,7 +138,7 @@ __glXDRIdrawableCopySubBuffer(__GLXdrawable *basePrivate, }
static void
-__glXDRIcontextDestroy(__GLXcontext *baseContext)
+__glXDRIcontextDestroy(struct glx_context *baseContext)
{
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
@@ -141,7 +149,7 @@ __glXDRIcontextDestroy(__GLXcontext *baseContext) }
static int
-__glXDRIcontextMakeCurrent(__GLXcontext *baseContext)
+__glXDRIcontextMakeCurrent(struct glx_context *baseContext)
{
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
@@ -154,7 +162,7 @@ __glXDRIcontextMakeCurrent(__GLXcontext *baseContext) }
static int
-__glXDRIcontextLoseCurrent(__GLXcontext *baseContext)
+__glXDRIcontextLoseCurrent(struct glx_context *baseContext)
{
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
@@ -163,7 +171,7 @@ __glXDRIcontextLoseCurrent(__GLXcontext *baseContext) }
static int
-__glXDRIcontextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc,
+__glXDRIcontextCopy(struct glx_context *baseDst, struct glx_context *baseSrc,
unsigned long mask)
{
__GLXDRIcontext *dst = (__GLXDRIcontext *) baseDst;
@@ -175,7 +183,7 @@ __glXDRIcontextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc, }
static int
-__glXDRIcontextForceCurrent(__GLXcontext *baseContext)
+__glXDRIcontextForceCurrent(struct glx_context *baseContext)
{
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
@@ -190,7 +198,7 @@ __glXDRIcontextForceCurrent(__GLXcontext *baseContext) #ifdef __DRI_TEX_BUFFER
static int
-__glXDRIbindTexImage(__GLXcontext *baseContext,
+__glXDRIbindTexImage(struct glx_context *baseContext,
int buffer,
__GLXdrawable *glxPixmap)
{
@@ -209,7 +217,7 @@ __glXDRIbindTexImage(__GLXcontext *baseContext, }
static int
-__glXDRIreleaseTexImage(__GLXcontext *baseContext,
+__glXDRIreleaseTexImage(struct glx_context *baseContext,
int buffer,
__GLXdrawable *pixmap)
{
@@ -220,7 +228,7 @@ __glXDRIreleaseTexImage(__GLXcontext *baseContext, #else
static int
-__glXDRIbindTexImage(__GLXcontext *baseContext,
+__glXDRIbindTexImage(struct glx_context *baseContext,
int buffer,
__GLXdrawable *glxPixmap)
{
@@ -228,7 +236,7 @@ __glXDRIbindTexImage(__GLXcontext *baseContext, }
static int
-__glXDRIreleaseTexImage(__GLXcontext *baseContext,
+__glXDRIreleaseTexImage(struct glx_context *baseContext,
int buffer,
__GLXdrawable *pixmap)
{
@@ -249,17 +257,21 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen) (*screen->core->destroyScreen)(screen->driScreen);
+#ifdef _MSC_VER
+ FreeLibrary(screen->driver);
+#else
dlclose(screen->driver);
+#endif
__glXScreenDestroy(baseScreen);
free(screen);
}
-static __GLXcontext *
+static struct glx_context *
__glXDRIscreenCreateContext(__GLXscreen *baseScreen,
__GLXconfig *glxConfig,
- __GLXcontext *baseShareContext)
+ struct glx_context *baseShareContext)
{
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
__GLXDRIcontext *context, *shareContext;
@@ -449,17 +461,33 @@ __glXDRIscreenProbe(ScreenPtr pScreen) screen->base.swapInterval = NULL;
screen->base.pScreen = pScreen;
+#ifdef _MSC_VER
+#ifdef _DEBUG
+#define DLLNAME "%s%s_dri_dbg.dll"
+#else
+#define DLLNAME "%s%s_dri.dll"
+#endif
+ snprintf(filename, sizeof filename,
+ DLLNAME, dri_driver_path, driverName);
+
+ screen->driver = LoadLibrary(filename);
+#else
snprintf(filename, sizeof filename,
"%s/%s_dri.so", dri_driver_path, driverName);
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 = (const __DRIextension **)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());
@@ -514,7 +542,11 @@ __glXDRIscreenProbe(ScreenPtr pScreen) handle_error:
if (screen->driver)
+#ifdef _MSC_VER
+ FreeLibrary(screen->driver);
+#else
dlclose(screen->driver);
+#endif
free(screen);
|