| 39 | } s_lastGlfwError; |
| 40 | |
| 41 | WindowSplash::WindowSplash() : m_window(nullptr) { |
| 42 | RequestAddInitTask::subscribe([this](const std::string& name, bool async, const TaskFunction &function){ |
| 43 | std::lock_guard guard(m_progressMutex); |
| 44 | |
| 45 | m_tasks.push_back(Task{ name, function, async, false }); |
| 46 | m_totalTaskCount += 1; |
| 47 | m_progress = float(m_completedTaskCount) / float(m_totalTaskCount); |
| 48 | }); |
| 49 | |
| 50 | if (const auto env = hex::getEnvironmentVariable("IMHEX_SKIP_SPLASH_SCREEN"); env.has_value() && !env.value().empty() && env.value() != "0") { |
| 51 | // Create a dummy ImGui context so plugins can initialize properly |
| 52 | ImGui::CreateContext(); |
| 53 | return; |
| 54 | } |
| 55 | |
| 56 | this->initGLFW(); |
| 57 | this->initImGui(); |
| 58 | this->loadAssets(); |
| 59 | |
| 60 | { |
| 61 | auto glVendorString = reinterpret_cast<const char *>(glGetString(GL_VENDOR)); |
| 62 | auto glRendererString = reinterpret_cast<const char *>(glGetString(GL_RENDERER)); |
| 63 | auto glVersionString = reinterpret_cast<const char *>(glGetString(GL_VERSION)); |
| 64 | auto glShadingLanguageVersion = reinterpret_cast<const char *>(glGetString(GL_SHADING_LANGUAGE_VERSION)); |
| 65 | |
| 66 | log::debug("OpenGL Vendor: '{}'", glVendorString); |
| 67 | log::debug("OpenGL Renderer: '{}'", glRendererString); |
| 68 | log::debug("OpenGL Version String: '{}'", glVersionString); |
| 69 | log::debug("OpenGL Shading Language Version: '{}'", glShadingLanguageVersion); |
| 70 | |
| 71 | ImHexApi::System::impl::setGPUVendor(glVendorString); |
| 72 | ImHexApi::System::impl::setGLRenderer(glRendererString); |
| 73 | |
| 74 | { |
| 75 | int glVersionMajor = 0, glVersionMinor = 0; |
| 76 | glGetIntegerv(GL_MAJOR_VERSION, &glVersionMajor); |
| 77 | glGetIntegerv(GL_MINOR_VERSION, &glVersionMinor); |
| 78 | log::debug("OpenGL Version: v{}.{}", glVersionMajor, glVersionMinor); |
| 79 | ImHexApi::System::impl::setGLVersion(SemanticVersion(glVersionMajor, glVersionMinor, 0)); |
| 80 | } |
| 81 | |
| 82 | { |
| 83 | #if defined(OS_MACOS) |
| 84 | const static auto MinGLVersion = SemanticVersion(3, 2, 0); |
| 85 | #elif defined(OS_WEB) |
| 86 | const static auto MinGLVersion = SemanticVersion(3, 0, 0); |
| 87 | #else |
| 88 | const static auto MinGLVersion = SemanticVersion(3, 1, 0); |
| 89 | #endif |
| 90 | |
| 91 | const auto &glVersion = ImHexApi::System::getGLVersion(); |
| 92 | if (glVersion < MinGLVersion) { |
| 93 | showErrorMessageBox(fmt::format("ImHex requires at least OpenGL {} to run but your system seems to only support up to OpenGL {}!\n\nTry upgrading your GPU drivers or try one of the NoGPU releases to use software rendering instead.", MinGLVersion.get(false), glVersion.get())); |
| 94 | this->exitImGui(); |
| 95 | this->exitGLFW(); |
| 96 | std::exit(EXIT_FAILURE); |
| 97 | } |
| 98 | } |