summaryrefslogtreecommitdiffstats
path: root/make/stub_includes
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-03-09 08:57:24 +0100
committerSven Gothel <[email protected]>2015-03-09 08:57:24 +0100
commit99d37df6cf410117cb8d49774ef7550bcf847c7b (patch)
treee0a8b810dfee33f0ff570bc9e9e3e80115935c96 /make/stub_includes
parente3385993b4133f88fd1b8e335438f5f2cd305555 (diff)
Bug 1135 - (Re-)Include GL header for in generated native code, allowing 'ProcAddrTypedef' validation
Include GL header for in generated native code, since we need the public 'ProcAddrTypedef' to be validated against the GlueGen generated variant by the c-compiler. The 'ProcAddrTypedef' validation semantic has been introduced in GlueGen w/ commit 10060b091b76bee35246c5165d49ab546ebc4e37. Originally the GL header were always included, however, JOGL commit 0d59bd4c655ef9a27f127000848aae7f07f240ae removed the inclusion to simplify handling GL extension collisions mitigated via gl*-supplement.h. The latter produces 'redefine' errors via c-compiler. The 'redefine' issue above is resolved by conditional code (#ifdef __GLUEGEN__ ..) in glext-supplement.h.
Diffstat (limited to 'make/stub_includes')
-rw-r--r--make/stub_includes/opengl/GL/gl-platform.h54
-rw-r--r--make/stub_includes/opengl/GL/gl.h4
-rw-r--r--make/stub_includes/opengl/GL/glext-supplement.h24
-rw-r--r--make/stub_includes/opengl/GL/glx.h13
-rw-r--r--make/stub_includes/opengl/GLES/glext-supplement.h1
-rw-r--r--make/stub_includes/opengl/GLES2/gl2ext-supplement.h1
-rw-r--r--make/stub_includes/opengl/gl2.c2
-rw-r--r--make/stub_includes/opengl/gl3bc.c2
-rw-r--r--make/stub_includes/opengl/gl4bc.c2
-rw-r--r--make/stub_includes/opengl/gles1.c2
-rw-r--r--make/stub_includes/opengl/gles2.c2
-rw-r--r--make/stub_includes/win32/wglext.c14
-rw-r--r--make/stub_includes/x11/glxext.c15
-rw-r--r--make/stub_includes/x11/window-system1.c15
14 files changed, 90 insertions, 61 deletions
diff --git a/make/stub_includes/opengl/GL/gl-platform.h b/make/stub_includes/opengl/GL/gl-platform.h
index d55410b0a..f3680f28c 100644
--- a/make/stub_includes/opengl/GL/gl-platform.h
+++ b/make/stub_includes/opengl/GL/gl-platform.h
@@ -13,6 +13,20 @@
#define __WIN32__
#endif
+/*
+ * WINDOWS: Include windows.h here to define APIENTRY.
+ * It is also useful when applications include this file by
+ * including only glut.h, since glut.h depends on windows.h.
+ * Applications needing to include windows.h with parms other
+ * than "WIN32_LEAN_AND_MEAN" may include windows.h before
+ * glut.h or gl.h.
+ */
+#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
+#define WIN32_LEAN_AND_MEAN 1
+#include <windows.h>
+#undef WIN32_LEAN_AND_MEAN
+#endif
+
#if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__))
# if defined(_MSC_VER) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
# define GLAPI __declspec(dllexport)
@@ -31,32 +45,19 @@
# endif
# ifndef APIENTRY
# define APIENTRY
-# endif /* APIENTRY */
+# endif
#endif /* WIN32 / CYGWIN bracket */
-#if (defined(__BEOS__) && defined(__POWERPC__)) || defined(__QUICKDRAW__)
-# define PRAGMA_EXPORT_SUPPORTED 1
+#ifndef GLAPI
+#define GLAPI extern
#endif
-
-/*
- * WINDOWS: Include windows.h here to define APIENTRY.
- * It is also useful when applications include this file by
- * including only glut.h, since glut.h depends on windows.h.
- * Applications needing to include windows.h with parms other
- * than "WIN32_LEAN_AND_MEAN" may include windows.h before
- * glut.h or gl.h.
- */
-#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
-#define WIN32_LEAN_AND_MEAN 1
-#include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
+#ifndef APIENTRYP
+#define APIENTRYP APIENTRY *
#endif
-/**
-#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) && !defined(__CYGWIN__)
-#include <gl/mesa_wgl.h>
+#if (defined(__BEOS__) && defined(__POWERPC__)) || defined(__QUICKDRAW__)
+# define PRAGMA_EXPORT_SUPPORTED 1
#endif
-*/
#if defined(macintosh) && PRAGMA_IMPORT_SUPPORTED
#pragma import on
@@ -70,18 +71,5 @@
#pragma export on
#endif
-/**
- * The defaults for all ..
- */
-#ifndef APIENTRY
-#define APIENTRY
-#endif
-#ifndef APIENTRYP
-#define APIENTRYP APIENTRY *
-#endif
-#ifndef GLAPI
-#define GLAPI extern
-#endif
-
#endif /* __gl_platform_h_ */
diff --git a/make/stub_includes/opengl/GL/gl.h b/make/stub_includes/opengl/GL/gl.h
index 56812a531..430846e29 100644
--- a/make/stub_includes/opengl/GL/gl.h
+++ b/make/stub_includes/opengl/GL/gl.h
@@ -1314,7 +1314,9 @@ GLAPI void APIENTRY glCopyTexSubImage2D( GLenum target, GLint level, GLint xoffs
#endif /* GL_VERSION_1_1 */
/* Include Post-GL 1.1 changes and extensions */
-#include <GL/glext.h>
+// Due to 'glext-supplement.h', we prefer to include it manually afterwards.
+// This gives us the same behavior as the vanilla GLES, GLES2, GLES3 and glcorearb header.
+// #include <GL/glext.h>
/**********************************************************************
diff --git a/make/stub_includes/opengl/GL/glext-supplement.h b/make/stub_includes/opengl/GL/glext-supplement.h
index cbcf7e0a7..0ea284f28 100644
--- a/make/stub_includes/opengl/GL/glext-supplement.h
+++ b/make/stub_includes/opengl/GL/glext-supplement.h
@@ -35,7 +35,6 @@ extern "C" {
/* Function declaration macros - to move into gl-platform.h */
#include "gl-platform.h"
-#include "gl-types.h"
/**
* GL_EXT_texture_storage == GL_ARB_texture_storage
@@ -74,9 +73,11 @@ extern "C" {
typedef void (APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
typedef void (APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
typedef void (APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+#ifdef __GLUEGEN__
typedef void (APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+#endif
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
GLAPI void APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
@@ -92,8 +93,14 @@ GLAPI void APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsize
* which collides from GL/glext.h. The latter is obsolete and has different semantics!
* This variant will override the 'odd' GL/glext.h one.
* See gl-common.cfg!
+ * This extension is only included while running GlueGen,
+ * due to redefined in glext.h under a different extension.
+ * However, native compilation will validate GlueGen's
+ * 'ProcAddrTypedef' w/ the glext.h variant!
*/
+#ifdef __GLUEGEN__
#ifndef GL_EXT_separate_shader_objects
+typedef char GLchar;
#define GL_EXT_separate_shader_objects 1
#define GL_ACTIVE_PROGRAM_EXT 0x8259
#define GL_VERTEX_SHADER_BIT_EXT 0x00000001
@@ -190,8 +197,21 @@ GLAPI void APIENTRY glProgramUniformMatrix2x4fvEXT (GLuint program, GLint locati
GLAPI void APIENTRY glProgramUniformMatrix4x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
GLAPI void APIENTRY glProgramUniformMatrix3x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
GLAPI void APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-#endif
+#endif /* GL_GLEXT_PROTOTYPES */
#endif /* GL_EXT_separate_shader_objects */
+#else /* __GLUEGEN_ */
+// GL/glext.h only has the non EXT (subsumed) variants of the following symbols
+typedef void (APIENTRYP PFNGLACTIVESHADERPROGRAMEXTPROC) (GLuint pipeline, GLuint program);
+typedef void (APIENTRYP PFNGLBINDPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
+typedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar **strings);
+typedef void (APIENTRYP PFNGLDELETEPROGRAMPIPELINESEXTPROC) (GLsizei n, const GLuint *pipelines);
+typedef void (APIENTRYP PFNGLGENPROGRAMPIPELINESEXTPROC) (GLsizei n, GLuint *pipelines);
+typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEIVEXTPROC) (GLuint pipeline, GLenum pname, GLint *params);
+typedef GLboolean (APIENTRYP PFNGLISPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
+typedef void (APIENTRYP PFNGLUSEPROGRAMSTAGESEXTPROC) (GLuint pipeline, GLbitfield stages, GLuint program);
+typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
+#endif /* __GLUEGEN_ */
#ifdef __cplusplus
}
diff --git a/make/stub_includes/opengl/GL/glx.h b/make/stub_includes/opengl/GL/glx.h
index a74cd23e8..dc4b85dac 100644
--- a/make/stub_includes/opengl/GL/glx.h
+++ b/make/stub_includes/opengl/GL/glx.h
@@ -44,8 +44,10 @@
#pragma message enable nosimpint
#endif
#endif
-#include <GL/gl.h>
+// Due to 'glext-supplement.h', we prefer to include it manually afterwards.
+// This gives us the same behavior as the vanilla GLES, GLES2, GLES3 and glcorearb header.
+// #include <GL/gl.h>
#if defined(USE_MGL_NAMESPACE)
#include <GL/glx_mangle.h>
@@ -176,7 +178,7 @@ typedef void ( *__GLXextFuncPtr)(void);
#define GLX_SAMPLE_BUFFERS 100000
#define GLX_SAMPLES 100001
typedef __GLXextFuncPtr ( *PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName);
-#ifdef GL_GLEXT_PROTOTYPES
+#ifdef GLX_GLXEXT_PROTOTYPES
__GLXextFuncPtr glXGetProcAddress (const GLubyte *procName);
#endif
#endif /* GLX_VERSION_1_4 */
@@ -184,13 +186,14 @@ __GLXextFuncPtr glXGetProcAddress (const GLubyte *procName);
#ifndef GLX_ARB_get_proc_address
#define GLX_ARB_get_proc_address 1
typedef __GLXextFuncPtr ( *PFNGLXGETPROCADDRESSARBPROC) (const GLubyte *procName);
-#ifdef GL_GLEXT_PROTOTYPES
+#ifdef GLX_GLXEXT_PROTOTYPES
__GLXextFuncPtr glXGetProcAddressARB (const GLubyte *procName);
#endif
#endif /* GLX_ARB_get_proc_address */
-
-#include <GL/glxext.h>
+// Due to 'glext-supplement.h', we prefer to include it manually afterwards.
+// This gives us the same behavior as the vanilla GLES, GLES2, GLES3 and glcorearb header.
+// #include <GL/glxext.h>
#ifdef __cplusplus
}
diff --git a/make/stub_includes/opengl/GLES/glext-supplement.h b/make/stub_includes/opengl/GLES/glext-supplement.h
index 034c23827..da3e97df6 100644
--- a/make/stub_includes/opengl/GLES/glext-supplement.h
+++ b/make/stub_includes/opengl/GLES/glext-supplement.h
@@ -29,7 +29,6 @@ extern "C" {
*/
#include <GLES/glplatform.h>
-#include "gl-types.h"
#ifndef GL_APIENTRYP
#define GL_APIENTRYP GL_APIENTRY*
diff --git a/make/stub_includes/opengl/GLES2/gl2ext-supplement.h b/make/stub_includes/opengl/GLES2/gl2ext-supplement.h
index 7cf5395b3..812f6abcd 100644
--- a/make/stub_includes/opengl/GLES2/gl2ext-supplement.h
+++ b/make/stub_includes/opengl/GLES2/gl2ext-supplement.h
@@ -34,7 +34,6 @@ extern "C" {
*/
#include <GLES2/gl2platform.h>
-#include "gl-types.h"
#ifndef GL_APIENTRYP
#define GL_APIENTRYP GL_APIENTRY*
diff --git a/make/stub_includes/opengl/gl2.c b/make/stub_includes/opengl/gl2.c
index 037d67d0b..343b6bafd 100644
--- a/make/stub_includes/opengl/gl2.c
+++ b/make/stub_includes/opengl/gl2.c
@@ -4,6 +4,6 @@
// "glext.h" are parsed.
#define GL_GLEXT_PROTOTYPES
-#include <GL/glext-supplement.h>
#include <GL/gl.h>
+#include <GL/glext-supplement.h>
#include <GL/glext.h>
diff --git a/make/stub_includes/opengl/gl3bc.c b/make/stub_includes/opengl/gl3bc.c
index 81f7a50d6..78006575d 100644
--- a/make/stub_includes/opengl/gl3bc.c
+++ b/make/stub_includes/opengl/gl3bc.c
@@ -3,8 +3,8 @@
// Define GL_GLEXT_PROTOTYPES so that the OpenGL extension prototypes are parsed.
#define GL_GLEXT_PROTOTYPES
-#include <GL/glext-supplement.h>
#include <GL/gl.h>
+#include <GL/glext-supplement.h>
#include <GL/glext.h>
#include <GL/glcorearbext.h>
diff --git a/make/stub_includes/opengl/gl4bc.c b/make/stub_includes/opengl/gl4bc.c
index 81f7a50d6..78006575d 100644
--- a/make/stub_includes/opengl/gl4bc.c
+++ b/make/stub_includes/opengl/gl4bc.c
@@ -3,8 +3,8 @@
// Define GL_GLEXT_PROTOTYPES so that the OpenGL extension prototypes are parsed.
#define GL_GLEXT_PROTOTYPES
-#include <GL/glext-supplement.h>
#include <GL/gl.h>
+#include <GL/glext-supplement.h>
#include <GL/glext.h>
#include <GL/glcorearbext.h>
diff --git a/make/stub_includes/opengl/gles1.c b/make/stub_includes/opengl/gles1.c
index f8ae02f44..2b0ed5946 100644
--- a/make/stub_includes/opengl/gles1.c
+++ b/make/stub_includes/opengl/gles1.c
@@ -5,6 +5,6 @@
// "glext.h" are parsed.
#define GL_GLEXT_PROTOTYPES
-#include <GLES/glext-supplement.h>
#include <GLES/gl.h>
+#include <GLES/glext-supplement.h>
#include <GLES/glext.h>
diff --git a/make/stub_includes/opengl/gles2.c b/make/stub_includes/opengl/gles2.c
index a1e108803..cba5de136 100644
--- a/make/stub_includes/opengl/gles2.c
+++ b/make/stub_includes/opengl/gles2.c
@@ -5,7 +5,7 @@
// "gl2ext.h" are parsed.
#define GL_GLEXT_PROTOTYPES
-#include <GLES2/gl2ext-supplement.h>
#include <GLES2/gl2.h>
+#include <GLES2/gl2ext-supplement.h>
#include <GLES2/gl2ext.h>
diff --git a/make/stub_includes/win32/wglext.c b/make/stub_includes/win32/wglext.c
index 60c1f74ac..5a3e759e5 100644
--- a/make/stub_includes/win32/wglext.c
+++ b/make/stub_includes/win32/wglext.c
@@ -1,14 +1,18 @@
#define GLAPI
-// Define GL_GLEXT_PROTOTYPES so that the OpenGL extension prototypes in
-// "glext.h" are parsed.
-#define GL_GLEXT_PROTOTYPES
+#include <GL/gl-platform.h>
+
+// Define GL_GLEXT_PROTOTYPES so that the OpenGL GLX extension prototypes in
+// "glx.h" are parsed.
+// #define GL_GLEXT_PROTOTYPES
+// #include <GL/gl.h>
+// #include <GL/glext-supplement.h>
+// #include <GL/glext.h>
+#include <gl-types.h>
-#include <GL/gl.h>
// Bring in the wgl extensions
#define WGL_WGLEXT_PROTOTYPES
-#define SKIP_WGL_HANDLE_DEFINITIONS
#include <windows.h>
#include <wingdi_types.h>
#include <GL/wglext.h>
diff --git a/make/stub_includes/x11/glxext.c b/make/stub_includes/x11/glxext.c
index e781b6e88..35ed63b5b 100644
--- a/make/stub_includes/x11/glxext.c
+++ b/make/stub_includes/x11/glxext.c
@@ -4,14 +4,21 @@
#define _Xconst const
#endif /* _Xconst */
+#include <GL/gl-platform.h>
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
// Define GL_GLEXT_PROTOTYPES so that the OpenGL GLX extension prototypes in
// "glx.h" are parsed.
-#define GL_GLEXT_PROTOTYPES
+// #define GL_GLEXT_PROTOTYPES
+// #include <GL/gl.h>
+// #include <GL/glext-supplement.h>
+// #include <GL/glext.h>
+#include <gl-types.h>
// Define GLX_GLXEXT_PROTOTYPES so that the OpenGL GLX extension prototypes in
// "glxext.h" are parsed.
#define GLX_GLXEXT_PROTOTYPES
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
#include <GL/glx.h>
-// GL/glxext.h included by GL/glx.h
+#include <GL/glxext.h>
diff --git a/make/stub_includes/x11/window-system1.c b/make/stub_includes/x11/window-system1.c
index e781b6e88..35ed63b5b 100644
--- a/make/stub_includes/x11/window-system1.c
+++ b/make/stub_includes/x11/window-system1.c
@@ -4,14 +4,21 @@
#define _Xconst const
#endif /* _Xconst */
+#include <GL/gl-platform.h>
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
// Define GL_GLEXT_PROTOTYPES so that the OpenGL GLX extension prototypes in
// "glx.h" are parsed.
-#define GL_GLEXT_PROTOTYPES
+// #define GL_GLEXT_PROTOTYPES
+// #include <GL/gl.h>
+// #include <GL/glext-supplement.h>
+// #include <GL/glext.h>
+#include <gl-types.h>
// Define GLX_GLXEXT_PROTOTYPES so that the OpenGL GLX extension prototypes in
// "glxext.h" are parsed.
#define GLX_GLXEXT_PROTOTYPES
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
#include <GL/glx.h>
-// GL/glxext.h included by GL/glx.h
+#include <GL/glxext.h>