diff --git a/lib/libimhex/source/ui/imgui_imhex_extensions.cpp b/lib/libimhex/source/ui/imgui_imhex_extensions.cpp index 7ea6a2efc..84dfcac04 100644 --- a/lib/libimhex/source/ui/imgui_imhex_extensions.cpp +++ b/lib/libimhex/source/ui/imgui_imhex_extensions.cpp @@ -31,17 +31,29 @@ namespace ImGuiExt { namespace { bool isOpenGLExtensionSupported(const char *name) { - GLint extensionCount = 0; - glGetIntegerv(GL_NUM_EXTENSIONS, &extensionCount); + static std::set extensions; - for (GLint i = 0; i < extensionCount; i++) { - std::string_view extension = reinterpret_cast(glGetStringi(GL_EXTENSIONS, i)); - if (extension == name) { - return true; + if (extensions.empty()) { + GLint extensionCount = 0; + glGetIntegerv(GL_NUM_EXTENSIONS, &extensionCount); + + for (GLint i = 0; i < extensionCount; i++) { + std::string extension = reinterpret_cast(glGetStringi(GL_EXTENSIONS, i)); + extensions.emplace(std::move(extension)); } } - return false; + return extensions.contains(name); + } + + bool isOpenGLVersionAtLeast(u8 major, u8 minor) { + static GLint actualMajor = 0, actualMinor = 0; + if (actualMajor == 0 || actualMinor == 0) { + glGetIntegerv(GL_MAJOR_VERSION, &actualMajor); + glGetIntegerv(GL_MINOR_VERSION, &actualMinor); + } + + return actualMajor > major || (actualMajor == major && actualMinor >= minor); } constexpr auto getGLFilter(Texture::Filter filter) { @@ -80,8 +92,13 @@ namespace ImGuiExt { // Create a regular texture from the RGBA8 array GLuint texture = createTextureFromRGBA8Array(buffer, width, height, filter); - if (filter == Texture::Filter::Nearest) + if (filter == Texture::Filter::Nearest) { return texture; + } + + if (!isOpenGLVersionAtLeast(3,2)) { + return texture; + } if (!isOpenGLExtensionSupported("GL_ARB_texture_multisample")) { return texture; diff --git a/main/gui/source/init/splash_window.cpp b/main/gui/source/init/splash_window.cpp index 217b7f51d..68e8c0824 100644 --- a/main/gui/source/init/splash_window.cpp +++ b/main/gui/source/init/splash_window.cpp @@ -44,7 +44,19 @@ namespace hex::init { this->initImGui(); this->loadAssets(); - ImHexApi::System::impl::setGPUVendor(reinterpret_cast(glGetString(GL_VENDOR))); + { + auto glVendor = reinterpret_cast(glGetString(GL_VENDOR)); + auto glRenderer = reinterpret_cast(glGetString(GL_RENDERER)); + auto glVersion = reinterpret_cast(glGetString(GL_VERSION)); + auto glShadingLanguageVersion = reinterpret_cast(glGetString(GL_SHADING_LANGUAGE_VERSION)); + + log::debug("OpenGL Vendor: '{}'", glVendor); + log::debug("OpenGL Renderer: '{}'", glRenderer); + log::debug("OpenGL Version: '{}'", glVersion); + log::debug("OpenGL Shading Language Version: '{}'", glShadingLanguageVersion); + + ImHexApi::System::impl::setGPUVendor(glVendor); + } RequestAddInitTask::subscribe([this](const std::string& name, bool async, const TaskFunction &function){ m_tasks.push_back(Task{ name, function, async }); @@ -527,8 +539,7 @@ namespace hex::init { // If the image couldn't be loaded correctly, something went wrong during the build process // Close the application since this would lead to errors later on anyway. if (!this->splashBackgroundTexture.isValid() || !this->splashTextTexture.isValid()) { - log::fatal("Could not load splash screen image!"); - std::exit(EXIT_FAILURE); + log::error("Could not load splash screen image!"); } std::mt19937 rng(std::random_device{}());