GL/Context: Use GL_OES_draw_elements_base_vertex if GLES3.2 is missing

This commit is contained in:
Connor McLaughlin 2022-10-04 01:40:13 +10:00
parent 2231af2dfc
commit 564a9bdeb4
2 changed files with 17 additions and 0 deletions

View File

@ -77,6 +77,14 @@ static void DisableBrokenExtensions(const char* gl_vendor, const char* gl_render
GLAD_GL_EXT_disjoint_timer_query = 0; 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) {} Context::Context(const WindowInfo& wi) : m_wi(wi) {}

View File

@ -106,6 +106,8 @@
// GL includes // GL includes
#include "common/gl/loader.h" #include "common/gl/loader.h"
#include "common/gl/texture.h" #include "common/gl/texture.h"
#include "common/log.h"
Log_SetChannel(ImGui_ImplOpenGL3);
// OpenGL Data // OpenGL Data
struct ImGui_ImplOpenGL3_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)); IM_ASSERT((int)strlen(glsl_version) + 2 < IM_ARRAYSIZE(bd->GlslVersionString));
strcpy(bd->GlslVersionString, glsl_version); strcpy(bd->GlslVersionString, glsl_version);
strcat(bd->GlslVersionString, "\n"); strcat(bd->GlslVersionString, "\n");
if (!glDrawElementsBaseVertex)
{
Log_ErrorPrintf("Missing glDrawElementsBaseVertex()");
return false;
}
return ImGui_ImplOpenGL3_CreateDeviceObjects(); return ImGui_ImplOpenGL3_CreateDeviceObjects();
} }