From ad503c41557606d15b0420c824369456f6d20a8f Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Thu, 1 Apr 2010 11:01:31 -0700 Subject: apple: Initial import of libGL for OSX from AppleSGLX svn repository. Signed-off-by: Jeremy Huddleston --- src/glx/apple/Makefile | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 src/glx/apple/Makefile (limited to 'src/glx/apple/Makefile') diff --git a/src/glx/apple/Makefile b/src/glx/apple/Makefile new file mode 100644 index 0000000000..314dd4d396 --- /dev/null +++ b/src/glx/apple/Makefile @@ -0,0 +1,97 @@ +INSTALL_DIR = /usr/X11 +X11_DIR = $(INSTALL_DIR) + +CC=gcc +GL_CFLAGS=-Wall -ggdb3 -Os -DPTHREADS -D_REENTRANT -DGLX_USE_APPLEGL -DGLX_ALIAS_UNSUPPORTED $(RC_CFLAGS) $(CFLAGS) +GL_LDFLAGS=-L$(INSTALL_DIR)/lib -L$(X11_DIR)/lib $(LDFLAGS) -Wl,-single_module + +TCLSH=tclsh8.5 + +MKDIR=mkdir +INSTALL=install +LN=ln +RM=rm + +INCLUDE=-I. -Iinclude -Iinclude/internal -I.. -I../../../include -I$(INSTALL_DIR)/include -I$(X11_DIR)/include +COMPILE=$(CC) $(INCLUDE) $(GL_CFLAGS) -c + +#The directory with the final binaries. +BUILD_DIR=builds + +all: $(BUILD_DIR)/libGL.1.2.dylib + +OBJECTS=glxext.o glxcmds.o glx_pbuffer.o glx_query.o glxcurrent.o glxextensions.o \ + appledri.o apple_glx_context.o apple_glx.o pixel.o \ + compsize.o apple_visual.o apple_cgl.o glxreply.o glcontextmodes.o \ + apple_xgl_api.o apple_glx_drawable.o xfont.o apple_glx_pbuffer.o \ + apple_glx_pixmap.o apple_xgl_api_read.o glx_empty.o glx_error.o \ + apple_xgl_api_viewport.o apple_glx_surface.o apple_xgl_api_stereo.o + +$(BUILD_DIR)/libGL.1.2.dylib: $(OBJECTS) + -if ! test -d $(BUILD_DIR); then $(MKDIR) $(BUILD_DIR); fi + $(CC) $(GL_CFLAGS) -o $@ -dynamiclib -install_name $(INSTALL_DIR)/lib/libGL.1.dylib -compatibility_version 1.2 -current_version 1.2 -lXplugin -framework ApplicationServices -framework CoreFoundation $(GL_LDFLAGS) -lXext -lX11 -Wl,-exported_symbols_list,exports.list $(OBJECTS) + +.c.o: + $(COMPILE) $< + +apple_glx_drawable.o: apple_glx_drawable.h apple_glx_drawable.c include/GL/gl.h +apple_xgl_api.o: apple_xgl_api.h apple_xgl_api.c apple_xgl_api_stereo.c include/GL/gl.h +apple_xgl_api_read.o: apple_xgl_api_read.h apple_xgl_api_read.c apple_xgl_api.h include/GL/gl.h +apple_xgl_api_viewport.o: apple_xgl_api_viewport.h apple_xgl_api_viewport.c apple_xgl_api.h include/GL/gl.h +apple_xgl_api_stereo.o: apple_xgl_api_stereo.h apple_xgl_api_stereo.c apple_xgl_api.h include/GL/gl.h +glcontextmodes.o: glcontextmodes.c include/GL/gl.h +glxext.o: glxext.c include/GL/gl.h +glxreply.o: glxreply.c include/GL/gl.h +glxcmds.o: glxcmds.c apple_glx_context.h include/GL/gl.h +glx_pbuffer.o: glx_pbuffer.c include/GL/gl.h +glx_error.o: glx_error.c include/GL/gl.h +glx_query.o: glx_query.c include/GL/gl.h +glxcurrent.o: glxcurrent.c include/GL/gl.h +glxextensions.o: glxextensions.c include/GL/gl.h +glxhash.o: glxhash.h glxhash.c include/GL/gl.h +appledri.o: appledri.h appledristr.h appledri.c include/GL/gl.h +apple_glx_context.o: apple_glx_context.c apple_glx_context.h apple_glx_context.h include/GL/gl.h +apple_glx.o: apple_glx.h apple_glx.c apple_xgl_api.h include/GL/gl.h +apple_visual.o: apple_visual.h apple_visual.c include/GL/gl.h +apple_cgl.o: apple_cgl.h apple_cgl.c include/GL/gl.h +apple_glx_pbuffer.o: apple_glx_drawable.h apple_glx_pbuffer.c include/GL/gl.h +apple_glx_pixmap.o: apple_glx_drawable.h apple_glx_pixmap.c appledri.h include/GL/gl.h +apple_glx_surface.o: apple_glx_drawable.h apple_glx_surface.c appledri.h include/GL/gl.h +xfont.o: xfont.c include/GL/gl.h +compsize.o: compsize.c include/GL/gl.h +renderpix.o: renderpix.c include/GL/gl.h +singlepix.o: singlepix.c include/GL/gl.h +pixel.o: pixel.c include/GL/gl.h +glx_empty.o: glx_empty.c include/GL/gl.h + +apple_xgl_api.c: apple_xgl_api.h +apple_xgl_api.h: gen_api_header.tcl gen_api_library.tcl gen_code.tcl gen_defs.tcl gen_exports.tcl gen_funcs.tcl gen_types.tcl + $(TCLSH) gen_code.tcl + +include/GL/gl.h: include/GL/gl.h.template gen_gl_h.sh + ./gen_gl_h.sh include/GL/gl.h.template $@ + +install_headers: include/GL/gl.h + $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL + $(INSTALL) -m 644 include/GL/gl.h include/GL/glext.h include/GL/glx.h include/GL/glxext.h $(DESTDIR)$(INSTALL_DIR)/include/GL + +install_libraries: $(BUILD_DIR)/libGL.1.2.dylib + $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/lib + $(INSTALL) -m 755 $(BUILD_DIR)/libGL.1.2.dylib $(DESTDIR)$(INSTALL_DIR)/lib + $(RM) -f $(DESTDIR)$(INSTALL_DIR)/lib/libGL.dylib + $(LN) -s libGL.1.2.dylib $(DESTDIR)$(INSTALL_DIR)/lib/libGL.dylib + $(RM) -f $(DESTDIR)$(INSTALL_DIR)/lib/libGL.1.dylib + $(LN) -s libGL.1.2.dylib $(DESTDIR)$(INSTALL_DIR)/lib/libGL.1.dylib + +install: install_headers install_libraries + +clean: + rm -rf $(BUILD_DIR) + rm -f *.o *.a + rm -f *.c~ *.h~ + rm -f apple_xgl_api.h apple_xgl_api.c + rm -f *.dylib + rm -f include/GL/gl.h + +%.c : ../%.c + ln -s $< -- cgit v1.2.3 From 80b280db883edc9550484dba03bd5c124b6a9bf9 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Fri, 2 Apr 2010 01:35:19 -0700 Subject: apple: Change ifdefs for DRI to be DRI && !APPLE Signed-off-by: Jeremy Huddleston --- src/glx/XF86dri.c | 2 +- src/glx/apple/Makefile | 4 +- src/glx/apple/apple_xgl_api_read.c | 6 +-- src/glx/apple/apple_xgl_api_stereo.c | 4 +- src/glx/apple/apple_xgl_api_viewport.c | 4 +- src/glx/dri2_glx.c | 2 +- src/glx/dri_common.c | 2 +- src/glx/dri_glx.c | 2 +- src/glx/drisw_glx.c | 2 +- src/glx/glx_pbuffer.c | 6 +-- src/glx/glxclient.h | 33 +++++------- src/glx/glxcmds.c | 97 ++++++++++++++++------------------ src/glx/glxcurrent.c | 20 +++---- src/glx/glxext.c | 10 ++-- src/glx/indirect.c | 30 +++++------ src/glx/singlepix.c | 2 +- src/glx/xfont.c | 2 +- 17 files changed, 108 insertions(+), 120 deletions(-) (limited to 'src/glx/apple/Makefile') diff --git a/src/glx/XF86dri.c b/src/glx/XF86dri.c index fdbdd43000..d0e88805bc 100644 --- a/src/glx/XF86dri.c +++ b/src/glx/XF86dri.c @@ -36,7 +36,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* THIS IS NOT AN X CONSORTIUM STANDARD */ -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) #define NEED_REPLIES #include diff --git a/src/glx/apple/Makefile b/src/glx/apple/Makefile index 314dd4d396..4c05013f3f 100644 --- a/src/glx/apple/Makefile +++ b/src/glx/apple/Makefile @@ -2,7 +2,7 @@ INSTALL_DIR = /usr/X11 X11_DIR = $(INSTALL_DIR) CC=gcc -GL_CFLAGS=-Wall -ggdb3 -Os -DPTHREADS -D_REENTRANT -DGLX_USE_APPLEGL -DGLX_ALIAS_UNSUPPORTED $(RC_CFLAGS) $(CFLAGS) +GL_CFLAGS=-Wall -ggdb3 -Os -DPTHREADS -D_REENTRANT -DGLX_DIRECT_RENDERING -DGLX_USE_APPLEGL -DGLX_ALIAS_UNSUPPORTED $(RC_CFLAGS) $(CFLAGS) GL_LDFLAGS=-L$(INSTALL_DIR)/lib -L$(X11_DIR)/lib $(LDFLAGS) -Wl,-single_module TCLSH=tclsh8.5 @@ -12,7 +12,7 @@ INSTALL=install LN=ln RM=rm -INCLUDE=-I. -Iinclude -Iinclude/internal -I.. -I../../../include -I$(INSTALL_DIR)/include -I$(X11_DIR)/include +INCLUDE=-I. -Iinclude -Iinclude/internal -I.. -I../../../include -I../../../src/mesa -I../../../src/mesa/glapi -I$(INSTALL_DIR)/include -I$(X11_DIR)/include COMPILE=$(CC) $(INCLUDE) $(GL_CFLAGS) -c #The directory with the final binaries. diff --git a/src/glx/apple/apple_xgl_api_read.c b/src/glx/apple/apple_xgl_api_read.c index 3dcb31b71a..36357c7fc2 100644 --- a/src/glx/apple/apple_xgl_api_read.c +++ b/src/glx/apple/apple_xgl_api_read.c @@ -68,10 +68,10 @@ SetRead(struct apple_xgl_saved_state *saved) saved->swapped = true; - if (apple_glx_make_current_context(dpy, gc->apple, gc->apple, + if (apple_glx_make_current_context(dpy, gc->driContext, gc->driContext, gc->currentReadable)) { /* An error occurred, so try to restore the old context state. */ - (void) apple_glx_make_current_context(dpy, gc->apple, gc->apple, + (void) apple_glx_make_current_context(dpy, gc->driContext, gc->driContext, gc->currentDrawable); saved->swapped = false; } @@ -85,7 +85,7 @@ UnsetRead(struct apple_xgl_saved_state *saved) GLXContext gc = __glXGetCurrentContext(); Display *dpy = glXGetCurrentDisplay(); - if (apple_glx_make_current_context(dpy, gc->apple, gc->apple, + if (apple_glx_make_current_context(dpy, gc->driContext, gc->driContext, gc->currentDrawable)) { /* * An error occurred restoring the drawable. diff --git a/src/glx/apple/apple_xgl_api_stereo.c b/src/glx/apple/apple_xgl_api_stereo.c index b50e3119cd..7dd946f764 100644 --- a/src/glx/apple/apple_xgl_api_stereo.c +++ b/src/glx/apple/apple_xgl_api_stereo.c @@ -42,7 +42,7 @@ glDrawBuffer(GLenum mode) { GLXContext gc = glXGetCurrentContext(); - if (gc && apple_glx_context_uses_stereo(gc->apple)) { + if (gc && apple_glx_context_uses_stereo(gc->driContext)) { GLenum buf[2]; GLsizei n = 0; @@ -77,7 +77,7 @@ glDrawBuffers(GLsizei n, const GLenum * bufs) { GLXContext gc = glXGetCurrentContext(); - if (gc && apple_glx_context_uses_stereo(gc->apple)) { + if (gc && apple_glx_context_uses_stereo(gc->driContext)) { GLenum newbuf[n + 2]; GLsizei i, outi = 0; bool have_back = false; diff --git a/src/glx/apple/apple_xgl_api_viewport.c b/src/glx/apple/apple_xgl_api_viewport.c index d3fbc7c41e..f556eefa22 100644 --- a/src/glx/apple/apple_xgl_api_viewport.c +++ b/src/glx/apple/apple_xgl_api_viewport.c @@ -38,8 +38,8 @@ glViewport(GLint x, GLint y, GLsizei width, GLsizei height) GLXContext gc = __glXGetCurrentContext(); Display *dpy = glXGetCurrentDisplay(); - if (gc && gc->apple) - apple_glx_context_update(dpy, gc->apple); + if (gc && gc->driContext) + apple_glx_context_update(dpy, gc->driContext); __gl_api.Viewport(x, y, width, height); } diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index fa2b987853..86b0a27648 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -30,7 +30,7 @@ * Kristian Høgsberg (krh@redhat.com) */ -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) #include #include diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c index e4034161bb..d6ce681d70 100644 --- a/src/glx/dri_common.c +++ b/src/glx/dri_common.c @@ -33,7 +33,7 @@ * Kristian Høgsberg (krh@redhat.com) */ -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) #include #include diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c index e47db82b70..74afa60301 100644 --- a/src/glx/dri_glx.c +++ b/src/glx/dri_glx.c @@ -32,7 +32,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) #include #include diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c index 1b94a56fd1..d8027cc96d 100644 --- a/src/glx/drisw_glx.c +++ b/src/glx/drisw_glx.c @@ -21,7 +21,7 @@ * SOFTWARE. */ -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) #include #include "glxclient.h" diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c index 143cf87766..6c34cda154 100644 --- a/src/glx/glx_pbuffer.c +++ b/src/glx/glx_pbuffer.c @@ -325,7 +325,7 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable, } } -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) { __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL); @@ -391,7 +391,7 @@ CreateDrawable(Display * dpy, const __GLcontextModes * fbconfig, UnlockDisplay(dpy); SyncHandle(); -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) do { /* FIXME: Maybe delay __DRIdrawable creation until the drawable * is actually bound to a context... */ @@ -455,7 +455,7 @@ DestroyDrawable(Display * dpy, GLXDrawable drawable, CARD32 glxCode) UnlockDisplay(dpy); SyncHandle(); -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) { int screen; __GLXdisplayPrivate *const priv = __glXInitialize(dpy); diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h index 3519c20a7f..958e1526c9 100644 --- a/src/glx/glxclient.h +++ b/src/glx/glxclient.h @@ -54,9 +54,7 @@ #include "GL/glxint.h" #include "GL/glxproto.h" #include "GL/internal/glcore.h" -#ifndef GLX_USE_APPLEGL #include "glapi/glapitable.h" -#endif #include "glxhash.h" #if defined( PTHREADS ) # include @@ -99,8 +97,13 @@ typedef struct _glapi_table __GLapi; #define containerOf(ptr, type, member) \ (type *)( (char *)ptr - offsetof(type,member) ) -#include +extern void DRI_glXUseXFont(Font font, int first, int count, int listbase); + +#endif + +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) +#include /** * Display dependent methods. This structure is initialized during the @@ -187,8 +190,6 @@ extern __GLXDRIdisplay *dri2CreateDisplay(Display * dpy); extern void dri2InvalidateBuffers(Display *dpy, XID drawable); -extern void DRI_glXUseXFont(Font font, int first, int count, int listbase); - /* ** Functions to obtain driver configuration information from a direct ** rendering client application @@ -199,10 +200,6 @@ extern const char *glXGetDriverConfig(const char *driverName); #endif -#ifdef GLX_USE_APPLEGL -extern void DRI_glXUseXFont( Font font, int first, int count, int listbase ); -#endif - /************************************************************************/ #define __GL_CLIENT_ATTRIB_STACK_DEPTH 16 @@ -411,8 +408,13 @@ struct __GLXcontextRec const __GLcontextModes *mode; #ifdef GLX_DIRECT_RENDERING +#ifdef GLX_USE_APPLEGL + void *driContext; + Bool do_destroy; +#else __GLXDRIcontext *driContext; __DRIcontext *__driContext; +#endif #endif /** @@ -455,11 +457,6 @@ struct __GLXcontextRec unsigned long thread_id; char gl_extension_bits[__GL_EXT_BYTES]; - -#ifdef GLX_USE_APPLEGL - void *apple; - Bool do_destroy; -#endif }; #define __glXSetError(gc,code) \ @@ -514,7 +511,7 @@ struct __GLXscreenConfigsRec */ char *effectiveGLXexts; -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) /** * Per screen direct rendering interface functions and data. */ @@ -625,7 +622,7 @@ struct __GLXdisplayPrivateRec */ __GLXscreenConfigs *screenConfigs; -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) /** * Per display direct rendering interface functions and data. */ @@ -638,14 +635,12 @@ struct __GLXdisplayPrivateRec extern GLubyte *__glXFlushRenderBuffer(__GLXcontext *, GLubyte *); -#ifndef GLX_USE_APPLEGL extern void __glXSendLargeChunk(__GLXcontext * gc, GLint requestNumber, GLint totalRequests, const GLvoid * data, GLint dataLen); extern void __glXSendLargeCommand(__GLXcontext *, const GLvoid *, GLint, const GLvoid *, GLint); -#endif /* Initialize the GLX extension for dpy */ extern __GLXdisplayPrivate *__glXInitialize(Display *); @@ -805,7 +800,7 @@ extern GLboolean __glXGetMscRateOML(Display * dpy, GLXDrawable drawable, int32_t * numerator, int32_t * denominator); -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) GLboolean __driGetMscRateOML(__DRIdrawable * draw, int32_t * numerator, int32_t * denominator, void *private); diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c index 50802b7e1f..e9ec4c88c6 100644 --- a/src/glx/glxcmds.c +++ b/src/glx/glxcmds.c @@ -34,21 +34,22 @@ */ #include "glxclient.h" +#include "glapi.h" +#include "glxextensions.h" +#include "glcontextmodes.h" + +#ifdef GLX_DIRECT_RENDERING #ifdef GLX_USE_APPLEGL #include "apple_glx_context.h" #include "apple_glx.h" #include "glx_error.h" +#define GC_IS_DIRECT(gc) ((gc)->isDirect) #else -#include "glapi.h" -#endif -#include "glxextensions.h" -#include "glcontextmodes.h" - -#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) #include #include #include "xf86dri.h" #define GC_IS_DIRECT(gc) ((gc)->driContext != NULL) +#endif #else #define GC_IS_DIRECT(gc) (0) #endif @@ -65,7 +66,7 @@ static const char __glXGLXClientVersion[] = "1.4"; /****************************************************************************/ -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) static Bool windowExistsFlag; static int @@ -352,7 +353,7 @@ AllocateGLXContext(Display * dpy) gc->maxSmallRenderCommandSize = bufSize; #ifdef GLX_USE_APPLEGL - gc->apple = NULL; + gc->driContext = NULL; gc->do_destroy = False; #endif @@ -378,11 +379,12 @@ CreateContext(Display * dpy, int generic_id, { GLXContext gc; #ifdef GLX_DIRECT_RENDERING +#ifdef GLX_USE_APPLEGL + int errorcode; + bool x11error; +#else __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen); #endif -#ifdef GLX_USE_APPLEGL - int errorcode; - bool x11error; #endif if (dpy == NULL) @@ -395,7 +397,7 @@ CreateContext(Display * dpy, int generic_id, if (!gc) return NULL; -#ifndef GLX_USE_APPLEGL +#ifndef GLX_USE_APPLEGL /* TODO: darwin indirect */ #ifdef GLX_DIRECT_RENDERING if (allowDirect && psc->driScreen) { gc->driContext = psc->driScreen->createContext(psc, fbconfig, gc, @@ -475,9 +477,12 @@ CreateContext(Display * dpy, int generic_id, #endif gc->imported = GL_FALSE; + gc->renderType = renderType; + + /* TODO: darwin: Integrate with above to do indirect */ #ifdef GLX_USE_APPLEGL - if(apple_glx_create_context(&gc->apple, dpy, screen, fbconfig, - shareList ? shareList->apple : NULL, + if(apple_glx_create_context(&gc->driContext, dpy, screen, fbconfig, + shareList ? shareList->driContext : NULL, &errorcode, &x11error)) { __glXSendError(dpy, errorcode, 0, X_GLXCreateContext, x11error); __glXFreeContext(gc); @@ -487,8 +492,6 @@ CreateContext(Display * dpy, int generic_id, gc->currentContextTag = -1; gc->mode = fbconfig; gc->isDirect = allowDirect; -#else - gc->renderType = renderType; #endif return gc; @@ -536,7 +539,7 @@ __glXFreeContext(__GLXcontext * gc) XFree((char *) gc->version); if (gc->extensions) XFree((char *) gc->extensions); -#ifndef GLX_USE_APPLEGL +#ifndef GLX_USE_APPLEGL /* TODO: clientattrib */ __glFreeAttributeState(gc); #endif XFree((char *) gc->buf); @@ -551,7 +554,7 @@ __glXFreeContext(__GLXcontext * gc) static void DestroyContext(Display * dpy, GLXContext gc) { -#ifndef GLX_USE_APPLEGL +#ifndef GLX_USE_APPLEGL /* TODO: darwin: indirect */ xGLXDestroyContextReq *req; GLXContextID xid; CARD8 opcode; @@ -577,7 +580,7 @@ DestroyContext(Display * dpy, GLXContext gc) return; } -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) /* Destroy the direct rendering context */ if (gc->driContext) { (*gc->driContext->destroyContext) (gc->driContext, gc->psc, dpy); @@ -606,8 +609,8 @@ DestroyContext(Display * dpy, GLXContext gc) /* Destroy the handle if not current to anybody */ __glXUnlock(); #ifdef GLX_USE_APPLEGL - if(gc->apple) - apple_glx_destroy_context(&gc->apple, dpy); + if(gc->driContext) + apple_glx_destroy_context(&gc->driContext, dpy); #endif __glXFreeContext(gc); } @@ -694,7 +697,7 @@ glXWaitGL(void) #ifdef GLX_USE_APPLEGL glFinish(); #else -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->driContext) { int screen; __GLXDRIdrawable *pdraw = @@ -741,9 +744,9 @@ glXWaitX(void) __glXFlushRenderBuffer(gc, gc->pc); #ifdef GLX_USE_APPLEGL - apple_glx_waitx(dpy, gc->apple); + apple_glx_waitx(dpy, gc->driContext); #else -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->driContext) { int screen; __GLXDRIdrawable *pdraw = @@ -790,7 +793,7 @@ glXUseXFont(Font font, int first, int count, int listBase) #ifdef GLX_USE_APPLEGL DRI_glXUseXFont(font, first, count, listBase); #else -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->driContext) { DRI_glXUseXFont(font, first, count, listBase); return; @@ -827,7 +830,7 @@ glXCopyContext(Display * dpy, GLXContext source, int errorcode; bool x11error; - if(apple_glx_copy_context(gc->apple, source->apple, dest->apple, + if(apple_glx_copy_context(gc->driContext, source->driContext, dest->driContext, mask, &errorcode, &x11error)) { __glXSendError(dpy, errorcode, 0, X_GLXCopyContext, x11error); } @@ -843,7 +846,7 @@ glXCopyContext(Display * dpy, GLXContext source, return; } -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->driContext) { /* NOT_DONE: This does not work yet */ } @@ -875,7 +878,6 @@ glXCopyContext(Display * dpy, GLXContext source, } -#ifndef GLX_USE_APPLEGL /** * Determine if a context uses direct rendering. * @@ -887,6 +889,9 @@ glXCopyContext(Display * dpy, GLXContext source, static Bool __glXIsDirect(Display * dpy, GLXContextID contextID) { +#ifndef GLX_USE_APPLEGL /* TODO: apple indirect */ + return GC_IS_DIRECT(gc); +#else #if !defined(USE_XCB) xGLXIsDirectReq *req; xGLXIsDirectReply reply; @@ -922,8 +927,8 @@ __glXIsDirect(Display * dpy, GLXContextID contextID) return reply.isDirect; #endif /* USE_XCB */ -} #endif /* GLX_USE_APPLEGL */ +} /** * \todo @@ -934,17 +939,6 @@ __glXIsDirect(Display * dpy, GLXContextID contextID) PUBLIC Bool glXIsDirect(Display * dpy, GLXContext gc) { -#ifdef GLX_USE_APPLEGL - /* - * This isn't an ideal test. - * glXIsDirect should probably search a list of contexts. - */ - if(NULL == gc) { - __glXSendError(dpy, GLXBadContext, 0, X_GLXIsDirect, false); - return False; - } - return gc->isDirect; -#else if (!gc) { return GL_FALSE; } @@ -952,7 +946,6 @@ glXIsDirect(Display * dpy, GLXContext gc) return GL_TRUE; } return __glXIsDirect(dpy, gc->xid); -#endif /* GLX_USE_APPLEGL */ } PUBLIC GLXPixmap @@ -991,7 +984,7 @@ glXCreateGLXPixmap(Display * dpy, XVisualInfo * vis, Pixmap pixmap) UnlockDisplay(dpy); SyncHandle(); -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) do { /* FIXME: Maybe delay __DRIdrawable creation until the drawable * is actually bound to a context... */ @@ -1049,7 +1042,7 @@ glXDestroyGLXPixmap(Display * dpy, GLXPixmap glxpixmap) UnlockDisplay(dpy); SyncHandle(); -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) { int screen; __GLXdisplayPrivate *const priv = __glXInitialize(dpy); @@ -1070,8 +1063,8 @@ glXSwapBuffers(Display * dpy, GLXDrawable drawable) { #ifdef GLX_USE_APPLEGL GLXContext gc = glXGetCurrentContext(); - if(gc && apple_glx_is_current_drawable(dpy, gc->apple, drawable)) { - apple_glx_swap_buffers(gc->apple); + if(gc && apple_glx_is_current_drawable(dpy, gc->driContext, drawable)) { + apple_glx_swap_buffers(gc->driContext); } else { __glXSendError(dpy, GLXBadCurrentWindow, 0, X_GLXSwapBuffers, false); } @@ -1085,7 +1078,7 @@ glXSwapBuffers(Display * dpy, GLXDrawable drawable) xGLXSwapBuffersReq *req; #endif -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL); if (pdraw != NULL) { @@ -1587,7 +1580,7 @@ glXQueryExtensionsString(Display * dpy, int screen) } __glXCalculateUsableExtensions(psc, -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) (psc->driScreen != NULL), #else GL_FALSE, @@ -1819,7 +1812,7 @@ glXQueryContext(Display * dpy, GLXContext ctx, int attribute, int *value) int retVal; /* get the information from the server if we don't have it already */ -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (!ctx->driContext && (ctx->mode == NULL)) { #else if (ctx->mode == NULL) { @@ -2566,7 +2559,7 @@ __glXGetSyncValuesOML(Display * dpy, GLXDrawable drawable, return False; } -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) _X_HIDDEN GLboolean __driGetMscRateOML(__DRIdrawable * draw, int32_t * numerator, int32_t * denominator, void *private) @@ -3019,7 +3012,7 @@ __glXBindTexImageEXT(Display * dpy, i++; } -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->driContext) { __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL); @@ -3275,7 +3268,7 @@ static const struct name_address_pair GLX_functions[] = { GLX_FUNCTION2(glXReleaseTexImageEXT, __glXReleaseTexImageEXT), #endif -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) /*** DRI configuration ***/ GLX_FUNCTION(glXGetScreenDriver), GLX_FUNCTION(glXGetDriverConfig), @@ -3352,7 +3345,7 @@ PUBLIC void (*glXGetProcAddress(const GLubyte * procName)) (void) #endif /* __GNUC__ */ -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) /** * Get the unadjusted system time (UST). Currently, the UST is measured in * microseconds since Epoc. The actual resolution of the UST may vary from diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c index 115fab4012..691e8dfadf 100644 --- a/src/glx/glxcurrent.c +++ b/src/glx/glxcurrent.c @@ -169,7 +169,7 @@ __glXSetCurrentContextNull(void) { __glXSetCurrentContext(&dummyContext); #ifndef GLX_USE_APPLEGL -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) _glapi_set_dispatch(NULL); /* no-op functions */ _glapi_set_context(NULL); #endif @@ -284,7 +284,7 @@ SendMakeCurrentRequest(Display * dpy, CARD8 opcode, } -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) static __GLXDRIdrawable * FetchDRIDrawable(Display * dpy, GLXDrawable glxDrawable, GLXContext gc) { @@ -342,8 +342,8 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw, const GLXContext oldGC = __glXGetCurrentContext(); #ifdef GLX_USE_APPLEGL bool error = apple_glx_make_current_context(dpy, - (oldGC && oldGC != &dummyContext) ? oldGC->apple : NULL, - gc ? gc->apple : NULL, draw); + (oldGC && oldGC != &dummyContext) ? oldGC->driContext : NULL, + gc ? gc->driContext : NULL, draw); apple_glx_diagnostic("%s: error %s\n", __func__, error ? "YES" : "NO"); if(error) @@ -386,7 +386,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw, return False; } -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) /* Bind the direct rendering context to the drawable */ if (gc && gc->driContext) { __GLXDRIdrawable *pdraw = FetchDRIDrawable(dpy, draw, gc); @@ -421,7 +421,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw, return False; } -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if ((dpy != oldGC->currentDpy || (gc && gc->driContext)) && !oldGC->isDirect && oldGC != &dummyContext) { #else @@ -439,7 +439,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw, oldGC->currentContextTag, None, None, &dummy_reply); } -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) else if (oldGC->driContext && oldGC != gc) { oldGC->driContext->unbindContext(oldGC->driContext); } @@ -485,7 +485,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw, * previously destroyed, so we need to free the memory * for the old handle. */ -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) /* Destroy the old direct rendering context */ if (oldGC->driContext) { oldGC->driContext->destroyContext(oldGC->driContext, @@ -507,7 +507,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw, #ifndef GLX_USE_APPLEGL gc->thread_id = _glthread_GetID(); -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (!gc->driContext) { #endif if (!IndirectAPI) @@ -522,7 +522,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw, (void) glGetString(GL_VERSION); __glXInitVertexArrayState(gc); } -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) } else { gc->currentContextTag = -1; diff --git a/src/glx/glxext.c b/src/glx/glxext.c index 9aa992487e..82d3a56f37 100644 --- a/src/glx/glxext.c +++ b/src/glx/glxext.c @@ -259,7 +259,7 @@ FreeScreenConfigs(__GLXdisplayPrivate * priv) } Xfree((char *) psc->serverGLXexts); -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (psc->driver_configs) { unsigned int j; for (j = 0; psc->driver_configs[j]; j++) @@ -299,7 +299,7 @@ __glXFreeDisplayPrivate(XExtData * extension) priv->serverGLXversion = 0x0; /* to protect against double free's */ } -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) /* Free the direct rendering per display data */ if (priv->driswDisplay) (*priv->driswDisplay->destroyDisplay) (priv->driswDisplay); @@ -777,7 +777,7 @@ AllocAndFetchScreenConfigs(Display * dpy, __GLXdisplayPrivate * priv) getVisualConfigs(dpy, priv, i); getFBConfigs(dpy, priv, i); -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) psc->scr = i; psc->dpy = dpy; psc->drawHash = __glxHashCreate(); @@ -817,7 +817,7 @@ __glXInitialize(Display * dpy) __GLXdisplayPrivate *dpyPriv; XEDataObject dataObj; int major, minor; -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) Bool glx_direct, glx_accel; #endif @@ -874,7 +874,7 @@ __glXInitialize(Display * dpy) dpyPriv->serverGLXvendor = 0x0; dpyPriv->serverGLXversion = 0x0; -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) glx_direct = (getenv("LIBGL_ALWAYS_INDIRECT") == NULL); glx_accel = (getenv("LIBGL_ALWAYS_SOFTWARE") == NULL); diff --git a/src/glx/indirect.c b/src/glx/indirect.c index 42a225f671..172727860e 100644 --- a/src/glx/indirect.c +++ b/src/glx/indirect.c @@ -5198,7 +5198,7 @@ glDeleteTexturesEXT(GLsizei n, const GLuint * textures) { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->driContext) { CALL_DeleteTextures(GET_DISPATCH(), (n, textures)); } else @@ -5269,7 +5269,7 @@ glGenTexturesEXT(GLsizei n, GLuint * textures) { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->driContext) { CALL_GenTextures(GET_DISPATCH(), (n, textures)); } else @@ -5334,7 +5334,7 @@ glIsTextureEXT(GLuint texture) { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->driContext) { return CALL_IsTexture(GET_DISPATCH(), (texture)); } else @@ -5650,7 +5650,7 @@ glGetColorTableEXT(GLenum target, GLenum format, GLenum type, GLvoid * table) { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->driContext) { CALL_GetColorTable(GET_DISPATCH(), (target, format, type, table)); } else @@ -5726,7 +5726,7 @@ glGetColorTableParameterfvEXT(GLenum target, GLenum pname, GLfloat * params) { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->driContext) { CALL_GetColorTableParameterfv(GET_DISPATCH(), (target, pname, params)); @@ -5799,7 +5799,7 @@ glGetColorTableParameterivEXT(GLenum target, GLenum pname, GLint * params) { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->driContext) { CALL_GetColorTableParameteriv(GET_DISPATCH(), (target, pname, params)); @@ -6125,7 +6125,7 @@ gl_dispatch_stub_356(GLenum target, GLenum format, GLenum type, { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->driContext) { CALL_GetConvolutionFilter(GET_DISPATCH(), (target, format, type, image)); @@ -6203,7 +6203,7 @@ gl_dispatch_stub_357(GLenum target, GLenum pname, GLfloat * params) { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->driContext) { CALL_GetConvolutionParameterfv(GET_DISPATCH(), (target, pname, params)); @@ -6276,7 +6276,7 @@ gl_dispatch_stub_358(GLenum target, GLenum pname, GLint * params) { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->driContext) { CALL_GetConvolutionParameteriv(GET_DISPATCH(), (target, pname, params)); @@ -6356,7 +6356,7 @@ gl_dispatch_stub_361(GLenum target, GLboolean reset, GLenum format, { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->driContext) { CALL_GetHistogram(GET_DISPATCH(), (target, reset, format, type, values)); @@ -6433,7 +6433,7 @@ gl_dispatch_stub_362(GLenum target, GLenum pname, GLfloat * params) { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->driContext) { CALL_GetHistogramParameterfv(GET_DISPATCH(), (target, pname, params)); } else @@ -6504,7 +6504,7 @@ gl_dispatch_stub_363(GLenum target, GLenum pname, GLint * params) { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->driContext) { CALL_GetHistogramParameteriv(GET_DISPATCH(), (target, pname, params)); } else @@ -6579,7 +6579,7 @@ gl_dispatch_stub_364(GLenum target, GLboolean reset, GLenum format, { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->driContext) { CALL_GetMinmax(GET_DISPATCH(), (target, reset, format, type, values)); } else @@ -6653,7 +6653,7 @@ gl_dispatch_stub_365(GLenum target, GLenum pname, GLfloat * params) { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->driContext) { CALL_GetMinmaxParameterfv(GET_DISPATCH(), (target, pname, params)); } else @@ -6721,7 +6721,7 @@ gl_dispatch_stub_366(GLenum target, GLenum pname, GLint * params) { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->driContext) { CALL_GetMinmaxParameteriv(GET_DISPATCH(), (target, pname, params)); } else diff --git a/src/glx/singlepix.c b/src/glx/singlepix.c index f5ebf4dfdb..c4010d79bd 100644 --- a/src/glx/singlepix.c +++ b/src/glx/singlepix.c @@ -119,7 +119,7 @@ void NAME(_gloffset_GetSeparableFilter) (GLenum target, GLenum format, { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) if (gc->driContext) { CALL_GetSeparableFilter(GET_DISPATCH(), (target, format, type, row, column, span)); diff --git a/src/glx/xfont.c b/src/glx/xfont.c index 6b55a6085b..797fd7a490 100644 --- a/src/glx/xfont.c +++ b/src/glx/xfont.c @@ -33,7 +33,7 @@ called by that routine when direct rendering is enabled. */ -#if defined(GLX_DIRECT_RENDERING) || defined(GLX_USE_APPLEGL) +#ifdef GLX_DIRECT_RENDERING #include "glxclient.h" -- cgit v1.2.3 From 163901bc7f89dc3a5c65d66b960f18dd561631c1 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Fri, 2 Apr 2010 00:54:57 -0700 Subject: darwin: Use clientattrib Signed-off-by: Jeremy Huddleston --- src/glx/apple/Makefile | 2 +- src/glx/clientattrib.c | 2 ++ src/glx/glxcmds.c | 2 -- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/glx/apple/Makefile') diff --git a/src/glx/apple/Makefile b/src/glx/apple/Makefile index 4c05013f3f..a3ee888288 100644 --- a/src/glx/apple/Makefile +++ b/src/glx/apple/Makefile @@ -20,7 +20,7 @@ BUILD_DIR=builds all: $(BUILD_DIR)/libGL.1.2.dylib -OBJECTS=glxext.o glxcmds.o glx_pbuffer.o glx_query.o glxcurrent.o glxextensions.o \ +OBJECTS=clientattrib.o glxext.o glxcmds.o glx_pbuffer.o glx_query.o glxcurrent.o glxextensions.o \ appledri.o apple_glx_context.o apple_glx.o pixel.o \ compsize.o apple_visual.o apple_cgl.o glxreply.o glcontextmodes.o \ apple_xgl_api.o apple_glx_drawable.o xfont.o apple_glx_pbuffer.o \ diff --git a/src/glx/clientattrib.c b/src/glx/clientattrib.c index a7dfb53486..b26c17938d 100644 --- a/src/glx/clientattrib.c +++ b/src/glx/clientattrib.c @@ -35,6 +35,7 @@ /*****************************************************************************/ +#ifndef GLX_USE_APPLEGL static void do_enable_disable(GLenum array, GLboolean val) { @@ -123,6 +124,7 @@ __indirect_glPopClientAttrib(void) return; } } +#endif void __glFreeAttributeState(__GLXcontext * gc) diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c index e9ec4c88c6..e74ae3472e 100644 --- a/src/glx/glxcmds.c +++ b/src/glx/glxcmds.c @@ -539,9 +539,7 @@ __glXFreeContext(__GLXcontext * gc) XFree((char *) gc->version); if (gc->extensions) XFree((char *) gc->extensions); -#ifndef GLX_USE_APPLEGL /* TODO: clientattrib */ __glFreeAttributeState(gc); -#endif XFree((char *) gc->buf); Xfree((char *) gc->client_state_private); XFree((char *) gc); -- cgit v1.2.3 From de96d063b1eba9137d96074c9434aafe858d3271 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Fri, 2 Apr 2010 00:57:38 -0700 Subject: apple: Integrate our libGL into the existing build system better Signed-off-by: Jeremy Huddleston --- configs/darwin | 7 +- src/glx/Makefile | 2 +- src/glx/apple/Makefile | 183 +++++++++++++++++++++++++++++-------------------- 3 files changed, 116 insertions(+), 76 deletions(-) (limited to 'src/glx/apple/Makefile') diff --git a/configs/darwin b/configs/darwin index d28d5906ba..e519684877 100644 --- a/configs/darwin +++ b/configs/darwin @@ -13,7 +13,10 @@ CC = gcc CXX = g++ PIC_FLAGS = -fPIC DEFINES = -D_DARWIN_C_SOURCE -DPTHREADS -D_GNU_SOURCE \ - -DGLX_ALIAS_UNSUPPORTED -DGLX_INDIRECT_RENDERING + -DGLX_ALIAS_UNSUPPORTED \ + -DGLX_DIRECT_RENDERING -DGLX_USE_APPLEGL + +# -DGLX_INDIRECT_RENDERING \ # -D_GNU_SOURCE - for src/mesa/main ... # -DGLX_DIRECT_RENDERING - pulls in libdrm stuff in glx @@ -49,7 +52,7 @@ GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXmu -lXt -lXi -lm # omit glw lib for now: -SRC_DIRS = glsl glx mesa gallium glu glut/glx glew +SRC_DIRS = glsl glx/apple mesa gallium glu glut/glx glew GLU_DIRS = sgi DRIVER_DIRS = osmesa #DRIVER_DIRS = dri diff --git a/src/glx/Makefile b/src/glx/Makefile index 6711fdc61b..c6ebc49828 100644 --- a/src/glx/Makefile +++ b/src/glx/Makefile @@ -90,7 +90,7 @@ install: $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) # Remove .o and backup files clean: - -rm -f $(TOP)/$(LIB_DIR)/libGL.so* + -rm -f $(TOP)/$(LIB_DIR)/$(GL_LIB_GLOB) -rm -f *.o *~ -rm -f depend depend.bak diff --git a/src/glx/apple/Makefile b/src/glx/apple/Makefile index a3ee888288..8fa5b01f28 100644 --- a/src/glx/apple/Makefile +++ b/src/glx/apple/Makefile @@ -1,97 +1,134 @@ -INSTALL_DIR = /usr/X11 -X11_DIR = $(INSTALL_DIR) +TOP = ../../.. -CC=gcc -GL_CFLAGS=-Wall -ggdb3 -Os -DPTHREADS -D_REENTRANT -DGLX_DIRECT_RENDERING -DGLX_USE_APPLEGL -DGLX_ALIAS_UNSUPPORTED $(RC_CFLAGS) $(CFLAGS) -GL_LDFLAGS=-L$(INSTALL_DIR)/lib -L$(X11_DIR)/lib $(LDFLAGS) -Wl,-single_module +include $(TOP)/configs/current -TCLSH=tclsh8.5 +#CC=gcc +#GL_CFLAGS=-Wall -ggdb3 -Os -DPTHREADS -D_REENTRANT $(RC_CFLAGS) $(CFLAGS) +#GL_LDFLAGS=-L$(INSTALL_DIR)/lib -L$(X11_DIR)/lib $(LDFLAGS) -Wl,-single_module +TCLSH=tclsh8.5 MKDIR=mkdir INSTALL=install LN=ln RM=rm -INCLUDE=-I. -Iinclude -Iinclude/internal -I.. -I../../../include -I../../../src/mesa -I../../../src/mesa/glapi -I$(INSTALL_DIR)/include -I$(X11_DIR)/include -COMPILE=$(CC) $(INCLUDE) $(GL_CFLAGS) -c +#INCLUDE=-I. -Iinclude -I.. -DGLX_ALIAS_UNSUPPORTED -I$(INSTALL_DIR)/include -I$(X11_DIR)/include + +#COMPILE=$(CC) $(INCLUDE) $(GL_CFLAGS) -c #The directory with the final binaries. BUILD_DIR=builds -all: $(BUILD_DIR)/libGL.1.2.dylib - -OBJECTS=clientattrib.o glxext.o glxcmds.o glx_pbuffer.o glx_query.o glxcurrent.o glxextensions.o \ - appledri.o apple_glx_context.o apple_glx.o pixel.o \ - compsize.o apple_visual.o apple_cgl.o glxreply.o glcontextmodes.o \ - apple_xgl_api.o apple_glx_drawable.o xfont.o apple_glx_pbuffer.o \ - apple_glx_pixmap.o apple_xgl_api_read.o glx_empty.o glx_error.o \ - apple_xgl_api_viewport.o apple_glx_surface.o apple_xgl_api_stereo.o - -$(BUILD_DIR)/libGL.1.2.dylib: $(OBJECTS) - -if ! test -d $(BUILD_DIR); then $(MKDIR) $(BUILD_DIR); fi - $(CC) $(GL_CFLAGS) -o $@ -dynamiclib -install_name $(INSTALL_DIR)/lib/libGL.1.dylib -compatibility_version 1.2 -current_version 1.2 -lXplugin -framework ApplicationServices -framework CoreFoundation $(GL_LDFLAGS) -lXext -lX11 -Wl,-exported_symbols_list,exports.list $(OBJECTS) - -.c.o: - $(COMPILE) $< - -apple_glx_drawable.o: apple_glx_drawable.h apple_glx_drawable.c include/GL/gl.h -apple_xgl_api.o: apple_xgl_api.h apple_xgl_api.c apple_xgl_api_stereo.c include/GL/gl.h -apple_xgl_api_read.o: apple_xgl_api_read.h apple_xgl_api_read.c apple_xgl_api.h include/GL/gl.h -apple_xgl_api_viewport.o: apple_xgl_api_viewport.h apple_xgl_api_viewport.c apple_xgl_api.h include/GL/gl.h -apple_xgl_api_stereo.o: apple_xgl_api_stereo.h apple_xgl_api_stereo.c apple_xgl_api.h include/GL/gl.h -glcontextmodes.o: glcontextmodes.c include/GL/gl.h -glxext.o: glxext.c include/GL/gl.h -glxreply.o: glxreply.c include/GL/gl.h -glxcmds.o: glxcmds.c apple_glx_context.h include/GL/gl.h -glx_pbuffer.o: glx_pbuffer.c include/GL/gl.h -glx_error.o: glx_error.c include/GL/gl.h -glx_query.o: glx_query.c include/GL/gl.h -glxcurrent.o: glxcurrent.c include/GL/gl.h -glxextensions.o: glxextensions.c include/GL/gl.h -glxhash.o: glxhash.h glxhash.c include/GL/gl.h -appledri.o: appledri.h appledristr.h appledri.c include/GL/gl.h -apple_glx_context.o: apple_glx_context.c apple_glx_context.h apple_glx_context.h include/GL/gl.h -apple_glx.o: apple_glx.h apple_glx.c apple_xgl_api.h include/GL/gl.h -apple_visual.o: apple_visual.h apple_visual.c include/GL/gl.h -apple_cgl.o: apple_cgl.h apple_cgl.c include/GL/gl.h -apple_glx_pbuffer.o: apple_glx_drawable.h apple_glx_pbuffer.c include/GL/gl.h -apple_glx_pixmap.o: apple_glx_drawable.h apple_glx_pixmap.c appledri.h include/GL/gl.h -apple_glx_surface.o: apple_glx_drawable.h apple_glx_surface.c appledri.h include/GL/gl.h -xfont.o: xfont.c include/GL/gl.h -compsize.o: compsize.c include/GL/gl.h -renderpix.o: renderpix.c include/GL/gl.h -singlepix.o: singlepix.c include/GL/gl.h -pixel.o: pixel.c include/GL/gl.h -glx_empty.o: glx_empty.c include/GL/gl.h - -apple_xgl_api.c: apple_xgl_api.h -apple_xgl_api.h: gen_api_header.tcl gen_api_library.tcl gen_code.tcl gen_defs.tcl gen_exports.tcl gen_funcs.tcl gen_types.tcl +all: $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) + +SOURCES = \ + apple_cgl.c \ + apple_glx.c \ + apple_glx_context.c \ + apple_glx_drawable.c \ + apple_glx_pbuffer.c \ + apple_glx_pixmap.c \ + apple_glx_surface.c \ + apple_visual.c \ + apple_xgl_api.c \ + apple_xgl_api_read.c \ + apple_xgl_api_stereo.c \ + apple_xgl_api_viewport.c \ + appledri.c \ + ../clientattrib.c \ + ../compsize.c \ + ../glcontextmodes.c \ + glx_empty.c \ + glx_error.c \ + ../glx_pbuffer.c \ + ../glx_query.c \ + ../glxcmds.c \ + ../glxcurrent.c \ + ../glxext.c \ + ../glxextensions.c \ + glxreply.c \ + ../pixel.c \ + ../xfont.c + +include $(TOP)/src/mesa/sources.mak + +LDFLAGS += -lXplugin -framework ApplicationServices -framework CoreFoundation + +MESA_GLAPI_ASM_SOURCES = $(addprefix $(TOP)/src/mesa/, $(GLAPI_ASM_SOURCES)) +MESA_GLAPI_SOURCES = $(addprefix $(TOP)/src/mesa/, $(GLAPI_SOURCES)) +MESA_GLAPI_OBJECTS = $(addprefix $(TOP)/src/mesa/, $(GLAPI_OBJECTS)) + +OBJECTS = $(SOURCES:.c=.o) # $(MESA_GLAPI_OBJECTS) + +INCLUDES = -I. -Iinclude -I..\ + -I$(TOP)/include \ + -I$(TOP)/include/GL/internal \ + -I$(TOP)/src/mesa \ + -I$(TOP)/src/mesa/glapi \ + $(LIBDRM_CFLAGS) \ + $(DRI2PROTO_CFLAGS) \ + $(X11_INCLUDES) + +##### RULES ##### + +$(OBJECTS) : include/GL/gl.h apple_xgl_api.h + +apple_xgl_api.c : apple_xgl_api.h + +apple_xgl_api.h : gen_api_header.tcl gen_api_library.tcl gen_code.tcl gen_defs.tcl gen_exports.tcl gen_funcs.tcl gen_types.tcl $(TCLSH) gen_code.tcl include/GL/gl.h: include/GL/gl.h.template gen_gl_h.sh ./gen_gl_h.sh include/GL/gl.h.template $@ +.c.o: + $(CC) -c $(INCLUDES) $(CFLAGS) $(EXTRA_DEFINES) $< -o $@ + +.S.o: + $(CC) -c $(INCLUDES) $(CFLAGS) $(EXTRA_DEFINES) $< -o $@ + +##### TARGETS ##### + +default: depend $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) + +# Make libGL +$(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) Makefile + $(MKLIB) -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ + -major 1 -minor 2 $(MKLIB_OPTIONS) \ + -install $(TOP)/$(LIB_DIR) -id $(INSTALL_LIB_DIR)/lib$(GL_LIB).1.dylib \ + $(GL_LIB_DEPS) $(OBJECTS) + +depend: $(SOURCES) $(MESA_GLAPI_SOURCES) $(MESA_GLAPI_ASM_SOURCES) Makefile + rm -f depend + touch depend + $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES) \ + $(MESA_GLAPI_SOURCES) $(MESA_GLAPI_ASM_SOURCES) + +# Emacs tags +tags: + etags `find . -name \*.[ch]` `find $(TOP)/include` + install_headers: include/GL/gl.h $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL - $(INSTALL) -m 644 include/GL/gl.h include/GL/glext.h include/GL/glx.h include/GL/glxext.h $(DESTDIR)$(INSTALL_DIR)/include/GL + $(INSTALL) -m 644 include/GL/gl.h $(DESTDIR)$(INSTALL_DIR)/include/GL -install_libraries: $(BUILD_DIR)/libGL.1.2.dylib - $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/lib - $(INSTALL) -m 755 $(BUILD_DIR)/libGL.1.2.dylib $(DESTDIR)$(INSTALL_DIR)/lib - $(RM) -f $(DESTDIR)$(INSTALL_DIR)/lib/libGL.dylib - $(LN) -s libGL.1.2.dylib $(DESTDIR)$(INSTALL_DIR)/lib/libGL.dylib - $(RM) -f $(DESTDIR)$(INSTALL_DIR)/lib/libGL.1.dylib - $(LN) -s libGL.1.2.dylib $(DESTDIR)$(INSTALL_DIR)/lib/libGL.1.dylib +install_libraries: $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) + $(MAKE) -C $(TOP)/src/mesa install-libgl install: install_headers install_libraries +#%.c : ../%.c +# ln -s $< + +# Remove .o and backup files clean: - rm -rf $(BUILD_DIR) - rm -f *.o *.a - rm -f *.c~ *.h~ - rm -f apple_xgl_api.h apple_xgl_api.c - rm -f *.dylib - rm -f include/GL/gl.h - -%.c : ../%.c - ln -s $< + -rm -f *.o *.a *~ + -rm -f *.c~ *.h~ + -rm -f apple_xgl_api.h apple_xgl_api.c + -rm -f *.dylib + -rm -f include/GL/gl.h + -rm -f $(TOP)/$(LIB_DIR)/$(GL_LIB_GLOB) + -rm -f *.o *~ + -rm -f depend depend.bak + +-include depend -- cgit v1.2.3 From f5aa5377a52c50c94b6a6d6d48c0057dbe874692 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Sat, 2 Jan 2010 00:03:53 -0500 Subject: apple: Use mesa gl.h rather than generating one. Signed-off-by: Jeremy Huddleston --- src/glx/apple/GL_aliases | 4 +- src/glx/apple/Makefile | 11 +-- src/glx/apple/apple_glx_pbuffer.c | 1 + src/glx/apple/apple_xgl_api_additional.c | 37 +++++++++ src/glx/apple/gen_funcs.tcl | 13 +--- src/glx/apple/gen_gl_h.sh | 33 -------- src/glx/apple/include/GL/gl.h.template | 130 ------------------------------- 7 files changed, 48 insertions(+), 181 deletions(-) create mode 100644 src/glx/apple/apple_xgl_api_additional.c delete mode 100755 src/glx/apple/gen_gl_h.sh delete mode 100644 src/glx/apple/include/GL/gl.h.template (limited to 'src/glx/apple/Makefile') diff --git a/src/glx/apple/GL_aliases b/src/glx/apple/GL_aliases index a8390d2408..8de22383a7 100644 --- a/src/glx/apple/GL_aliases +++ b/src/glx/apple/GL_aliases @@ -5,4 +5,6 @@ alias DeleteTexturesEXT DeleteTextures alias GenTexturesEXT GenTextures alias IsTextureEXT IsTexture alias PrioritizeTexturesEXT PrioritizeTextures -alias TexImage3DEXT TexImage3D + +# Due to type conflicts, we handle this differently +#alias TexImage3DEXT TexImage3D diff --git a/src/glx/apple/Makefile b/src/glx/apple/Makefile index 8fa5b01f28..279f7aded9 100644 --- a/src/glx/apple/Makefile +++ b/src/glx/apple/Makefile @@ -31,6 +31,7 @@ SOURCES = \ apple_glx_surface.c \ apple_visual.c \ apple_xgl_api.c \ + apple_xgl_api_additional.c \ apple_xgl_api_read.c \ apple_xgl_api_stereo.c \ apple_xgl_api_viewport.c \ @@ -71,16 +72,13 @@ INCLUDES = -I. -Iinclude -I..\ ##### RULES ##### -$(OBJECTS) : include/GL/gl.h apple_xgl_api.h +$(OBJECTS) : apple_xgl_api.h apple_xgl_api.c : apple_xgl_api.h apple_xgl_api.h : gen_api_header.tcl gen_api_library.tcl gen_code.tcl gen_defs.tcl gen_exports.tcl gen_funcs.tcl gen_types.tcl $(TCLSH) gen_code.tcl -include/GL/gl.h: include/GL/gl.h.template gen_gl_h.sh - ./gen_gl_h.sh include/GL/gl.h.template $@ - .c.o: $(CC) -c $(INCLUDES) $(CFLAGS) $(EXTRA_DEFINES) $< -o $@ @@ -115,10 +113,7 @@ install_headers: include/GL/gl.h install_libraries: $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(MAKE) -C $(TOP)/src/mesa install-libgl -install: install_headers install_libraries - -#%.c : ../%.c -# ln -s $< +install: install_libraries # Remove .o and backup files clean: diff --git a/src/glx/apple/apple_glx_pbuffer.c b/src/glx/apple/apple_glx_pbuffer.c index 3dfdc54763..fb56b7512e 100644 --- a/src/glx/apple/apple_glx_pbuffer.c +++ b/src/glx/apple/apple_glx_pbuffer.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "apple_glx.h" #include "glcontextmodes.h" #include "apple_glx_context.h" diff --git a/src/glx/apple/apple_xgl_api_additional.c b/src/glx/apple/apple_xgl_api_additional.c new file mode 100644 index 0000000000..7d40afe1d7 --- /dev/null +++ b/src/glx/apple/apple_xgl_api_additional.c @@ -0,0 +1,37 @@ +/* + Copyright (c) 2008, 2009 Apple Inc. + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation files + (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS 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 ABOVE LISTED COPYRIGHT + HOLDER(S) 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 SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + Except as contained in this notice, the name(s) of the above + copyright holders shall not be used in advertising or otherwise to + promote the sale, use or other dealings in this Software without + prior written authorization. +*/ + +#define GL_GLEXT_PROTOTYPES +#include + +GLAPI void APIENTRY glTexImage3DEXT(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei + depth, GLint border, GLenum format, GLenum type, const void * pixels) { + glTexImage3D(target, level, (GLint)internalformat, width, height, depth, border, format, type, pixels); +} + diff --git a/src/glx/apple/gen_funcs.tcl b/src/glx/apple/gen_funcs.tcl index ff314dc6a7..e78eb3278c 100644 --- a/src/glx/apple/gen_funcs.tcl +++ b/src/glx/apple/gen_funcs.tcl @@ -72,6 +72,8 @@ proc is-extension-supported? name { } #This is going to need to be updated for OpenGL >= 2.1 in SnowLeopard. +# TextureComponentCount is GLenum in SL for everything +# It is GLint in mesa, but is GLenum for glTexImage3DEXT array set typemap { void void List GLuint @@ -126,7 +128,7 @@ array set typemap { ShadingModel GLenum TextureTarget GLenum TextureParameterName GLenum - TextureComponentCount GLenum + TextureComponentCount GLint PixelFormat GLenum PixelType GLenum TextureEnvTarget GLenum @@ -412,14 +414,7 @@ proc translate-parameters {func parameters} { set type $typemap($ptype) - #In the gl.spec file is MultiDrawArrays first and count - #are really 'in' so we make them const. - #The gl.spec notes this problem. - if {("MultiDrawArrays" eq $func) && ("first" eq $var)} { - set final_type "const $type *" - } elseif {("MultiDrawArrays" eq $func) && ("count" eq $var)} { - set final_type "const $type *" - } elseif {"array" eq [lindex $p 3]} { + if {"array" eq [lindex $p 3]} { if {"in" eq [lindex $p 2]} { set final_type "const $type *" } else { diff --git a/src/glx/apple/gen_gl_h.sh b/src/glx/apple/gen_gl_h.sh deleted file mode 100755 index f10ddd0bfc..0000000000 --- a/src/glx/apple/gen_gl_h.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -INFILE=$1 -OUTFILE=$2 - -generate_macros() { - grep gl.*ProcPtr /System/Library/Frameworks/OpenGL.framework/Headers/gl{,ext}.h | sed 's:^.*\(gl.*Ptr\).*$:\1:' | sort -u | perl -ne 'chomp($_); $s = "PFN".uc($_); $s =~ s/PROCPTR/PROC/; print "#define ".$_." ".$s."\n"' -} - -generate_function_pointers() { - { - echo "#define GL_GLEXT_FUNCTION_POINTERS 1" - echo "#define GL_GLEXT_LEGACY 1" - generate_macros - echo '#include "/System/Library/Frameworks/OpenGL.framework/Headers/gl.h"' - } | ${CC:-gcc} -E - | grep typedef.*PFN -} - -cat ${INFILE} | while IFS= read LINE ; do - case $LINE in - "@CGL_MESA_COMPAT_MACROS@") - generate_macros - ;; - "@CGL_MESA_FUNCTION_POINTERS@") - if ! grep -q GL_GLEXT_PROTOTYPES /System/Library/Frameworks/OpenGL.framework/Headers/gl.h ; then - generate_function_pointers - fi - ;; - *) - printf "${LINE}\n" - ;; - esac -done > ${OUTFILE} diff --git a/src/glx/apple/include/GL/gl.h.template b/src/glx/apple/include/GL/gl.h.template deleted file mode 100644 index 72169f98c3..0000000000 --- a/src/glx/apple/include/GL/gl.h.template +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. - * Copyright (C) 2009 Apple Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS 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 - * BRIAN PAUL 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 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef __X_GL_H -#define __X_GL_H - -/* The following macros exist to address conflicts between the names given to - * function pointers by the MESA API and OpenGL.framework's API. - */ -@CGL_MESA_COMPAT_MACROS@ - -/* On SL, we want to use OpelGL.framework's headers to get both prototypes and - * function pointers (like Mesa's API), but on Leo and before, OpenGL.framework - * can't give us both. - */ - -#ifdef GL_GLEXT_FUNCTION_POINTERS -#define _GL_GLEXT_FUNCTION_POINTERS GL_GLEXT_FUNCTION_POINTERS -#undef GL_GLEXT_FUNCTION_POINTERS -#endif - -#ifdef GL_GLEXT_PROTOTYPES -#define _GL_GLEXT_PROTOTYPES GL_GLEXT_PROTOTYPES -#else -#define GL_GLEXT_PROTOTYPES 1 -#endif - -/* Our glext.h is based on a version from the registry that is newer. */ -#ifdef GL_GLEXT_LEGACY -#define _GL_GLEXT_LEGACY GL_GLEXT_LEGACY -#else -#define GL_GLEXT_LEGACY 1 -#endif - -#include "/System/Library/Frameworks/OpenGL.framework/Headers/gl.h" - -/* These are not set by the system gl.h */ -#define GL_VERSION_1_2_DEPRECATED 1 -#define GL_VERSION_1_3_DEPRECATED 1 -#define GL_VERSION_1_4_DEPRECATED 1 - -/* Restore our GLEXT-fu */ -#ifdef _GL_GLEXT_FUNCTION_POINTERS -#define GL_GLEXT_FUNCTION_POINTERS _GL_GLEXT_FUNCTION_POINTERS -#undef _GL_GLEXT_FUNCTION_POINTERS -#endif - -#ifdef _GL_GLEXT_PROTOTYPES -#undef _GL_GLEXT_PROTOTYPES -#else -#undef GL_GLEXT_PROTOTYPES -#endif - -#ifdef _GL_GLEXT_LEGACY -#undef _GL_GLEXT_LEGACY -#else -#undef GL_GLEXT_LEGACY -#endif - -@CGL_MESA_FUNCTION_POINTERS@ - -#ifndef GL_GLEXT_LEGACY -#include -#endif - -/* - * This is needed for building apple_glx_pbuffer.c, the latest - * glext.h from the registry lacks it, so it's from the Leopard glext.h: - */ -#ifndef GL_TEXTURE_RECTANGLE_EXT -#define GL_TEXTURE_RECTANGLE_EXT 0x84F5 -#endif - -/* This is needed for building the X server: */ -/* - * GL_MESA_packed_depth_stencil - */ -#ifndef GL_MESA_packed_depth_stencil -#define GL_MESA_packed_depth_stencil 1 - -#define GL_DEPTH_STENCIL_MESA 0x8750 -#define GL_UNSIGNED_INT_24_8_MESA 0x8751 -#define GL_UNSIGNED_INT_8_24_REV_MESA 0x8752 -#define GL_UNSIGNED_SHORT_15_1_MESA 0x8753 -#define GL_UNSIGNED_SHORT_1_15_REV_MESA 0x8754 - -#endif /* GL_MESA_packed_depth_stencil */ - -/* Various other OS projects expect to get these macros from Mesa's gl.h */ -#ifndef GLAPI -#define GLAPI extern -#endif - -#ifndef GLAPIENTRY -#define GLAPIENTRY -#endif - -#ifndef APIENTRY -#define APIENTRY GLAPIENTRY -#endif - -/* "P" suffix to be used for a pointer to a function */ -#ifndef APIENTRYP -#define APIENTRYP APIENTRY * -#endif - -#ifndef GLAPIENTRYP -#define GLAPIENTRYP GLAPIENTRY * -#endif - -#endif /*__X_GL_H*/ -- cgit v1.2.3