Initial EGL core and extension support with Python egl.xml spec parser

This commit is contained in:
Nigel Stewart 2016-01-20 21:55:08 +10:00
parent 5a6171078b
commit 43a9299230
19 changed files with 377 additions and 29 deletions

1
.gitattributes vendored
View File

@ -1,5 +1,6 @@
* text eol=lf
*.png binary
*.pdf binary
build/*/* text eol=crlf
CMakeLists.txt text eol=lf
build/cmake/* text eol=lf

View File

@ -41,16 +41,19 @@ BLACKLIST = blacklist
GL_CORE_SPEC := $(CORE)/GL_VERSION*
GLX_CORE_SPEC := $(CORE)/GLX_VERSION*
EGL_CORE_SPEC := $(CORE)/EGL_VERSION*
ifeq (custom,$(MAKECMDGOALS))
#GL_CORE_SPEC := $(shell grep GL_VERSION custom.txt | perl -pi -e "s=^=$(CORE)/=g;")
GL_EXT_SPEC := $(shell grep "^[ \t]*GL_" custom.txt | grep -v GL_VERSION | perl -pi -e "s=^=$(EXT)/=g;")
WGL_EXT_SPEC := $(shell grep "^[ \t]*WGL_" custom.txt | perl -pi -e "s=^=$(EXT)/=g;")
#GLX_CORE_SPEC := $(shell grep GLX_VERSION custom.txt | perl -pi -e "s=^=$(CORE)/=g;")
GLX_EXT_SPEC := $(shell grep "^[ \t]*GLX_" custom.txt | grep -v GLX_VERSION | perl -pi -e "s=^=$(EXT)/=g;")
EGL_EXT_SPEC := $(shell grep "^[ \t]*EGL_" custom.txt | grep -v EGL_VERSION | perl -pi -e "s=^=$(EXT)/=g;")
else
GL_EXT_SPEC := $(EXT)/GL_*
WGL_EXT_SPEC := $(EXT)/WGL_*
GLX_EXT_SPEC := $(EXT)/GLX_*
EGL_EXT_SPEC := $(EXT)/EGL_*
endif
PARSE_SPEC = parse_spec.pl
@ -65,7 +68,8 @@ B.DEST = $(TOP)/build
I.TARGETS = \
$(I.DEST)/glew.h \
$(I.DEST)/wglew.h \
$(I.DEST)/glxew.h
$(I.DEST)/glxew.h \
$(I.DEST)/eglew.h
ifeq (yes,$(GLEW_SPLIT_SOURCE))
S.TARGETS = \
@ -175,6 +179,21 @@ $(I.DEST)/glxew.h: $(EXT)/.dummy
perl -e "s/GLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_2;/GLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_0;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_1;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_2;/" -pi $@
cat $(SRC)/glxew_tail.h >> $@
$(I.DEST)/eglew.h: $(EXT)/.dummy
@echo "--------------------------------------------------------------------"
@echo "Creating eglew.h"
@echo "--------------------------------------------------------------------"
cp -f $(SRC)/glew_license.h $@
cat $(SRC)/mesa_license.h >> $@
cat $(SRC)/khronos_license.h >> $@
cat $(SRC)/eglew_head.h >> $@
$(BIN)/make_header.pl "" EGL $(EGL_CORE_SPEC) >> $@
$(BIN)/make_header.pl "" EGL $(EGL_EXT_SPEC) >> $@
cat $(SRC)/eglew_mid.h >> $@
$(BIN)/make_struct_fun.pl EGLEW_FUN_EXPORT $(EGL_CORE_SPEC) $(EGL_EXT_SPEC) >> $@
$(BIN)/make_struct_var.pl EGLEW_VAR_EXPORT $(EGL_CORE_SPEC) $(EGL_EXT_SPEC) >> $@
cat $(SRC)/eglew_tail.h >> $@
$(S.DEST)/glew.c: $(EXT)/.dummy
@echo "--------------------------------------------------------------------"
@echo "Creating glew.c"
@ -200,14 +219,26 @@ $(S.DEST)/glew.c: $(EXT)/.dummy
$(BIN)/make_list.pl $(GL_EXT_SPEC) >> $@
$(BIN)/make_list2.pl $(GL_EXT_SPEC) >> $@
echo -e "\n return GLEW_OK;\n}\n" >> $@
echo -e "\n#if defined(_WIN32) && !defined(GLEW_EGL) && !defined(GLEW_OSMESA)" >> $@
echo -e "\n#if defined(GLEW_OSMESA)" >> $@
echo -e "\n#elif defined(GLEW_EGL)" >> $@
$(BIN)/make_def_fun.pl EGL $(EGL_CORE_SPEC) >> $@
$(BIN)/make_def_fun.pl EGL $(EGL_EXT_SPEC) >> $@
$(BIN)/make_def_var.pl EGL $(EGL_CORE_SPEC) >> $@
$(BIN)/make_def_var.pl EGL $(EGL_EXT_SPEC) >> $@
$(BIN)/make_init.pl EGL $(EGL_CORE_SPEC) >> $@
$(BIN)/make_init.pl EGL $(EGL_EXT_SPEC) >> $@
cat $(SRC)/glew_init_egl.c >> $@
$(BIN)/make_list.pl $(EGL_CORE_SPEC) >> $@
$(BIN)/make_list.pl $(EGL_EXT_SPEC) >> $@
echo -e "\n return GLEW_OK;\n}" >> $@
echo -e "\n#elif defined(_WIN32)" >> $@
$(BIN)/make_def_fun.pl WGL $(WGL_EXT_SPEC) >> $@
$(BIN)/make_def_var.pl WGL $(WGL_EXT_SPEC) >> $@
$(BIN)/make_init.pl WGL $(WGL_EXT_SPEC) >> $@
cat $(SRC)/glew_init_wgl.c >> $@
$(BIN)/make_list.pl $(WGL_EXT_SPEC) >> $@
echo -e "\n return GLEW_OK;\n}" >> $@;
echo -e "\n#elif !defined(GLEW_EGL) && !defined(GLEW_OSMESA) && !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))" >> $@
echo -e "\n#elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))" >> $@
$(BIN)/make_def_fun.pl GLX $(GLX_CORE_SPEC) >> $@
$(BIN)/make_def_fun.pl GLX $(GLX_EXT_SPEC) >> $@
echo -e "\nGLboolean __GLXEW_VERSION_1_0 = GL_FALSE;" >> $@
@ -228,6 +259,8 @@ $(S.DEST)/glew.c: $(EXT)/.dummy
$(BIN)/make_str.pl $(WGL_EXT_SPEC) >> $@
cat $(SRC)/glew_str_glx.c >> $@
$(BIN)/make_str.pl $(GLX_CORE_SPEC) $(GLX_EXT_SPEC) >> $@
cat $(SRC)/glew_str_egl.c >> $@
$(BIN)/make_str.pl $(EGL_CORE_SPEC) $(EGL_EXT_SPEC) >> $@
cat $(SRC)/glew_str_tail.c >> $@
perl -e "s/GLEW_VERSION_STRING/$(GLEW_VERSION)/g" -pi $@
perl -e "s/GLEW_VERSION_MAJOR_STRING/$(GLEW_MAJOR)/g" -pi $@
@ -245,14 +278,13 @@ $(S.DEST)/glewinfo.c: $(EXT)/.dummy
cat $(SRC)/glewinfo_head.c >> $@
$(BIN)/make_info.pl $(GL_CORE_SPEC) >> $@
$(BIN)/make_info.pl $(GL_EXT_SPEC) >> $@
echo -e "#if !defined(GLEW_EGL)\n" >> $@
echo -e "#ifdef _WIN32\n" >> $@
echo -e "#if defined(GLEW_EGL)\n" >> $@
echo -e "#elif _WIN32\n" >> $@
$(BIN)/make_info.pl $(WGL_EXT_SPEC) >> $@
echo -e "#else /* _UNIX */\n" >> $@
$(BIN)/make_info.pl $(GLX_CORE_SPEC) >> $@
$(BIN)/make_info.pl $(GLX_EXT_SPEC) >> $@
echo -e "#endif /* _WIN32 */\n" >> $@
echo -e "#endif /* !defined(GLEW_EGL) */\n" >> $@
cat $(SRC)/glewinfo_gl.c >> $@
$(BIN)/make_info_list.pl $(GL_CORE_SPEC) >> $@
@ -262,6 +294,9 @@ $(S.DEST)/glewinfo.c: $(EXT)/.dummy
cat $(SRC)/glewinfo_glx.c >> $@
$(BIN)/make_info_list.pl $(GLX_CORE_SPEC) >> $@
$(BIN)/make_info_list.pl $(GLX_EXT_SPEC) >> $@
cat $(SRC)/glewinfo_egl.c >> $@
$(BIN)/make_info_list.pl $(EGL_CORE_SPEC) >> $@
$(BIN)/make_info_list.pl $(EGL_EXT_SPEC) >> $@
cat $(SRC)/glewinfo_tail.c >> $@
perl -e 's/"glColorSubTable"/"glBlendEquation", glBlendEquation == NULL);\n glewInfoFunc("glColorSubTable"/g' -pi $@
rm -f $@.bak

View File

@ -38,7 +38,7 @@ if (@ARGV)
$extvar =~ s/GL(X*)_/GL$1EW_/;
my $extpre = $extname;
$extpre =~ s/^(W?)GL(X?).*$/\l$1gl\l$2ew/;
$extpre =~ s/^(W?E?)GL(X?).*$/\l$1gl\l$2ew/;
#my $pextvar = prefix_varname($extvar);

128
auto/bin/parse_xml.py Executable file
View File

@ -0,0 +1,128 @@
#!/usr/bin/python
import re
import sys
from xml.dom.minidom import parse, Node
def findChildren(node, path):
result = []
if len(path)==1:
for i in node.childNodes:
if i.nodeType==Node.ELEMENT_NODE:
if i.tagName==path[0]:
result.append(i)
else:
for i in node.childNodes:
if i.nodeType==Node.ELEMENT_NODE:
if i.tagName==path[0]:
result.extend(findChildren(i, path[1:]))
return result
def findData(node, path):
return [ i.firstChild.data for i in findChildren(node, path) ]
def findParams(node):
n = findData(node, ['name'])[0]
t = ''
for i in node.childNodes:
if i.nodeType==Node.TEXT_NODE:
t += i.data
if i.nodeType==Node.ELEMENT_NODE and i.tagName=='ptype':
t += i.firstChild.data
return ( t, n)
def findEnums(dom):
ret = {}
for i in findChildren(dom, [ 'registry', 'enums', 'enum' ]):
n = i.getAttribute('name')
v = i.getAttribute('value')
ret[n] = v
return ret
def findCommands(dom):
ret = {}
for i in findChildren(dom, [ 'registry', 'commands', 'command' ]):
r,n = findParams(findChildren(i, ['proto'])[0])
p = [ findParams(j) for j in findChildren(i, ['param'])]
ret[n] = (r, p)
return ret
def findFeatures(dom):
ret = {}
for i in findChildren(dom, [ 'registry', 'feature' ]):
n = i.getAttribute('name')
e = []
c = []
for j in findChildren(i, [ 'require', 'enum' ]):
e.append(j.getAttribute("name"))
for j in findChildren(i, [ 'require', 'command' ]):
c.append(j.getAttribute("name"))
ret[n] = (e,c)
return ret
def findExtensions(dom):
ret = {}
for i in findChildren(dom, [ 'registry', 'extensions', 'extension' ]):
n = i.getAttribute('name')
e = []
c = []
for j in findChildren(i, [ 'require', 'enum' ]):
e.append(j.getAttribute("name"))
for j in findChildren(i, [ 'require', 'command' ]):
c.append(j.getAttribute("name"))
ret[n] = (e,c)
return ret
def findApi(dom, name):
enums = findEnums(dom)
commands = findCommands(dom)
features = findFeatures(dom)
extensions = findExtensions(dom)
return (enums, commands, features, extensions)
def writeExtension(f, name, extension, enums, commands):
f.write('%s\n'%name)
f.write('%s\n'%'https://www.khronos.org/registry/egl/specs/eglspec.1.5.pdf')
if name.find('_VERSION_')==-1:
f.write('%s\n'%name)
else:
f.write('\n')
f.write('\n')
enums = [ (j, enums[j]) for j in extension[0] ]
for e in sorted(enums, key=lambda i: i[1]):
f.write('\t%s %s\n'%(e[0], e[1]))
commands = [ (j, commands[j]) for j in extension[1] ]
for c in sorted(commands):
f.write('\t%s %s (%s)\n'%(c[1][0], c[0], ', '.join( [ '%s %s'%(j[0], j[1]) for j in c[1][1] ] )))
if __name__ == '__main__':
from optparse import OptionParser
import os
parser = OptionParser('usage: %prog [options] [XML specs...]')
parser.add_option("--core", dest="core", help="location for core outputs", default='')
parser.add_option("--extensions", dest="extensions", help="location for extensions outputs", default='')
(options, args) = parser.parse_args()
for i in args:
dom = parse(i)
api = findApi(dom, 'egl')
print 'Found {} enums, {} commands, {} features and {} extensions.'.format(
len(api[0]), len(api[1]), len(api[2]), len(api[3]))
if len(options.core):
for i in api[2].keys():
f = open('%s/%s'%(options.core, i), 'w')
writeExtension(f, i, api[2][i], api[0], api[1])
f.close()
if len(options.extensions):
for i in api[3].keys():
f = open('%s/%s'%(options.extensions, i), 'w')
writeExtension(f, i, api[3][i], api[0], api[1])
f.close()

BIN
auto/khronos/readme.pdf Normal file

Binary file not shown.

74
auto/src/eglew_head.h Normal file
View File

@ -0,0 +1,74 @@
#ifndef __eglew_h__
#define __eglew_h__
#define __EGLEW_H__
#ifdef __eglext_h_
#error eglext.h included before eglew.h
#endif
#if defined(__egl_h_)
#error egl.h included before eglew.h
#endif
#define __eglext_h_
#define __egl_h_
#ifndef EGLAPIENTRY
#define EGLAPIENTRY
#endif
#ifndef EGLAPI
#define EGLAPI extern
#endif
/* EGL Types */
#include <sys/types.h>
#include <KHR/khrplatform.h>
#include <EGL/eglplatform.h>
typedef int32_t EGLint;
typedef unsigned int EGLBoolean;
typedef void *EGLDisplay;
typedef void *EGLConfig;
typedef void *EGLSurface;
typedef void *EGLContext;
typedef void (*__eglMustCastToProperFunctionPointerType)(void);
typedef unsigned int EGLenum;
typedef void *EGLClientBuffer;
typedef void *EGLSync;
typedef intptr_t EGLAttrib;
typedef khronos_utime_nanoseconds_t EGLTime;
typedef void *EGLImage;
typedef void *EGLSyncKHR;
typedef intptr_t EGLAttribKHR;
typedef void *EGLLabelKHR;
typedef void *EGLObjectKHR;
typedef void (EGLAPIENTRY *EGLDEBUGPROCKHR)(EGLenum error,const char *command,EGLint messageType,EGLLabelKHR threadLabel,EGLLabelKHR objectLabel,const char* message);
typedef khronos_utime_nanoseconds_t EGLTimeKHR;
typedef void *EGLImageKHR;
typedef void *EGLStreamKHR;
typedef khronos_uint64_t EGLuint64KHR;
typedef int EGLNativeFileDescriptorKHR;
typedef khronos_ssize_t EGLsizeiANDROID;
typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize);
typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize);
typedef void *EGLDeviceEXT;
typedef void *EGLOutputLayerEXT;
typedef void *EGLOutputPortEXT;
typedef void *EGLSyncNV;
typedef khronos_utime_nanoseconds_t EGLTimeNV;
typedef khronos_utime_nanoseconds_t EGLuint64NV;
struct EGLClientPixmapHI;
EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress (const char *procname);
#ifdef __cplusplus
extern "C" {
#endif

4
auto/src/eglew_mid.h Normal file
View File

@ -0,0 +1,4 @@
/* ------------------------------------------------------------------------- */
#define EGLEW_FUN_EXPORT GLEW_FUN_EXPORT
#define EGLEW_VAR_EXPORT GLEW_VAR_EXPORT

15
auto/src/eglew_tail.h Normal file
View File

@ -0,0 +1,15 @@
/* ------------------------------------------------------------------------ */
GLEWAPI GLenum GLEWAPIENTRY eglewInit ();
GLEWAPI GLboolean GLEWAPIENTRY eglewIsSupported (const char *name);
#define EGLEW_GET_VAR(x) (*(const GLboolean*)&x)
#define EGLEW_GET_FUN(x) x
GLEWAPI GLboolean GLEWAPIENTRY eglewGetExtension (const char *name);
#ifdef __cplusplus
}
#endif
#endif /* __eglew_h__ */

