From b554c133ea648d8d986dece53ed6b2204cd4ba27 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sat, 21 Nov 2020 18:17:00 +1000 Subject: [PATCH] GPU/OpenGL: Add a version check and display message when unsupported --- src/core/gpu_hw_opengl.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/core/gpu_hw_opengl.cpp b/src/core/gpu_hw_opengl.cpp index 32eefe421..29a7ea493 100644 --- a/src/core/gpu_hw_opengl.cpp +++ b/src/core/gpu_hw_opengl.cpp @@ -41,6 +41,19 @@ bool GPU_HW_OpenGL::Initialize(HostDisplay* host_display) return false; } + const bool opengl_is_available = + ((host_display->GetRenderAPI() == HostDisplay::RenderAPI::OpenGL && + (GLAD_GL_VERSION_3_0 || GLAD_GL_ARB_uniform_buffer_object)) || + (host_display->GetRenderAPI() == HostDisplay::RenderAPI::OpenGLES && GLAD_GL_ES_VERSION_3_0)); + if (!opengl_is_available) + { + g_host_interface->AddOSDMessage( + g_host_interface->TranslateStdString("OSDMessage", "OpenGL renderer unavailable, your driver or hardware is not " + "recent enough. OpenGL 3.1 or OpenGL ES 3.0 is required."), + 20.0f); + return false; + } + SetCapabilities(host_display); if (!GPU_HW::Initialize(host_display))