EGL refinements and fixes

This commit is contained in:
Nigel Stewart 2016-01-23 21:32:55 +10:00
parent 6d8e930ab1
commit e826500b5f
7 changed files with 37 additions and 18 deletions

View File

@ -300,6 +300,8 @@ $(S.DEST)/glewinfo.c: $(EXT)/.dummy
$(BIN)/make_info.pl $(GL_CORE_SPEC) >> $@ $(BIN)/make_info.pl $(GL_CORE_SPEC) >> $@
$(BIN)/make_info.pl $(GL_EXT_SPEC) >> $@ $(BIN)/make_info.pl $(GL_EXT_SPEC) >> $@
echo -e "#if defined(GLEW_EGL)\n" >> $@ echo -e "#if defined(GLEW_EGL)\n" >> $@
$(BIN)/make_info.pl $(EGL_CORE_SPEC) >> $@
$(BIN)/make_info.pl $(EGL_EXT_SPEC) >> $@
echo -e "#elif _WIN32\n" >> $@ echo -e "#elif _WIN32\n" >> $@
$(BIN)/make_info.pl $(WGL_EXT_SPEC) >> $@ $(BIN)/make_info.pl $(WGL_EXT_SPEC) >> $@
echo -e "#else /* _UNIX */\n" >> $@ echo -e "#else /* _UNIX */\n" >> $@

View File

@ -24,11 +24,11 @@ if (@ARGV)
{ {
my ($extname, $exturl, $extstring, $reuse, $types, $tokens, $functions, $exacts) = parse_ext($ext); my ($extname, $exturl, $extstring, $reuse, $types, $tokens, $functions, $exacts) = parse_ext($ext);
my $exttype = $extname; my $exttype = $extname;
$exttype =~ s/(W*?)GL(X*?)_(.*?_)(.*)/$3/; $exttype =~ s/(W?E?)GL(X?)_(.*?_)(.*)/$3/;
my $extrem = $extname; my $extrem = $extname;
$extrem =~ s/(W*?)GL(X*?)_(.*?_)(.*)/$4/; $extrem =~ s/(W?E?)GL(X?)_(.*?_)(.*)/$4/;
my $extvar = $extname; my $extvar = $extname;
$extvar =~ s/(W*)GL(X*)_/$1GL$2EW_/; $extvar =~ s/(W?E?)GL(X?)_/$1GL$2EW_/;
if(!($exttype =~ $curexttype)) if(!($exttype =~ $curexttype))
{ {
if(length($curexttype) > 0) if(length($curexttype) > 0)

View File

@ -66,6 +66,8 @@ typedef khronos_utime_nanoseconds_t EGLuint64NV;
struct EGLClientPixmapHI; struct EGLClientPixmapHI;
#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0)
EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress (const char *procname); EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress (const char *procname);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -5,27 +5,42 @@ GLboolean eglewGetExtension (const char* name)
const GLubyte* start; const GLubyte* start;
const GLubyte* end; const GLubyte* end;
/* TODO */ start = (const GLubyte*) eglQueryString(eglGetDisplay(EGL_DEFAULT_DISPLAY), EGL_EXTENSIONS);
/* return _glewSearchExtension(name, start, end); */ if (0 == start) return GL_FALSE;
return GL_FALSE; end = start + _glewStrLen(start);
return _glewSearchExtension(name, start, end);
} }
GLenum eglewInit () GLenum eglewInit ()
{ {
int major, minor; GLuint dot;
GLint major, minor;
const GLubyte* version;
const GLubyte* extStart; const GLubyte* extStart;
const GLubyte* extEnd; const GLubyte* extEnd;
/* initialize flags */ /* query EGK version */
EGLEW_VERSION_1_0 = GL_TRUE; major = 0;
EGLEW_VERSION_1_1 = GL_TRUE; minor = 0;
EGLEW_VERSION_1_2 = GL_TRUE; version = (const GLubyte*) eglQueryString(eglGetDisplay(EGL_DEFAULT_DISPLAY), EGL_VERSION);
EGLEW_VERSION_1_3 = GL_TRUE; dot = _glewStrCLen(version, '.');
EGLEW_VERSION_1_4 = GL_TRUE; if (dot != 0)
EGLEW_VERSION_1_5 = GL_TRUE; {
major = version[dot-1]-'0';
minor = version[dot+1]-'0';
}
/* query EGL version */ EGLEW_VERSION_1_5 = ( major > 1 ) || ( major == 1 && minor >= 5 ) ? GL_TRUE : GL_FALSE;
EGLEW_VERSION_1_4 = EGLEW_VERSION_1_5 == GL_TRUE || ( major == 1 && minor >= 4 ) ? GL_TRUE : GL_FALSE;
EGLEW_VERSION_1_3 = EGLEW_VERSION_1_4 == GL_TRUE || ( major == 1 && minor >= 3 ) ? GL_TRUE : GL_FALSE;
EGLEW_VERSION_1_2 = EGLEW_VERSION_1_3 == GL_TRUE || ( major == 1 && minor >= 2 ) ? GL_TRUE : GL_FALSE;
EGLEW_VERSION_1_1 = EGLEW_VERSION_1_2 == GL_TRUE || ( major == 1 && minor >= 1 ) ? GL_TRUE : GL_FALSE;
EGLEW_VERSION_1_0 = EGLEW_VERSION_1_1 == GL_TRUE || ( major == 1 && minor >= 0 ) ? GL_TRUE : GL_FALSE;
/* query EGL extension string */ /* query EGL extension string */
extStart = (const GLubyte*) eglQueryString(eglGetDisplay(EGL_DEFAULT_DISPLAY), EGL_EXTENSIONS);
if (extStart == 0)
extStart = (const GLubyte *)"";
extEnd = extStart + _glewStrLen(extStart);
/* initialize extensions */ /* initialize extensions */

View File

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

View File

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

View File

@ -3,7 +3,7 @@
#include <string.h> #include <string.h>
#include <GL/glew.h> #include <GL/glew.h>
#if defined(GLEW_EGL) #if defined(GLEW_EGL)
#include <EGL/egl.h> #include <GL/eglew.h>
#elif defined(GLEW_OSMESA) #elif defined(GLEW_OSMESA)
#define GLAPI extern #define GLAPI extern
#include <GL/osmesa.h> #include <GL/osmesa.h>