diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 66641a7f5..8c031bcaa 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -3117,6 +3117,13 @@ CLIMiscConfigDef::CLIMiscConfigDef() def->label = L("Logging level"); def->tooltip = L("Messages with severity lower or eqal to the loglevel will be printed out. 0:trace, 1:debug, 2:info, 3:warning, 4:error, 5:fatal"); def->min = 0; + +#ifdef _MSC_VER + def = this->add("sw_renderer", coBool); + def->label = L("Render with a software renderer"); + def->tooltip = L("Render with a software renderer. The bundled MESA software renderer is loaded instead of the default OpenGL driver."); + def->min = 0; +#endif /* _MSC_VER */ } const CLIActionsConfigDef cli_actions_config_def; diff --git a/src/slic3r_app_msvc.cpp b/src/slic3r_app_msvc.cpp index 380d30cf4..e2c6013a2 100644 --- a/src/slic3r_app_msvc.cpp +++ b/src/slic3r_app_msvc.cpp @@ -207,12 +207,20 @@ int wmain(int argc, wchar_t **argv) std::vector argv_extended; argv_extended.emplace_back(argv[0]); // Here one may push some additional parameters based on the wrapper type. - for (int i = 1; i < argc; ++ i) + bool force_mesa = false; + for (int i = 1; i < argc; ++ i) { + if (wcscmp(argv[i], L"--sw-renderer") == 0) + force_mesa = true; + else if (wcscmp(argv[i], L"--no-sw-renderer") == 0) + force_mesa = false; argv_extended.emplace_back(argv[i]); + } argv_extended.emplace_back(nullptr); OpenGLVersionCheck opengl_version_check; bool load_mesa = + // Forced from the command line. + force_mesa || // Running over a rempote desktop, and the RemoteFX is not enabled, therefore Windows will only provide SW OpenGL 1.1 context. // In that case, use Mesa. ::GetSystemMetrics(SM_REMOTESESSION) || @@ -267,5 +275,5 @@ int wmain(int argc, wchar_t **argv) return -1; } // argc minus the trailing nullptr of the argv - return slic3r_main(argv_extended.size() - 1, argv_extended.data()); + return slic3r_main((int)argv_extended.size() - 1, argv_extended.data()); }