Backend: OpenGL3: Amend b0c18166 fix cases where glGetString(GL_VERSION) returns NULL. (#6154, #4445, #3530)

This commit is contained in:
ocornut 2023-03-15 12:25:34 +01:00
parent 24a44b9abe
commit 0d606968d8
3 changed files with 5 additions and 3 deletions

View File

@ -14,6 +14,7 @@
// CHANGELOG // CHANGELOG
// (minor and older changes stripped away, please see git history for details) // (minor and older changes stripped away, please see git history for details)
// 2023-03-15: OpenGL: Fixed GL loader crash when GL_VERSION returns NULL. (#6154, #4445, #3530)
// 2023-03-06: OpenGL: Fixed restoration of a potentially deleted OpenGL program, by calling glIsProgram(). (#6220, #6224) // 2023-03-06: OpenGL: Fixed restoration of a potentially deleted OpenGL program, by calling glIsProgram(). (#6220, #6224)
// 2022-11-09: OpenGL: Reverted use of glBufferSubData(), too many corruptions issues + old issues seemingly can't be reproed with Intel drivers nowadays (revert 2021-12-15 and 2022-05-23 changes). // 2022-11-09: OpenGL: Reverted use of glBufferSubData(), too many corruptions issues + old issues seemingly can't be reproed with Intel drivers nowadays (revert 2021-12-15 and 2022-05-23 changes).
// 2022-10-11: Using 'nullptr' instead of 'NULL' as per our switch to C++11. // 2022-10-11: Using 'nullptr' instead of 'NULL' as per our switch to C++11.

View File

@ -118,7 +118,7 @@ extern "C" {
** included as <GL/glcorearb.h>. ** included as <GL/glcorearb.h>.
** **
** glcorearb.h includes only APIs in the latest OpenGL core profile ** glcorearb.h includes only APIs in the latest OpenGL core profile
** implementation together with APIs in newer ARB extensions which ** implementation together with APIs in newer ARB extensions which
** can be supported by the core profile. It does not, and never will ** can be supported by the core profile. It does not, and never will
** include functionality removed from the core profile, such as ** include functionality removed from the core profile, such as
** fixed-function vertex and fragment processing. ** fixed-function vertex and fragment processing.
@ -692,8 +692,8 @@ static int parse_version(void)
if (version.major == 0 && version.minor == 0) if (version.major == 0 && version.minor == 0)
{ {
// Query GL_VERSION in desktop GL 2.x, the string will start with "<major>.<minor>" // Query GL_VERSION in desktop GL 2.x, the string will start with "<major>.<minor>"
const char* gl_version = (const char*)glGetString(GL_VERSION); if (const char* gl_version = (const char*)glGetString(GL_VERSION))
sscanf(gl_version, "%d.%d", &version.major, &version.minor); sscanf(gl_version, "%d.%d", &version.major, &version.minor);
} }
if (version.major < 2) if (version.major < 2)
return GL3W_ERROR_OPENGL_VERSION; return GL3W_ERROR_OPENGL_VERSION;

View File

@ -39,6 +39,7 @@ Breaking Changes:
Other changes: Other changes:
- Backends: OpenGL3: Fixed GL loader crash when GL_VERSION returns NULL. (#6154, #4445, #3530)
----------------------------------------------------------------------- -----------------------------------------------------------------------