Detecting platform, namely reading /proc/version to detect Chromium OS.

Disabling Eject on Chromium, detecting removable media the Chromium way.
This commit is contained in:
Vojtech Bubnik 2021-03-11 13:25:13 +01:00
parent 2b19708720
commit ca8cf0a9f1
5 changed files with 40 additions and 25 deletions

View file

@ -4,6 +4,7 @@
#include "GUI.hpp"
#include "I18N.hpp"
#include "3DScene.hpp"
#include "slic3r/Utils/Platform.hpp"
#include <GL/glew.h>
@ -256,13 +257,6 @@ bool OpenGLManager::init_gl()
}
if (valid_version) {
#ifdef __linux__
if (s_gl_info.get_renderer() == "virgl")
// Disable multi-sampling with virgl (VirtualGL) on Linux.
// Namely, on ChromeOS virgl flips red/blue channels at least on some computers with multi-sampling enabled.
// It seems it is sufficient to disable multi-sampling after the OpenGL context is created.
s_multisample = EMultisampleState::Disabled;
#endif // __linux__
// load shaders
auto [result, error] = m_shaders_manager.init();
if (!result) {
@ -326,7 +320,13 @@ void OpenGLManager::detect_multisample(int* attribList)
{
int wxVersion = wxMAJOR_VERSION * 10000 + wxMINOR_VERSION * 100 + wxRELEASE_NUMBER;
bool enable_multisample = wxVersion >= 30003;
s_multisample = (enable_multisample && wxGLCanvas::IsDisplaySupported(attribList)) ? EMultisampleState::Enabled : EMultisampleState::Disabled;
s_multisample =
enable_multisample &&
// Disable multi-sampling on ChromeOS, as the OpenGL virtualization swaps Red/Blue channels with multi-sampling enabled,
// at least on some platforms.
(platform() != Platform::Linux || platform_flavor() != PlatformFlavor::LinuxOnChromium) &&
wxGLCanvas::IsDisplaySupported(attribList)
? EMultisampleState::Enabled : EMultisampleState::Disabled;
// Alternative method: it was working on previous version of wxWidgets but not with the latest, at least on Windows
// s_multisample = enable_multisample && wxGLCanvas::IsExtensionSupported("WGL_ARB_multisample");
}