View File

@ -1,9 +1,10 @@
#include <GL/glew.h>
#if defined(GLEW_EGL)
#elif defined(GLEW_OSMESA)
#if defined(GLEW_OSMESA)
# define GLAPI extern
# include <GL/osmesa.h>
#elif defined(GLEW_EGL)
# include <GL/eglew.h>
#elif defined(_WIN32)
# include <GL/wglew.h>
#elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))
@ -15,7 +16,6 @@
#include <string.h> /* For memset */
#if defined(GLEW_EGL)
extern void (*eglGetProcAddress (const char *procname))();
#elif defined(GLEW_REGAL)
/* In GLEW_REGAL mode we call direcly into the linked
@ -116,12 +116,12 @@ void* NSGLGetProcAddress (const GLubyte *name)
/*
* Define glewGetProcAddress.
*/
#if defined(GLEW_EGL)
# define glewGetProcAddress(name) eglGetProcAddress((const char *)name)
#elif defined(GLEW_REGAL)
#if defined(GLEW_REGAL)
# define glewGetProcAddress(name) regalGetProcAddress((const GLchar *)name)
#elif defined(GLEW_OSMESA)
# define glewGetProcAddress(name) OSMesaGetProcAddress((const char *)name)
#elif defined(GLEW_EGL)
# define glewGetProcAddress(name) eglGetProcAddress((const char *)name)
#elif defined(_WIN32)
# define glewGetProcAddress(name) wglGetProcAddress((LPCSTR)name)
#elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX)
@ -153,6 +153,11 @@ void* NSGLGetProcAddress (const GLubyte *name)
# define GLXEW_GET_VAR(x) (x)
#endif /* GLXEW_GET_VAR */
#ifdef EGLEW_GET_VAR
# undef EGLEW_GET_VAR
# define EGLEW_GET_VAR(x) (x)
#endif /* EGLEW_GET_VAR */
/*
* GLEW, just like OpenGL or GLU, does not rely on the standard C library.
* These functions implement the functionality required in this file.

31
auto/src/glew_init_egl.c Normal file
View File

@ -0,0 +1,31 @@
/* ------------------------------------------------------------------------ */
GLboolean eglewGetExtension (const char* name)
{
const GLubyte* start;
const GLubyte* end;
/* TODO */
/* return _glewSearchExtension(name, start, end); */
return GL_FALSE;
}
GLenum eglewInit ()
{
int major, minor;
const GLubyte* extStart;
const GLubyte* extEnd;
/* initialize flags */
EGLEW_VERSION_1_0 = GL_TRUE;
EGLEW_VERSION_1_1 = GL_TRUE;
EGLEW_VERSION_1_2 = GL_TRUE;
EGLEW_VERSION_1_3 = GL_TRUE;
EGLEW_VERSION_1_4 = GL_TRUE;
EGLEW_VERSION_1_5 = GL_TRUE;
/* query EGL version */
/* query EGL extension string */
/* initialize extensions */

View File

@ -37,7 +37,9 @@ GLenum GLEWAPIENTRY glewInit (void)
GLenum r;
r = glewContextInit();
if ( r != 0 ) return r;
#if defined(GLEW_EGL) || defined(GLEW_OSMESA) || defined(__ANDROID__) || defined(__native_client__) || defined(__HAIKU__)
#if defined(GLEW_EGL)
return eglewInit();
#elif defined(GLEW_OSMESA) || defined(__ANDROID__) || defined(__native_client__) || defined(__HAIKU__)
return r;
#elif defined(_WIN32)
return wglewInit();

17
auto/src/glew_str_egl.c Normal file
View File

@ -0,0 +1,17 @@
}
ret = (len == 0);
}
return ret;
}
#elif defined(GLEW_EGL)
GLboolean eglewIsSupported (const char* name)
{
const GLubyte* pos = (const GLubyte*)name;
GLuint len = _glewStrLen(pos);
GLboolean ret = GL_TRUE;
while (ret && len > 0)
{
if(_glewStrSame1(&pos, &len, (const GLubyte*)"EGL_", 4))
{

View File

@ -4,7 +4,7 @@
return ret;
}
#elif !defined(GLEW_EGL) && !defined(GLEW_OSMESA) && !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
#elif !defined(GLEW_OSMESA) && !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
GLboolean glxewIsSupported (const char* name)
{

6
auto/src/glewinfo_egl.c Normal file
View File

@ -0,0 +1,6 @@
}
#elif defined(GLEW_EGL)
static void eglewInfo ()
{

View File

@ -1,6 +1,6 @@
}
#elif !defined(GLEW_EGL) && !defined(GLEW_OSMESA) /* _UNIX */
#elif !defined(GLEW_OSMESA) /* _UNIX */
static void glxewInfo ()
{

View File

@ -27,8 +27,8 @@ static FILE* f;
struct createParams
{
#if defined(GLEW_EGL)
#elif defined(GLEW_OSMESA)
#if defined(GLEW_OSMESA)
#elif defined(GLEW_EGL)
#elif defined(_WIN32)
int pixelformat;
#elif !defined(__APPLE__) && !defined(__HAIKU__) || defined(GLEW_APPLE_GLX)

View File

@ -9,8 +9,8 @@ int main (int argc, char** argv)
GLuint err;
struct createParams params =
{
#if defined(GLEW_EGL)
#elif defined(GLEW_OSMESA)
#if defined(GLEW_OSMESA)
#elif defined(GLEW_EGL)
#elif defined(_WIN32)
-1, /* pixelformat */
#elif !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
@ -26,8 +26,8 @@ int main (int argc, char** argv)
if (glewParseArgs(argc-1, argv+1, &params))
{
fprintf(stderr, "Usage: glewinfo "
#if defined(GLEW_EGL)
#elif defined(GLEW_OSMESA)
#if defined(GLEW_OSMESA)
#elif defined(GLEW_EGL)
#elif defined(_WIN32)
"[-pf <pixelformat>] "
#elif !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
@ -70,8 +70,8 @@ int main (int argc, char** argv)
fprintf(f, " GLEW Extension Info\n");
fprintf(f, "---------------------------\n\n");
fprintf(f, "GLEW version %s\n", glewGetString(GLEW_VERSION));
#if defined(GLEW_EGL)
#elif defined(GLEW_OSMESA)
#if defined(GLEW_OSMESA)
#elif defined(GLEW_EGL)
#elif defined(_WIN32)
fprintf(f, "Reporting capabilities of pixelformat %d\n", params.pixelformat);
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
@ -82,8 +82,8 @@ int main (int argc, char** argv)
glGetString(GL_RENDERER), glGetString(GL_VENDOR));
fprintf(f, "OpenGL version %s is supported\n", glGetString(GL_VERSION));
glewInfo();
#if defined(GLEW_EGL)
#elif defined(GLEW_OSMESA)
#if defined(GLEW_OSMESA)
#elif defined(GLEW_EGL)
#elif defined(_WIN32)
wglewInfo();
#else
@ -122,8 +122,8 @@ GLboolean glewParseArgs (int argc, char** argv, struct createParams *params)
else return GL_TRUE;
++p;
}
#if defined(GLEW_EGL)
#elif defined(GLEW_OSMESA)
#if defined(GLEW_OSMESA)
#elif defined(GLEW_EGL)
#elif defined(_WIN32)
else if (!strcmp(argv[p], "-pf") || !strcmp(argv[p], "-pixelformat"))
{

View File

@ -0,0 +1,4 @@
include config/Makefile.linux
LDFLAGS.GL = -lEGL -lGL
CFLAGS.EXTRA += -DGLEW_EGL

View File

@ -37,6 +37,8 @@
#if defined(GLEW_OSMESA)
#define GLAPI extern
#include <GL/osmesa.h>
#elif defined(GLEW_EGL)
#include <GL/eglew.h>
#elif defined(_WIN32)
#include <GL/wglew.h>
#elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX)
@ -62,6 +64,8 @@ typedef struct GLContextStruct
{
#if defined(GLEW_OSMESA)
OSMesaContext ctx;
#elif defined(GLEW_EGL)
EGLContext ctx;
#elif defined(_WIN32)
HWND wnd;
HDC dc;
@ -186,6 +190,7 @@ main (int argc, char** argv)
/* ---------------------------------------------------------------------- */
/* extensions string */
#if defined(GLEW_OSMESA)
#elif defined(GLEW_EGL)
#elif defined(_WIN32)
/* WGL extensions */
if (WGLEW_ARB_extensions_string || WGLEW_EXT_extensions_string)
@ -264,7 +269,7 @@ void PrintExtensions (const char* s)
/* ---------------------------------------------------------------------- */
#if defined(GLEW_OSMESA)
#if defined(GLEW_OSMESA) || defined(GLEW_EGL)
void
VisualInfo (GLContext* ctx)
@ -1048,6 +1053,27 @@ void DestroyContext (GLContext* ctx)
if (NULL == ctx) return;
if (NULL != ctx->ctx) OSMesaDestroyContext(ctx->ctx);
}
/* ------------------------------------------------------------------------ */
#elif defined(GLEW_EGL)
void InitContext (GLContext* ctx)
{
ctx->ctx = NULL;
}
GLboolean CreateContext (GLContext* ctx)
{
return GL_FALSE;
}
void DestroyContext (GLContext* ctx)
{
if (NULL == ctx) return;
return;
}
/* ------------------------------------------------------------------------ */
#elif defined(_WIN32)
void InitContext (GLContext* ctx)