mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 00:58:30 -05:00
GL: Added different code path when glGetString(GL_EXTENSIONS) returns NULL.
This commit is contained in:
parent
8f5202ca99
commit
011bbfd451
2 changed files with 49 additions and 30 deletions
|
@ -149,6 +149,7 @@ typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUI64VPROC) (GLuint id, G
|
||||||
typedef void (GL_APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
typedef void (GL_APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
||||||
typedef void (GL_APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params);
|
typedef void (GL_APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params);
|
||||||
typedef const GLubyte* (GL_APIENTRYP PFNGLGETSTRINGPROC) (GLenum name);
|
typedef const GLubyte* (GL_APIENTRYP PFNGLGETSTRINGPROC) (GLenum name);
|
||||||
|
typedef const GLubyte* (GL_APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index);
|
||||||
typedef GLint (GL_APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name);
|
typedef GLint (GL_APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name);
|
||||||
typedef void (GL_APIENTRYP PFNGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
|
typedef void (GL_APIENTRYP PFNGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
|
||||||
typedef void (GL_APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program);
|
typedef void (GL_APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program);
|
||||||
|
@ -332,6 +333,7 @@ GL_IMPORT______(true, PFNGLGETQUERYOBJECTUI64VPROC, glGetQueryObj
|
||||||
GL_IMPORT______(false, PFNGLGETSHADERIVPROC, glGetShaderiv);
|
GL_IMPORT______(false, PFNGLGETSHADERIVPROC, glGetShaderiv);
|
||||||
GL_IMPORT______(false, PFNGLGETSHADERINFOLOGPROC, glGetShaderInfoLog);
|
GL_IMPORT______(false, PFNGLGETSHADERINFOLOGPROC, glGetShaderInfoLog);
|
||||||
GL_IMPORT______(false, PFNGLGETSTRINGPROC, glGetString);
|
GL_IMPORT______(false, PFNGLGETSTRINGPROC, glGetString);
|
||||||
|
GL_IMPORT______(true, PFNGLGETSTRINGIPROC, glGetStringi);
|
||||||
GL_IMPORT______(false, PFNGLGETUNIFORMLOCATIONPROC, glGetUniformLocation);
|
GL_IMPORT______(false, PFNGLGETUNIFORMLOCATIONPROC, glGetUniformLocation);
|
||||||
#if BGFX_CONFIG_RENDERER_OPENGL || !(BGFX_CONFIG_RENDERER_OPENGLES < 30)
|
#if BGFX_CONFIG_RENDERER_OPENGL || !(BGFX_CONFIG_RENDERER_OPENGLES < 30)
|
||||||
GL_IMPORT______(true, PFNGLINVALIDATEFRAMEBUFFERPROC, glInvalidateFramebuffer);
|
GL_IMPORT______(true, PFNGLINVALIDATEFRAMEBUFFERPROC, glInvalidateFramebuffer);
|
||||||
|
|
|
@ -1209,6 +1209,34 @@ namespace bgfx { namespace gl
|
||||||
_minFilter = s_textureFilterMin[min][_hasMips ? mip+1 : 0];
|
_minFilter = s_textureFilterMin[min][_hasMips ? mip+1 : 0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void updateExtension(const char* _name)
|
||||||
|
{
|
||||||
|
bool supported = false;
|
||||||
|
for (uint32_t ii = 0; ii < Extension::Count; ++ii)
|
||||||
|
{
|
||||||
|
Extension& extension = s_extension[ii];
|
||||||
|
if (!extension.m_supported
|
||||||
|
&& extension.m_initialize)
|
||||||
|
{
|
||||||
|
const char* ext = _name;
|
||||||
|
if (0 == strncmp(ext, "GL_", 3) ) // skip GL_
|
||||||
|
{
|
||||||
|
ext += 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 == strcmp(ext, extension.m_name) )
|
||||||
|
{
|
||||||
|
extension.m_supported = true;
|
||||||
|
supported = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BX_TRACE("GL_EXTENSION %3d%s: %s", index, supported ? " (supported)" : "", _name);
|
||||||
|
BX_UNUSED(supported);
|
||||||
|
}
|
||||||
|
|
||||||
struct RendererContextGL : public RendererContextI
|
struct RendererContextGL : public RendererContextI
|
||||||
{
|
{
|
||||||
RendererContextGL()
|
RendererContextGL()
|
||||||
|
@ -1365,42 +1393,31 @@ namespace bgfx { namespace gl
|
||||||
strncpy(name, pos, len);
|
strncpy(name, pos, len);
|
||||||
name[len] = '\0';
|
name[len] = '\0';
|
||||||
|
|
||||||
bool supported = false;
|
updateExtension(name);
|
||||||
for (uint32_t ii = 0; ii < Extension::Count; ++ii)
|
|
||||||
{
|
|
||||||
Extension& extension = s_extension[ii];
|
|
||||||
if (!extension.m_supported
|
|
||||||
&& extension.m_initialize)
|
|
||||||
{
|
|
||||||
const char* ext = name;
|
|
||||||
if (0 == strncmp(ext, "GL_", 3) ) // skip GL_
|
|
||||||
{
|
|
||||||
ext += 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (0 == strcmp(ext, extension.m_name) )
|
|
||||||
{
|
|
||||||
extension.m_supported = true;
|
|
||||||
supported = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BX_TRACE("GL_EXTENSION %3d%s: %s", index, supported ? " (supported)" : "", name);
|
|
||||||
BX_UNUSED(supported);
|
|
||||||
|
|
||||||
pos += len+1;
|
pos += len+1;
|
||||||
++index;
|
++index;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (NULL != glGetStringi)
|
||||||
|
{
|
||||||
|
GLint numExtensions = 0;
|
||||||
|
glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
|
||||||
|
glGetError(); // ignore error if glGetString returns NULL.
|
||||||
|
|
||||||
BX_TRACE("Supported extensions:");
|
for (GLint index = 0; index < numExtensions; ++index)
|
||||||
for (uint32_t ii = 0; ii < Extension::Count; ++ii)
|
|
||||||
{
|
{
|
||||||
if (s_extension[ii].m_supported)
|
const char* name = (const char*)glGetStringi(GL_EXTENSIONS, index);
|
||||||
{
|
updateExtension(name);
|
||||||
BX_TRACE("\t%2d: %s", ii, s_extension[ii].m_name);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BX_TRACE("Supported extensions:");
|
||||||
|
for (uint32_t ii = 0; ii < Extension::Count; ++ii)
|
||||||
|
{
|
||||||
|
if (s_extension[ii].m_supported)
|
||||||
|
{
|
||||||
|
BX_TRACE("\t%2d: %s", ii, s_extension[ii].m_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue