Add hacks for EGL on Wayland
This commit is contained in:
parent
6ad19b3f45
commit
66922b3bd2
|
@ -2553,7 +2553,9 @@ unsigned int OPENGL_GAL::getNewGroupNumber()
|
||||||
|
|
||||||
void OPENGL_GAL::init()
|
void OPENGL_GAL::init()
|
||||||
{
|
{
|
||||||
|
#ifndef KICAD_USE_EGL
|
||||||
wxASSERT( IsShownOnScreen() );
|
wxASSERT( IsShownOnScreen() );
|
||||||
|
#endif // KICAD_USE_EGL
|
||||||
|
|
||||||
wxASSERT_MSG( m_isContextLocked, "This should only be called from within a locked context." );
|
wxASSERT_MSG( m_isContextLocked, "This should only be called from within a locked context." );
|
||||||
|
|
||||||
|
@ -2562,6 +2564,19 @@ void OPENGL_GAL::init()
|
||||||
throw std::runtime_error( "Could not create the tesselator" );
|
throw std::runtime_error( "Could not create the tesselator" );
|
||||||
GLenum err = glewInit();
|
GLenum err = glewInit();
|
||||||
|
|
||||||
|
#ifdef KICAD_USE_EGL
|
||||||
|
// TODO: better way to check when EGL is ready (init fails at "getString(GL_VERSION)")
|
||||||
|
for( int i = 0; i < 10; i++ )
|
||||||
|
{
|
||||||
|
if( GLEW_OK == err )
|
||||||
|
break;
|
||||||
|
|
||||||
|
std::this_thread::sleep_for( std::chrono::milliseconds( 250 ) );
|
||||||
|
err = glewInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // KICAD_USE_EGL
|
||||||
|
|
||||||
if( GLEW_OK != err )
|
if( GLEW_OK != err )
|
||||||
throw std::runtime_error( (const char*) glewGetErrorString( err ) );
|
throw std::runtime_error( (const char*) glewGetErrorString( err ) );
|
||||||
|
|
||||||
|
|
|
@ -92,8 +92,14 @@ void GL_CONTEXT_MANAGER::LockCtx( wxGLContext* aContext, wxGLCanvas* aCanvas )
|
||||||
|
|
||||||
// Prevent assertion failure in wxGLContext::SetCurrent during GAL teardown
|
// Prevent assertion failure in wxGLContext::SetCurrent during GAL teardown
|
||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
|
|
||||||
|
#ifdef KICAD_USE_EGL
|
||||||
|
if( canvas->GTKGetDrawingWindow() )
|
||||||
|
#else
|
||||||
if( canvas->GetXWindow() )
|
if( canvas->GetXWindow() )
|
||||||
#endif
|
#endif // KICAD_USE_EGL
|
||||||
|
|
||||||
|
#endif // __WXGTK__
|
||||||
{
|
{
|
||||||
canvas->SetCurrent( *aContext );
|
canvas->SetCurrent( *aContext );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue