mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-10 07:49:57 -04:00
OpenGL: Attempt to fix rare crashing on Windows for GPU drivers that return NULL from wglGetProcAddress for core OpenGL functions
This commit is contained in:
parent
762660d7c6
commit
2c59a9ebf7
@ -652,7 +652,14 @@ void GLContext_Free(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void* GLContext_GetAddress(const char* function) {
|
void* GLContext_GetAddress(const char* function) {
|
||||||
|
static const cc_string glPath = String_FromConst("OPENGL32.dll");
|
||||||
|
static void* lib;
|
||||||
void* addr = (void*)wglGetProcAddress(function);
|
void* addr = (void*)wglGetProcAddress(function);
|
||||||
|
if (!GLContext_IsInvalidAddress(addr)) return addr;
|
||||||
|
|
||||||
|
/* Some drivers return NULL from wglGetProcAddress for core OpenGL functions */
|
||||||
|
if (!lib) lib = DynamicLib_Load2(&glPath);
|
||||||
|
addr = DynamicLib_Get2(lib, function);
|
||||||
return GLContext_IsInvalidAddress(addr) ? NULL : addr;
|
return GLContext_IsInvalidAddress(addr) ? NULL : addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user