apple: Use mesa gl.h rather than generating one.
Signed-off-by: Jeremy Huddleston <jeremyhu@freedesktop.org>
diff --git a/src/glx/apple/GL_aliases b/src/glx/apple/GL_aliases
index a8390d2..8de2238 100644
--- a/src/glx/apple/GL_aliases
+++ b/src/glx/apple/GL_aliases
@@ -5,4 +5,6 @@
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 8fa5b01..279f7ad 100644
--- a/src/glx/apple/Makefile
+++ b/src/glx/apple/Makefile
@@ -31,6 +31,7 @@
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 @@
##### 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_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 3dfdc54..fb56b75 100644
--- a/src/glx/apple/apple_glx_pbuffer.c
+++ b/src/glx/apple/apple_glx_pbuffer.c
@@ -30,6 +30,7 @@
#include <stdlib.h>
#include <pthread.h>
#include <assert.h>
+#include <GL/glew.h>
#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 0000000..7d40afe
--- /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 <GL/gl.h>
+
+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 ff314dc..e78eb32 100644
--- a/src/glx/apple/gen_funcs.tcl
+++ b/src/glx/apple/gen_funcs.tcl
@@ -72,6 +72,8 @@
}
#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 @@
ShadingModel GLenum
TextureTarget GLenum
TextureParameterName GLenum
- TextureComponentCount GLenum
+ TextureComponentCount GLint
PixelFormat GLenum
PixelType GLenum
TextureEnvTarget GLenum
@@ -412,14 +414,7 @@
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 f10ddd0..0000000
--- 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 72169f9..0000000
--- 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 <GL/glext.h>
-#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*/