Browse Source

Updated glLoadGen-generated files.

The loader now doesn't attempt to check for extensions and just loads the
function pointers. It was doing that for all core functions anyway, so a
few more DSA functions won't hurt the loading times too much. Should fix
issues with core-only contexts on OSX.
pull/34/head
Vladimír Vondruš 13 years ago
parent
commit
b9161482bc
  1. 62
      external/OpenGL/GL/gl_magnum.c

62
external/OpenGL/GL/gl_magnum.c vendored

@ -2605,19 +2605,6 @@ static ogl_StrToExtMap ExtensionMap[8] = {
static int g_extensionMapSize = 8; static int g_extensionMapSize = 8;
static ogl_StrToExtMap *FindExtEntry(const char *extensionName)
{
int loop;
ogl_StrToExtMap *currLoc = ExtensionMap;
for(loop = 0; loop < g_extensionMapSize; ++loop, ++currLoc)
{
if(strcmp(extensionName, currLoc->extensionName) == 0)
return currLoc;
}
return NULL;
}
static void ClearExtensionVars() static void ClearExtensionVars()
{ {
ogl_ext_AMD_vertex_shader_layer = ogl_LOAD_FAILED; ogl_ext_AMD_vertex_shader_layer = ogl_LOAD_FAILED;
@ -2630,12 +2617,11 @@ static void ClearExtensionVars()
ogl_ext_GREMEDY_string_marker = ogl_LOAD_FAILED; ogl_ext_GREMEDY_string_marker = ogl_LOAD_FAILED;
} }
static void LoadExts()
static void LoadExtByName(const char *extensionName)
{ {
ogl_StrToExtMap *entry = NULL; int loop;
entry = FindExtEntry(extensionName); ogl_StrToExtMap *entry = ExtensionMap;
if(entry) for(loop = 0; loop < g_extensionMapSize; ++loop, ++entry)
{ {
if(entry->LoadExtension) if(entry->LoadExtension)
{ {
@ -2656,50 +2642,12 @@ static void LoadExtByName(const char *extensionName)
} }
} }
static void ProcExtsFromExtString(const char *strExtList)
{
size_t iExtListLen = strlen(strExtList);
const char *strExtListEnd = strExtList + iExtListLen;
const char *strCurrPos = strExtList;
char strWorkBuff[256];
while(*strCurrPos)
{
/*Get the extension at our position.*/
int iStrLen = 0;
const char *strEndStr = strchr(strCurrPos, ' ');
int iStop = 0;
if(strEndStr == NULL)
{
strEndStr = strExtListEnd;
iStop = 1;
}
iStrLen = (int)((ptrdiff_t)strEndStr - (ptrdiff_t)strCurrPos);
if(iStrLen > 255)
return;
strncpy(strWorkBuff, strCurrPos, iStrLen);
strWorkBuff[iStrLen] = '\0';
LoadExtByName(strWorkBuff);
strCurrPos = strEndStr + 1;
if(iStop) break;
}
}
int ogl_LoadFunctions() int ogl_LoadFunctions()
{ {
int numFailed = 0; int numFailed = 0;
ClearExtensionVars(); ClearExtensionVars();
_ptrc_glGetString = (const GLubyte * (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glGetString"); LoadExts();
if(!_ptrc_glGetString) return ogl_LOAD_FAILED;
ProcExtsFromExtString((const char *)_ptrc_glGetString(GL_EXTENSIONS));
numFailed = Load_Version_4_4(); numFailed = Load_Version_4_4();
if(numFailed == 0) if(numFailed == 0)

Loading…
Cancel
Save