summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@apple.com>2011-06-05 21:19:40 -0400
committerJeremy Huddleston <jeremyhu@apple.com>2011-06-13 23:10:41 -0700
commite004ac273d492354d1d7c8f4e77b8c9ceaa4a84e (patch)
treea61839c2149fa8ed8e6607200c4089781b6c0b94
parent9cbc705e83f31929fbcf4b0b582e14e0f0242e7f (diff)
apple: Fix build failures in applegl_glx.c
See https://bugs.freedesktop.org/show_bug.cgi?id=29162 Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> This commit squashes three cherry-picks: (cherry picked from commit 5d35343d12ab462100c9eec50a579b73463e465a) (cherry picked from commit 7c5f37c032231ad144a8a5c5a0b18f3e26c0aea7) (cherry picked from commit 2ee5272e1671aff8c8d9e0c12bf37ed006717283)
-rw-r--r--src/glx/apple/Makefile3
-rw-r--r--src/glx/applegl_glx.c45
2 files changed, 31 insertions, 17 deletions
diff --git a/src/glx/apple/Makefile b/src/glx/apple/Makefile
index 757e811691..1196701ad9 100644
--- a/src/glx/apple/Makefile
+++ b/src/glx/apple/Makefile
@@ -49,7 +49,8 @@ SOURCES = \
../glxextensions.c \
glxreply.c \
../pixel.c \
- ../xfont.c
+ ../xfont.c \
+ ../applegl_glx.c
include $(TOP)/src/mesa/sources.mak
diff --git a/src/glx/applegl_glx.c b/src/glx/applegl_glx.c
index 3da1f19323..9b8605f407 100644
--- a/src/glx/applegl_glx.c
+++ b/src/glx/applegl_glx.c
@@ -1,5 +1,6 @@
/*
* Copyright © 2010 Intel Corporation
+ * Copyright © 2011 Apple Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Soft-
@@ -32,6 +33,13 @@
#if defined(GLX_USE_APPLEGL)
+#include <stdbool.h>
+
+#include "glxclient.h"
+#include "apple_glx_context.h"
+#include "apple_glx.h"
+#include "glx_error.h"
+
static void
applegl_destroy_context(struct glx_context *gc)
{
@@ -42,13 +50,14 @@ static int
applegl_bind_context(struct glx_context *gc, struct glx_context *old,
GLXDrawable draw, GLXDrawable read)
{
+ Display *dpy = gc->psc->dpy;
bool error = apple_glx_make_current_context(dpy,
- (oldGC && oldGC != &dummyContext) ? oldGC->driContext : NUL~
+ (old && old != &dummyContext) ? old->driContext : NULL,
gc ? gc->driContext : NULL, draw);
apple_glx_diagnostic("%s: error %s\n", __func__, error ? "YES" : "NO");
if (error)
- return GLXBadContext;
+ return 1; /* GLXBadContext is the same as Success (0) */
return Success;
}
@@ -67,7 +76,8 @@ applegl_wait_gl(struct glx_context *gc)
static void
applegl_wait_x(struct glx_context *gc)
{
- apple_glx_waitx(gc->dpy, gc->driContext);
+ Display *dpy = gc->psc->dpy;
+ apple_glx_waitx(dpy, gc->driContext);
}
static const struct glx_context_vtable applegl_context_vtable = {
@@ -81,24 +91,25 @@ static const struct glx_context_vtable applegl_context_vtable = {
NULL, /* release_tex_image, */
};
-static struct glx_context *
+struct glx_context *
applegl_create_context(struct glx_screen *psc,
- struct glx_config *mode,
+ struct glx_config *config,
struct glx_context *shareList, int renderType)
{
struct glx_context *gc;
int errorcode;
bool x11error;
+ Display *dpy = psc->dpy;
+ int screen = psc->scr;
/* TODO: Integrate this with apple_glx_create_context and make
* struct apple_glx_context inherit from struct glx_context. */
- gc = Xmalloc(sizeof *gc);
- if (pcp == NULL)
+ gc = Xcalloc(1, sizeof (*gc));
+ if (gc == NULL)
return NULL;
- memset(gc, 0, sizeof *gc);
- if (!glx_context_init(&gc->base, &psc->base, mode)) {
+ if (!glx_context_init(gc, psc, config)) {
Xfree(gc);
return NULL;
}
@@ -108,7 +119,7 @@ applegl_create_context(struct glx_screen *psc,
gc->do_destroy = False;
/* TODO: darwin: Integrate with above to do indirect */
- if(apple_glx_create_context(&gc->driContext, dpy, screen, fbconfig,
+ if(apple_glx_create_context(&gc->driContext, dpy, screen, config,
shareList ? shareList->driContext : NULL,
&errorcode, &x11error)) {
__glXSendError(dpy, errorcode, 0, X_GLXCreateContext, x11error);
@@ -117,15 +128,15 @@ applegl_create_context(struct glx_screen *psc,
}
gc->currentContextTag = -1;
- gc->mode = fbconfig;
- gc->isDirect = allowDirect;
+ gc->config = config;
+ gc->isDirect = GL_TRUE;
gc->xid = 1; /* Just something not None, so we know when to destroy
* it in MakeContextCurrent. */
return gc;
}
-struct glx_screen_vtable appegl_screen_vtable = {
+struct glx_screen_vtable applegl_screen_vtable = {
applegl_create_context
};
@@ -146,10 +157,12 @@ applegl_create_screen(int screen, struct glx_display * priv)
}
_X_HIDDEN int
-applegl_create_display(struct glx_display *display)
+applegl_create_display(struct glx_display *glx_dpy)
{
- /* create applegl display and stuff in display->appleglDisplay */
- apple_init_glx(display);
+ if(!apple_init_glx(glx_dpy->dpy))
+ return 1;
+
+ return GLXBadContext;
}
#endif