mirror of
https://github.com/glfw/glfw.git
synced 2024-11-14 02:31:46 +00:00
Added reporting of extension string retrieval failure.
This commit is contained in:
parent
e4a87b8a1c
commit
97ae40496d
@ -566,7 +566,7 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
|
|||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extension == NULL || *extension == '\0')
|
if (!extension || *extension == '\0')
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_VALUE, NULL);
|
_glfwInputError(GLFW_INVALID_VALUE, NULL);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
@ -577,12 +577,16 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
|
|||||||
// Check if extension is in the old style OpenGL extensions string
|
// Check if extension is in the old style OpenGL extensions string
|
||||||
|
|
||||||
extensions = glGetString(GL_EXTENSIONS);
|
extensions = glGetString(GL_EXTENSIONS);
|
||||||
if (extensions != NULL)
|
if (!extensions)
|
||||||
{
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Failed to retrieve extension string");
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (_glfwStringInExtensionString(extension, extensions))
|
if (_glfwStringInExtensionString(extension, extensions))
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#if defined(_GLFW_USE_OPENGL)
|
#if defined(_GLFW_USE_OPENGL)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -596,13 +600,17 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
|
|||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
const char* en = (const char*) window->GetStringi(GL_EXTENSIONS, i);
|
const char* en = (const char*) window->GetStringi(GL_EXTENSIONS, i);
|
||||||
if (en != NULL)
|
if (!en)
|
||||||
{
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Failed to retrieve extension string %i", i);
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (strcmp(en, extension) == 0)
|
if (strcmp(en, extension) == 0)
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif // _GLFW_USE_OPENGL
|
#endif // _GLFW_USE_OPENGL
|
||||||
|
|
||||||
// Check if extension is in the platform-specific string
|
// Check if extension is in the platform-specific string
|
||||||
|
Loading…
Reference in New Issue
Block a user