Fix GL extensions listing.

This commit is contained in:
Roz K 2022-09-19 02:25:52 +02:00
parent eb15d04f2c
commit 1855778fa7
Signed by: roz
GPG Key ID: 51FBF4E483E1C822

View File

@ -161,14 +161,14 @@ rk_window_t rk_create_context(
XStoreName(rk_display, rk_window, name);
XMapWindow(rk_display, rk_window);
char const * const glxExts = glXQueryExtensionsString(rk_display, DefaultScreen(rk_display));
char const * const glx_exts = glXQueryExtensionsString(rk_display, DefaultScreen(rk_display));
glXCreateContextAttribsARBProc const glXCreateContextAttribsARB =
reinterpret_cast<glXCreateContextAttribsARBProc>(
glXGetProcAddressARB(reinterpret_cast<const GLubyte *>("glXCreateContextAttribsARB")));
rk_error_occured = false;
int (*oldHandler)(Display *, XErrorEvent *) = XSetErrorHandler(&rk_error_handler);
if (!rk_extension_supported(glxExts, "GLX_ARB_create_context") || !glXCreateContextAttribsARB) {
if (!rk_extension_supported(glx_exts, "GLX_ARB_create_context") || !glXCreateContextAttribsARB) {
rk_printf("glXCreateContextAttribsARB() extension not found.");
rk_destroy_context();
return nullptr;
@ -188,13 +188,14 @@ rk_window_t rk_create_context(
}
glXMakeCurrent(rk_display, rk_window, rk_context);
if (rk_extension_supported(glxExts, "GL_EXT_base_instance")) {
char const * const gl_exts = reinterpret_cast<char const *>(glGetString(GL_EXTENSIONS));
if (rk_extension_supported(gl_exts, "GL_EXT_base_instance")) {
rk_DrawElementsInstancedBaseInstance =
reinterpret_cast<PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC>(
glXGetProcAddressARB(reinterpret_cast<const GLubyte *>("DrawElementsInstancedBaseInstance")));
if (rk_DrawElementsInstancedBaseInstance) {
rk_printf("Using extension GL_EXT_base_instance::DrawElementsInstancedBaseInstance.");
if (rk_extension_supported(glxExts, "GL_EXT_multi_draw_indirect")) {
if (rk_extension_supported(gl_exts, "GL_EXT_multi_draw_indirect")) {
rk_MultiDrawElementsIndirect =
reinterpret_cast<PFNGLMULTIDRAWELEMENTSINDIRECTPROC>(
glXGetProcAddressARB(reinterpret_cast<const GLubyte *>("MultiDrawElementsIndirectEXT")));