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/apple_glx_pbuffer.c | 330 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 330 insertions(+) create mode 100644 src/glx/apple/apple_glx_pbuffer.c (limited to 'src/glx/apple/apple_glx_pbuffer.c') diff --git a/src/glx/apple/apple_glx_pbuffer.c b/src/glx/apple/apple_glx_pbuffer.c new file mode 100644 index 0000000000..3dfdc54763 --- /dev/null +++ b/src/glx/apple/apple_glx_pbuffer.c @@ -0,0 +1,330 @@ +/* + Copyright (c) 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. +*/ + +#include +#include +#include +#include "apple_glx.h" +#include "glcontextmodes.h" +#include "apple_glx_context.h" +#include "apple_glx_drawable.h" +#include "apple_cgl.h" + +static bool pbuffer_make_current(struct apple_glx_context *ac, + struct apple_glx_drawable *d); + +static void pbuffer_destroy(Display * dpy, struct apple_glx_drawable *d); + +static struct apple_glx_drawable_callbacks callbacks = { + .type = APPLE_GLX_DRAWABLE_PBUFFER, + .make_current = pbuffer_make_current, + .destroy = pbuffer_destroy +}; + + +/* Return true if an error occurred. */ +bool +pbuffer_make_current(struct apple_glx_context *ac, + struct apple_glx_drawable *d) +{ + struct apple_glx_pbuffer *pbuf = &d->types.pbuffer; + CGLError cglerr; + + assert(APPLE_GLX_DRAWABLE_PBUFFER == d->type); + + cglerr = apple_cgl.set_pbuffer(ac->context_obj, pbuf->buffer_obj, 0, 0, 0); + + if (kCGLNoError != cglerr) { + fprintf(stderr, "set_pbuffer: %s\n", apple_cgl.error_string(cglerr)); + return true; + } + + if (!ac->made_current) { + glViewport(0, 0, pbuf->width, pbuf->height); + glScissor(0, 0, pbuf->width, pbuf->height); + ac->made_current = true; + } + + apple_glx_diagnostic("made pbuffer drawable 0x%lx current\n", d->drawable); + + return false; +} + +void +pbuffer_destroy(Display * dpy, struct apple_glx_drawable *d) +{ + struct apple_glx_pbuffer *pbuf = &d->types.pbuffer; + + assert(APPLE_GLX_DRAWABLE_PBUFFER == d->type); + + apple_glx_diagnostic("destroying pbuffer for drawable 0x%lx\n", + d->drawable); + + apple_cgl.destroy_pbuffer(pbuf->buffer_obj); + XFreePixmap(dpy, pbuf->xid); +} + +/* Return true if an error occurred. */ +bool +apple_glx_pbuffer_destroy(Display * dpy, GLXPbuffer pbuf) +{ + return !apple_glx_drawable_destroy_by_type(dpy, pbuf, + APPLE_GLX_DRAWABLE_PBUFFER); +} + +/* Return true if an error occurred. */ +bool +apple_glx_pbuffer_create(Display * dpy, GLXFBConfig config, + int width, int height, int *errorcode, + GLXPbuffer * result) +{ + struct apple_glx_drawable *d; + struct apple_glx_pbuffer *pbuf = NULL; + CGLError err; + Window root; + int screen; + Pixmap xid; + __GLcontextModes *modes = (__GLcontextModes *) config; + + root = DefaultRootWindow(dpy); + screen = DefaultScreen(dpy); + + /* + * This pixmap is only used for a persistent XID. + * The XC-MISC extension cleans up XIDs and reuses them transparently, + * so we need to retain a server-side reference. + */ + xid = XCreatePixmap(dpy, root, (unsigned int) 1, + (unsigned int) 1, DefaultDepth(dpy, screen)); + + if (None == xid) { + *errorcode = BadAlloc; + return true; + } + + if (apple_glx_drawable_create(dpy, screen, xid, &d, &callbacks)) { + *errorcode = BadAlloc; + return true; + } + + /* The lock is held in d from create onward. */ + pbuf = &d->types.pbuffer; + + pbuf->xid = xid; + pbuf->width = width; + pbuf->height = height; + + err = apple_cgl.create_pbuffer(width, height, GL_TEXTURE_RECTANGLE_EXT, + (modes->alphaBits > 0) ? GL_RGBA : GL_RGB, + 0, &pbuf->buffer_obj); + + if (kCGLNoError != err) { + d->unlock(d); + d->destroy(d); + *errorcode = BadMatch; + return true; + } + + pbuf->fbconfigID = modes->fbconfigID; + + pbuf->event_mask = 0; + + *result = pbuf->xid; + + d->unlock(d); + + return false; +} + + + +/* Return true if an error occurred. */ +static bool +get_max_size(int *widthresult, int *heightresult) +{ + CGLContextObj oldcontext; + GLint ar[2]; + + oldcontext = apple_cgl.get_current_context(); + + if (!oldcontext) { + /* + * There is no current context, so we need to make one in order + * to call glGetInteger. + */ + CGLPixelFormatObj pfobj; + CGLError err; + CGLPixelFormatAttribute attr[10]; + int c = 0; + GLint vsref = 0; + CGLContextObj newcontext; + + attr[c++] = kCGLPFAColorSize; + attr[c++] = 32; + attr[c++] = 0; + + err = apple_cgl.choose_pixel_format(attr, &pfobj, &vsref); + if (kCGLNoError != err) { + if (getenv("LIBGL_DIAGNOSTIC")) { + printf("choose_pixel_format error in %s: %s\n", __func__, + apple_cgl.error_string(err)); + } + + return true; + } + + + err = apple_cgl.create_context(pfobj, NULL, &newcontext); + + if (kCGLNoError != err) { + if (getenv("LIBGL_DIAGNOSTIC")) { + printf("create_context error in %s: %s\n", __func__, + apple_cgl.error_string(err)); + } + + apple_cgl.destroy_pixel_format(pfobj); + + return true; + } + + err = apple_cgl.set_current_context(newcontext); + + if (kCGLNoError != err) { + printf("set_current_context error in %s: %s\n", __func__, + apple_cgl.error_string(err)); + return true; + } + + + glGetIntegerv(GL_MAX_VIEWPORT_DIMS, ar); + + apple_cgl.set_current_context(oldcontext); + apple_cgl.destroy_context(newcontext); + apple_cgl.destroy_pixel_format(pfobj); + } + else { + /* We have a valid context. */ + + glGetIntegerv(GL_MAX_VIEWPORT_DIMS, ar); + } + + *widthresult = ar[0]; + *heightresult = ar[1]; + + return false; +} + +bool +apple_glx_pbuffer_query(GLXPbuffer p, int attr, unsigned int *value) +{ + bool result = false; + struct apple_glx_drawable *d; + struct apple_glx_pbuffer *pbuf; + + d = apple_glx_drawable_find_by_type(p, APPLE_GLX_DRAWABLE_PBUFFER, + APPLE_GLX_DRAWABLE_LOCK); + + if (d) { + pbuf = &d->types.pbuffer; + + switch (attr) { + case GLX_WIDTH: + *value = pbuf->width; + result = true; + break; + + case GLX_HEIGHT: + *value = pbuf->height; + result = true; + break; + + case GLX_PRESERVED_CONTENTS: + *value = true; + result = true; + break; + + case GLX_LARGEST_PBUFFER:{ + int width, height; + if (get_max_size(&width, &height)) { + fprintf(stderr, "internal error: " + "unable to find the largest pbuffer!\n"); + } + else { + *value = width; + result = true; + } + } + break; + + case GLX_FBCONFIG_ID: + *value = pbuf->fbconfigID; + result = true; + break; + } + + d->unlock(d); + } + + return result; +} + +bool +apple_glx_pbuffer_set_event_mask(GLXDrawable drawable, unsigned long mask) +{ + struct apple_glx_drawable *d; + bool result = false; + + d = apple_glx_drawable_find_by_type(drawable, APPLE_GLX_DRAWABLE_PBUFFER, + APPLE_GLX_DRAWABLE_LOCK); + + if (d) { + d->types.pbuffer.event_mask = mask; + result = true; + d->unlock(d); + } + + return result; +} + +bool +apple_glx_pbuffer_get_event_mask(GLXDrawable drawable, unsigned long *mask) +{ + struct apple_glx_drawable *d; + bool result = false; + + d = apple_glx_drawable_find_by_type(drawable, APPLE_GLX_DRAWABLE_PBUFFER, + APPLE_GLX_DRAWABLE_LOCK); + if (d) { + *mask = d->types.pbuffer.event_mask; + result = true; + d->unlock(d); + } + + return result; +} -- 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/apple_glx_pbuffer.c') 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 From a1cb3babbef2af222b839a058694acc82a7074f1 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Mon, 12 Apr 2010 18:37:47 -0700 Subject: Buildfixes to work around issues in OpenGL.framework Signed-off-by: Jeremy Huddleston --- src/glx/apple/apple_glx.h | 2 +- src/glx/apple/apple_glx_context.h | 12 +++++++-- src/glx/apple/apple_glx_drawable.h | 6 ++++- src/glx/apple/apple_glx_pbuffer.c | 23 ++++++++++++++--- src/glx/apple/apple_visual.c | 9 +++++++ src/glx/apple/apple_xgl_api_read.c | 5 ++-- src/glx/apple/apple_xgl_api_read.h | 47 ---------------------------------- src/glx/apple/apple_xgl_api_stereo.c | 13 ++++++++-- src/glx/apple/apple_xgl_api_stereo.h | 39 ---------------------------- src/glx/apple/apple_xgl_api_viewport.c | 3 ++- src/glx/apple/apple_xgl_api_viewport.h | 36 -------------------------- 11 files changed, 60 insertions(+), 135 deletions(-) delete mode 100644 src/glx/apple/apple_xgl_api_read.h delete mode 100644 src/glx/apple/apple_xgl_api_stereo.h delete mode 100644 src/glx/apple/apple_xgl_api_viewport.h (limited to 'src/glx/apple/apple_glx_pbuffer.c') diff --git a/src/glx/apple/apple_glx.h b/src/glx/apple/apple_glx.h index 3ee54aa6cf..9b3643bf15 100644 --- a/src/glx/apple/apple_glx.h +++ b/src/glx/apple/apple_glx.h @@ -31,10 +31,10 @@ #define APPLE_GLX_H #include -#include #include #include #include + #define XP_NO_X_HEADERS #include diff --git a/src/glx/apple/apple_glx_context.h b/src/glx/apple/apple_glx_context.h index 7e2394f2bb..c2a3e3fcf6 100644 --- a/src/glx/apple/apple_glx_context.h +++ b/src/glx/apple/apple_glx_context.h @@ -29,11 +29,19 @@ #ifndef APPLE_GLX_CONTEXT_H #define APPLE_GLX_CONTEXT_H +/* */ +#define glTexImage1D glTexImage1D_OSX +#define glTexImage2D glTexImage2D_OSX +#define glTexImage3D glTexImage3D_OSX +#include +#include +#undef glTexImage1D +#undef glTexImage2D +#undef glTexImage3D + #include #include #include -#include -#include #define XP_NO_X_HEADERS #include #undef XP_NO_X_HEADERS diff --git a/src/glx/apple/apple_glx_drawable.h b/src/glx/apple/apple_glx_drawable.h index a15858963d..e49eae355e 100644 --- a/src/glx/apple/apple_glx_drawable.h +++ b/src/glx/apple/apple_glx_drawable.h @@ -29,6 +29,11 @@ #ifndef APPLE_GLX_DRAWABLE_H #define APPLE_GLX_DRAWABLE_H +/* Must be first for: + * + */ +#include "apple_glx_context.h" + #include #include #include @@ -36,7 +41,6 @@ #define XP_NO_X_HEADERS #include #undef XP_NO_X_HEADERS -#include "apple_glx_context.h" enum { diff --git a/src/glx/apple/apple_glx_pbuffer.c b/src/glx/apple/apple_glx_pbuffer.c index fb56b7512e..1466fea487 100644 --- a/src/glx/apple/apple_glx_pbuffer.c +++ b/src/glx/apple/apple_glx_pbuffer.c @@ -27,16 +27,33 @@ prior written authorization. */ +/* Must be before OpenGL.framework is included. Remove once fixed: + * + */ +#include +#include +#define __gltypes_h_ 1 + +/* Must be first for: + * + */ +#include "apple_glx_context.h" +#include "apple_glx_drawable.h" + #include #include #include -#include #include "apple_glx.h" #include "glcontextmodes.h" -#include "apple_glx_context.h" -#include "apple_glx_drawable.h" #include "apple_cgl.h" +/* mesa defines in glew.h, Apple in glext.h. + * Due to namespace nightmares, just do it here. + */ +#ifndef GL_TEXTURE_RECTANGLE_EXT +#define GL_TEXTURE_RECTANGLE_EXT 0x84F5 +#endif + static bool pbuffer_make_current(struct apple_glx_context *ac, struct apple_glx_drawable *d); diff --git a/src/glx/apple/apple_visual.c b/src/glx/apple/apple_visual.c index e80914741e..da5aa05fd5 100644 --- a/src/glx/apple/apple_visual.c +++ b/src/glx/apple/apple_visual.c @@ -32,9 +32,18 @@ #include #include #include + +/* */ +#define glTexImage1D glTexImage1D_OSX +#define glTexImage2D glTexImage2D_OSX +#define glTexImage3D glTexImage3D_OSX #include #include #include +#undef glTexImage1D +#undef glTexImage2D +#undef glTexImage3D + #include "apple_cgl.h" #include "apple_visual.h" #include "apple_glx.h" diff --git a/src/glx/apple/apple_xgl_api_read.c b/src/glx/apple/apple_xgl_api_read.c index 36357c7fc2..0798f45bbf 100644 --- a/src/glx/apple/apple_xgl_api_read.c +++ b/src/glx/apple/apple_xgl_api_read.c @@ -34,10 +34,9 @@ * drawable if they are different. */ #include -#include "apple_xgl_api_read.h" -#include "apple_xgl_api.h" -#include "apple_cgl.h" +#include "glxclient.h" #include "apple_glx_context.h" +#include "apple_xgl_api.h" extern struct apple_xgl_api __gl_api; diff --git a/src/glx/apple/apple_xgl_api_read.h b/src/glx/apple/apple_xgl_api_read.h deleted file mode 100644 index ffeb32afb8..0000000000 --- a/src/glx/apple/apple_xgl_api_read.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - 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. -*/ - -/* - * This file works with the glXMakeContextCurrent readable drawable. - */ -#ifndef APPLE_XGL_API_READ_H -#define APPLE_XGL_API_READ_H - -#include "glxclient.h" - -extern void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, - GLenum format, GLenum type, void *pixels); - -extern void glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, - GLenum type); - -extern void glCopyColorTable(GLenum target, GLenum internalformat, GLint x, - GLint y, GLsizei width); - -#endif diff --git a/src/glx/apple/apple_xgl_api_stereo.c b/src/glx/apple/apple_xgl_api_stereo.c index 7dd946f764..64a15f7486 100644 --- a/src/glx/apple/apple_xgl_api_stereo.c +++ b/src/glx/apple/apple_xgl_api_stereo.c @@ -27,10 +27,19 @@ prior written authorization. */ +/* This should be removed once stereo hardware bugs are fixed + * + */ + #include -#include "apple_xgl_api_stereo.h" -#include "apple_xgl_api.h" + +#define GL_GLEXT_PROTOTYPES +#include +#include + +#include "glxclient.h" #include "apple_glx_context.h" +#include "apple_xgl_api.h" extern struct apple_xgl_api __gl_api; /* diff --git a/src/glx/apple/apple_xgl_api_stereo.h b/src/glx/apple/apple_xgl_api_stereo.h deleted file mode 100644 index c285363f6f..0000000000 --- a/src/glx/apple/apple_xgl_api_stereo.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - Copyright (c) 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. -*/ - -#include "glxclient.h" - -#ifndef APPLE_XGL_API_STEREO_H -#define APPLE_XGL_API_STEREO_H - -extern void glDrawBuffer(GLenum mode); -extern void glDrawBuffers(GLsizei n, const GLenum * bufs); -extern void glDrawBuffersARB(GLsizei n, const GLenum * bufs); - -#endif diff --git a/src/glx/apple/apple_xgl_api_viewport.c b/src/glx/apple/apple_xgl_api_viewport.c index f556eefa22..e39ab15223 100644 --- a/src/glx/apple/apple_xgl_api_viewport.c +++ b/src/glx/apple/apple_xgl_api_viewport.c @@ -26,9 +26,10 @@ promote the sale, use or other dealings in this Software without prior written authorization. */ + +#include "glxclient.h" #include "apple_glx_context.h" #include "apple_xgl_api.h" -#include "apple_xgl_api_viewport.h" extern struct apple_xgl_api __gl_api; diff --git a/src/glx/apple/apple_xgl_api_viewport.h b/src/glx/apple/apple_xgl_api_viewport.h deleted file mode 100644 index 6c89ca7998..0000000000 --- a/src/glx/apple/apple_xgl_api_viewport.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - Copyright (c) 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. -*/ -#ifndef APPLE_XGL_API_VIEWPORT_H -#define APPLE_XGL_API_VIEWPORT_H - -#include "glxclient.h" - -void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); - -#endif -- cgit v1.2.3