mirror of
https://github.com/Perlmint/glew-cmake.git
synced 2024-11-30 10:27:09 +00:00
Generate Sources of origin/master updated at Fri Feb 19 17:44:34 GMT 2016
This commit is contained in:
parent
ae08241886
commit
868558e265
53
src/glew.c
53
src/glew.c
@ -44,8 +44,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stddef.h> /* For size_t */
|
#include <stddef.h> /* For size_t */
|
||||||
#include <stdlib.h> /* For bsearch */
|
|
||||||
#include <string.h> /* For memset */
|
|
||||||
|
|
||||||
#if defined(GLEW_EGL)
|
#if defined(GLEW_EGL)
|
||||||
#elif defined(GLEW_REGAL)
|
#elif defined(GLEW_REGAL)
|
||||||
@ -16697,11 +16695,9 @@ static GLboolean _glewInit_GL_WIN_swap_hint ()
|
|||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static int _glewExtensionCompare(const void *a, const void *b)
|
static int _glewExtensionCompare(const char *s1, const char *s2)
|
||||||
{
|
{
|
||||||
/* http://www.chanduthedev.com/2012/07/strcmp-implementation-in-c.html */
|
/* http://www.chanduthedev.com/2012/07/strcmp-implementation-in-c.html */
|
||||||
const char *s1 = (const char *) a;
|
|
||||||
const char *s2 = *(const char * const *) b;
|
|
||||||
while (*s1 || *s2)
|
while (*s1 || *s2)
|
||||||
{
|
{
|
||||||
if (*s1 > *s2)
|
if (*s1 > *s2)
|
||||||
@ -16714,31 +16710,32 @@ static int _glewExtensionCompare(const void *a, const void *b)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GLboolean *_glewGetExtensionString(const char *name)
|
static ptrdiff_t _glewBsearchExtension(const char* name)
|
||||||
{
|
{
|
||||||
const char **n = (const char **) bsearch(name, _glewExtensionLookup, sizeof(_glewExtensionLookup)/sizeof(char *)-1, sizeof(char *), _glewExtensionCompare);
|
ptrdiff_t lo = 0, hi = sizeof(_glewExtensionLookup) / sizeof(char*) - 2;
|
||||||
ptrdiff_t i;
|
|
||||||
|
|
||||||
if (n)
|
while (lo <= hi)
|
||||||
{
|
{
|
||||||
i = n-_glewExtensionLookup;
|
ptrdiff_t mid = (lo + hi) / 2;
|
||||||
return _glewExtensionString+i;
|
const int cmp = _glewExtensionCompare(name, _glewExtensionLookup[mid]);
|
||||||
|
if (cmp < 0) hi = mid - 1;
|
||||||
|
else if (cmp > 0) lo = mid + 1;
|
||||||
|
else return mid;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GLboolean *_glewGetExtensionString(const char *name)
|
||||||
|
{
|
||||||
|
ptrdiff_t n = _glewBsearchExtension(name);
|
||||||
|
if (n >= 0) return &_glewExtensionString[n];
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GLboolean *_glewGetExtensionEnable(const char *name)
|
static GLboolean *_glewGetExtensionEnable(const char *name)
|
||||||
{
|
{
|
||||||
const char **n = (const char **) bsearch(name, _glewExtensionLookup, sizeof(_glewExtensionLookup)/sizeof(char *)-1, sizeof(char *), _glewExtensionCompare);
|
ptrdiff_t n = _glewBsearchExtension(name);
|
||||||
ptrdiff_t i;
|
if (n >= 0) return _glewExtensionEnabled[n];
|
||||||
|
|
||||||
if (n)
|
|
||||||
{
|
|
||||||
i = n-_glewExtensionLookup;
|
|
||||||
return _glewExtensionEnabled[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16777,6 +16774,7 @@ static GLenum GLEWAPIENTRY glewContextInit ()
|
|||||||
const GLubyte* s;
|
const GLubyte* s;
|
||||||
GLuint dot;
|
GLuint dot;
|
||||||
GLint major, minor;
|
GLint major, minor;
|
||||||
|
size_t n;
|
||||||
|
|
||||||
/* query opengl version */
|
/* query opengl version */
|
||||||
getString = (PFNGLGETSTRINGPROC) glewGetProcAddress((const GLubyte*)"glGetString");
|
getString = (PFNGLGETSTRINGPROC) glewGetProcAddress((const GLubyte*)"glGetString");
|
||||||
@ -16822,7 +16820,8 @@ static GLenum GLEWAPIENTRY glewContextInit ()
|
|||||||
GLEW_VERSION_1_1 = GLEW_VERSION_1_2 == GL_TRUE || ( major == 1 && minor >= 1 ) ? GL_TRUE : GL_FALSE;
|
GLEW_VERSION_1_1 = GLEW_VERSION_1_2 == GL_TRUE || ( major == 1 && minor >= 1 ) ? GL_TRUE : GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(_glewExtensionString,0,sizeof(_glewExtensionString));
|
for (n = 0; n < sizeof(_glewExtensionString) / sizeof(_glewExtensionString[0]); ++n)
|
||||||
|
_glewExtensionString[n] = GL_FALSE;
|
||||||
|
|
||||||
if (GLEW_VERSION_3_0)
|
if (GLEW_VERSION_3_0)
|
||||||
{
|
{
|
||||||
@ -20778,6 +20777,18 @@ GLenum GLEWAPIENTRY glewInit (void)
|
|||||||
return r;
|
return r;
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_WIN32) && defined(GLEW_BUILD) && defined(__GNUC__)
|
||||||
|
/* GCC requires a DLL entry point even without any standard library included. */
|
||||||
|
/* Types extracted from windows.h to avoid polluting the rest of the file. */
|
||||||
|
int __stdcall DllMainCRTStartup(void* instance, unsigned reason, void* reserved)
|
||||||
|
{
|
||||||
|
(void) instance;
|
||||||
|
(void) reason;
|
||||||
|
(void) reserved;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
GLboolean GLEWAPIENTRY glewIsSupported (const char* name)
|
GLboolean GLEWAPIENTRY glewIsSupported (const char* name)
|
||||||
{
|
{
|
||||||
const GLubyte* pos = (const GLubyte*)name;
|
const GLubyte* pos = (const GLubyte*)name;
|
||||||
|
Loading…
Reference in New Issue
Block a user