Check GLEW functions exist before calling them
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6235
This commit is contained in:
parent
33385d0bb0
commit
fe415c4134
|
@ -67,6 +67,7 @@ CACHED_CONTAINER_GPU::~CACHED_CONTAINER_GPU()
|
||||||
if( m_isMapped )
|
if( m_isMapped )
|
||||||
Unmap();
|
Unmap();
|
||||||
|
|
||||||
|
if( glDeleteBuffers )
|
||||||
glDeleteBuffers( 1, &m_glBufferHandle );
|
glDeleteBuffers( 1, &m_glBufferHandle );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,6 +76,10 @@ void CACHED_CONTAINER_GPU::Map()
|
||||||
{
|
{
|
||||||
wxCHECK( !IsMapped(), /*void*/ );
|
wxCHECK( !IsMapped(), /*void*/ );
|
||||||
|
|
||||||
|
// OpenGL version might suddenly stop being available in Windows when an RDP session is started
|
||||||
|
if( !glBindBuffer )
|
||||||
|
throw std::runtime_error( "OpenGL no longer available!" );
|
||||||
|
|
||||||
glBindBuffer( GL_ARRAY_BUFFER, m_glBufferHandle );
|
glBindBuffer( GL_ARRAY_BUFFER, m_glBufferHandle );
|
||||||
m_vertices = static_cast<VERTEX*>( glMapBuffer( GL_ARRAY_BUFFER, GL_READ_WRITE ) );
|
m_vertices = static_cast<VERTEX*>( glMapBuffer( GL_ARRAY_BUFFER, GL_READ_WRITE ) );
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,9 @@ CACHED_CONTAINER_RAM::CACHED_CONTAINER_RAM( unsigned int aSize ) :
|
||||||
|
|
||||||
CACHED_CONTAINER_RAM::~CACHED_CONTAINER_RAM()
|
CACHED_CONTAINER_RAM::~CACHED_CONTAINER_RAM()
|
||||||
{
|
{
|
||||||
|
if( glDeleteBuffers )
|
||||||
glDeleteBuffers( 1, &m_verticesBuffer );
|
glDeleteBuffers( 1, &m_verticesBuffer );
|
||||||
|
|
||||||
free( m_vertices );
|
free( m_vertices );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,10 @@ GPU_CACHED_MANAGER::~GPU_CACHED_MANAGER()
|
||||||
{
|
{
|
||||||
if( m_buffersInitialized )
|
if( m_buffersInitialized )
|
||||||
{
|
{
|
||||||
|
if( glBindBuffer )
|
||||||
glBindBuffer( GL_ARRAY_BUFFER, 0 );
|
glBindBuffer( GL_ARRAY_BUFFER, 0 );
|
||||||
|
|
||||||
|
if( glDeleteBuffers )
|
||||||
glDeleteBuffers( 1, &m_indicesBuffer );
|
glDeleteBuffers( 1, &m_indicesBuffer );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -400,7 +400,10 @@ void OPENGL_COMPOSITOR::clean()
|
||||||
|
|
||||||
m_buffers.clear();
|
m_buffers.clear();
|
||||||
|
|
||||||
|
if( glDeleteFramebuffersEXT )
|
||||||
glDeleteFramebuffersEXT( 1, &m_mainFbo );
|
glDeleteFramebuffersEXT( 1, &m_mainFbo );
|
||||||
|
|
||||||
|
if( glDeleteRenderbuffersEXT )
|
||||||
glDeleteRenderbuffersEXT( 1, &m_depthBuffer );
|
glDeleteRenderbuffersEXT( 1, &m_depthBuffer );
|
||||||
|
|
||||||
m_initialized = false;
|
m_initialized = false;
|
||||||
|
|
|
@ -58,10 +58,12 @@ SHADER::~SHADER()
|
||||||
Deactivate();
|
Deactivate();
|
||||||
|
|
||||||
if( isProgramCreated )
|
if( isProgramCreated )
|
||||||
|
{
|
||||||
|
if( glIsShader )
|
||||||
{
|
{
|
||||||
// Delete the shaders and the program
|
// Delete the shaders and the program
|
||||||
for( std::deque<GLuint>::iterator it = shaderNumbers.begin();
|
for( std::deque<GLuint>::iterator it = shaderNumbers.begin(); it != shaderNumbers.end();
|
||||||
it != shaderNumbers.end(); ++it )
|
++it )
|
||||||
{
|
{
|
||||||
GLuint shader = *it;
|
GLuint shader = *it;
|
||||||
|
|
||||||
|
@ -75,6 +77,7 @@ SHADER::~SHADER()
|
||||||
glDeleteProgram( programNumber );
|
glDeleteProgram( programNumber );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool SHADER::LoadShaderFromFile( SHADER_TYPE aShaderType, const std::string& aShaderSourceName )
|
bool SHADER::LoadShaderFromFile( SHADER_TYPE aShaderType, const std::string& aShaderSourceName )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue