parent
d7ddf991a9
commit
89f360d1a7
@ -31,17 +31,29 @@ namespace ImGuiExt {
|
||||
namespace {
|
||||
|
||||
bool isOpenGLExtensionSupported(const char *name) {
|
||||
GLint extensionCount = 0;
|
||||
glGetIntegerv(GL_NUM_EXTENSIONS, &extensionCount);
|
||||
static std::set<std::string> extensions;
|
||||
|
||||
for (GLint i = 0; i < extensionCount; i++) {
|
||||
std::string_view extension = reinterpret_cast<const char*>(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<const char*>(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;
|
||||
|
@ -44,7 +44,19 @@ namespace hex::init {
|
||||
this->initImGui();
|
||||
this->loadAssets();
|
||||
|
||||
ImHexApi::System::impl::setGPUVendor(reinterpret_cast<const char *>(glGetString(GL_VENDOR)));
|
||||
{
|
||||
auto glVendor = reinterpret_cast<const char *>(glGetString(GL_VENDOR));
|
||||
auto glRenderer = reinterpret_cast<const char *>(glGetString(GL_RENDERER));
|
||||
auto glVersion = reinterpret_cast<const char *>(glGetString(GL_VERSION));
|
||||
auto glShadingLanguageVersion = reinterpret_cast<const char *>(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{}());
|
||||
|
Loading…
Reference in New Issue
Block a user