From 08d7eaff186ade0512a7fc91e1c89c60f68f0258 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Tue, 4 Oct 2022 01:40:13 +1000 Subject: [PATCH] GL/Context: Use GL_OES_draw_elements_base_vertex if GLES3.2 is missing --- src/common/gl/context.cpp | 8 ++++++++ src/frontend-common/imgui_impl_opengl3.cpp | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/src/common/gl/context.cpp b/src/common/gl/context.cpp index 33f480159..34d1c91a9 100644 --- a/src/common/gl/context.cpp +++ b/src/common/gl/context.cpp @@ -77,6 +77,14 @@ static void DisableBrokenExtensions(const char* gl_vendor, const char* gl_render GLAD_GL_EXT_disjoint_timer_query = 0; } } + + // If we're missing GLES 3.2, but have OES_draw_elements_base_vertex, redirect the function pointers. + if (!glad_glDrawElementsBaseVertex && GLAD_GL_OES_draw_elements_base_vertex && !GLAD_GL_ES_VERSION_3_2) + { + glad_glDrawElementsBaseVertex = glad_glDrawElementsBaseVertexOES; + glad_glDrawRangeElementsBaseVertex = glad_glDrawRangeElementsBaseVertexOES; + glad_glDrawElementsInstancedBaseVertex = glad_glDrawElementsInstancedBaseVertexOES; + } } Context::Context(const WindowInfo& wi) : m_wi(wi) {} diff --git a/src/frontend-common/imgui_impl_opengl3.cpp b/src/frontend-common/imgui_impl_opengl3.cpp index 888782a42..6385e40fa 100644 --- a/src/frontend-common/imgui_impl_opengl3.cpp +++ b/src/frontend-common/imgui_impl_opengl3.cpp @@ -106,6 +106,8 @@ // GL includes #include "common/gl/loader.h" #include "common/gl/texture.h" +#include "common/log.h" +Log_SetChannel(ImGui_ImplOpenGL3); // OpenGL Data struct ImGui_ImplOpenGL3_Data @@ -168,6 +170,13 @@ bool ImGui_ImplOpenGL3_Init(const char* glsl_version) IM_ASSERT((int)strlen(glsl_version) + 2 < IM_ARRAYSIZE(bd->GlslVersionString)); strcpy(bd->GlslVersionString, glsl_version); strcat(bd->GlslVersionString, "\n"); + + if (!glDrawElementsBaseVertex) + { + Log_ErrorPrintf("Missing glDrawElementsBaseVertex()"); + return false; + } + return ImGui_ImplOpenGL3_CreateDeviceObjects(); }