mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 13:11:33 +00:00
Restored legacy way to collect OpenGL extensions
This commit is contained in:
parent
6c5109ec99
commit
9b91a13487
1 changed files with 52 additions and 4 deletions
|
@ -2447,11 +2447,49 @@ static void LoadExtByName(const char *extensionName)
|
|||
}
|
||||
}
|
||||
|
||||
/* BEGINNING OF MANUAL CHANGES, DO NOT REMOVE! */
|
||||
|
||||
static void ProcExtsFromExtList(void)
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
static int ProcExtsFromExtList(void)
|
||||
{
|
||||
GLint iLoop;
|
||||
GLint iNumExtensions = 0;
|
||||
|
||||
if (_ptrc_glGetStringi == NULL) return 0;
|
||||
|
||||
_ptrc_glGetIntegerv(GL_NUM_EXTENSIONS, &iNumExtensions);
|
||||
|
||||
for(iLoop = 0; iLoop < iNumExtensions; iLoop++)
|
||||
|
@ -2459,6 +2497,8 @@ static void ProcExtsFromExtList(void)
|
|||
const char *strExtensionName = (const char *)_ptrc_glGetStringi(GL_EXTENSIONS, iLoop);
|
||||
LoadExtByName(strExtensionName);
|
||||
}
|
||||
|
||||
return iNumExtensions;
|
||||
}
|
||||
|
||||
int ogl_LoadFunctions()
|
||||
|
@ -2469,9 +2509,15 @@ int ogl_LoadFunctions()
|
|||
_ptrc_glGetIntegerv = (void (CODEGEN_FUNCPTR *)(GLenum, GLint *))IntGetProcAddress("glGetIntegerv");
|
||||
if(!_ptrc_glGetIntegerv) return ogl_LOAD_FAILED;
|
||||
_ptrc_glGetStringi = (const GLubyte * (CODEGEN_FUNCPTR *)(GLenum, GLuint))IntGetProcAddress("glGetStringi");
|
||||
if(!_ptrc_glGetStringi) return ogl_LOAD_FAILED;
|
||||
|
||||
ProcExtsFromExtList();
|
||||
|
||||
if (0 == ProcExtsFromExtList())
|
||||
{
|
||||
_ptrc_glGetString = (const GLubyte * (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glGetString");
|
||||
if (!_ptrc_glGetString) return ogl_LOAD_FAILED;
|
||||
|
||||
ProcExtsFromExtString((const char *)_ptrc_glGetString(GL_EXTENSIONS));
|
||||
}
|
||||
|
||||
numFailed = Load_Version_3_3();
|
||||
|
||||
if(numFailed == 0)
|
||||
|
@ -2480,6 +2526,8 @@ int ogl_LoadFunctions()
|
|||
return ogl_LOAD_SUCCEEDED + numFailed;
|
||||
}
|
||||
|
||||
/* END OF MANUAL CHANGES, DO NOT REMOVE! */
|
||||
|
||||
static int g_major_version = 0;
|
||||
static int g_minor_version = 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue