Added some debug output to help finding the reason of crash at startup on Mac OS

This commit is contained in:
enricoturri1966 2022-07-01 09:21:41 +02:00
parent 4b6d2a58b0
commit a10495f132
5 changed files with 23 additions and 10 deletions

View file

@ -192,6 +192,10 @@ int CLI::run(int argc, char **argv)
m_actions.erase(it);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
std::cout << "CLI::run(): required OpenGL version: " << opengl_version.first << "." << opengl_version.second << "\n";
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#if ENABLE_OPENGL_DEBUG_OPTION
it = std::find(m_actions.begin(), m_actions.end(), "opengl-debug");
if (it != m_actions.end()) {

View file

@ -847,6 +847,11 @@ std::string GUI_App::get_gl_info(bool for_github)
wxGLContext* GUI_App::init_glcontext(wxGLCanvas& canvas)
{
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
if (init_params != nullptr)
std::cout << "GUI_App::init_glcontext(): required OpenGL version: " << init_params->opengl_version.first << "." << init_params->opengl_version.second << "\n";
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#if ENABLE_GL_CORE_PROFILE
#if ENABLE_OPENGL_DEBUG_OPTION
return m_opengl_mgr.init_glcontext(canvas, init_params != nullptr ? init_params->opengl_version : std::make_pair(0, 0),

View file

@ -54,6 +54,10 @@ int GUI_Run(GUI_InitParams &params)
GUI::GUI_App::SetInstance(gui);
gui->init_params = &params;
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
std::cout << "GUI_Run(): required OpenGL version: " << gui->init_params->opengl_version.first << "." << gui->init_params->opengl_version.second << "\n";
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
return wxEntry(params.argc, params.argv);
} catch (const Slic3r::Exception &ex) {
boost::nowide::cerr << ex.what() << std::endl;

View file

@ -420,21 +420,24 @@ wxGLContext* OpenGLManager::init_glcontext(wxGLCanvas& canvas)
m_debug_enabled = enable_debug;
#endif // ENABLE_OPENGL_DEBUG_OPTION
if (required_opengl_version != std::make_pair(0, 0)) { // the user specified a required version in the command line using --opengl=M.m
m_required_version = required_opengl_version;
const bool supports_core_profile = (m_required_version.first < 3) ? false :
(m_required_version.first > 3) ? true : m_required_version.second >= 2;
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
std::cout << "OpenGLManager::init_glcontext(): required OpenGL version: " << required_opengl_version.first << "." << required_opengl_version.second << "\n";
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
if (required_opengl_version != std::make_pair(0, 0)) { // the user specified a required version in the command line using --opengl-core=M.m
const bool supports_core_profile = (required_opengl_version.first < 3) ? false :
(required_opengl_version.first > 3) ? true : required_opengl_version.second >= 2;
if (supports_core_profile) {
// disable wxWidgets logging to avoid showing the log dialog in case the following code fails generating a valid gl context
wxLogNull logNo;
wxGLContextAttrs attrs;
#if ENABLE_OPENGL_DEBUG_OPTION
attrs.MajorVersion(m_required_version.first).MinorVersion(m_required_version.second).CoreProfile().ForwardCompatible();
attrs.MajorVersion(required_opengl_version.first).MinorVersion(required_opengl_version.second).CoreProfile().ForwardCompatible();
if (m_debug_enabled)
attrs.DebugCtx();
attrs.EndList();
#else
attrs.MajorVersion(m_required_version.first).MinorVersion(m_required_version.second).CoreProfile().ForwardCompatible().EndList();
attrs.MajorVersion(required_opengl_version.first).MinorVersion(required_opengl_version.second).CoreProfile().ForwardCompatible().EndList();
#endif // ENABLE_OPENGL_DEBUG_OPTION
m_context = new wxGLContext(&canvas, nullptr, &attrs);
if (!m_context->IsOK()) {
@ -446,7 +449,7 @@ wxGLContext* OpenGLManager::init_glcontext(wxGLCanvas& canvas)
}
//else {
// // try to get the highest supported OpenGL version with core profile
// static const std::vector<std::pair<int, int>> valid_core_versions = { {4,6}, {4,5}, {4,4}, {4,3}, {4,2}, {4,1}, {4,0}, {3,3} };
// static const std::vector<std::pair<int, int>> valid_core_versions = { {4,6}, {4,5}, {4,4}, {4,3}, {4,2}, {4,1}, {4,0}, {3,3}, {3,2} };
// // disable wxWidgets logging to avoid showing the log dialog in case the following code fails generating a valid gl context
// wxLogNull logNo;
// for (const auto& [major, minor] : valid_core_versions) {

View file

@ -84,12 +84,9 @@ private:
bool m_gl_initialized{ false };
wxGLContext* m_context{ nullptr };
#if ENABLE_GL_CORE_PROFILE
std::pair<int, int> m_required_version{ 0, 0 };
#if ENABLE_OPENGL_DEBUG_OPTION
bool m_debug_enabled{ false };
#endif // ENABLE_OPENGL_DEBUG_OPTION
#endif // ENABLE_GL_CORE_PROFILE
GLShadersManager m_shaders_manager;
static GLInfo s_gl_info;
#ifdef __APPLE__