Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
5235d7e5
Commit
5235d7e5
authored
Nov 11, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modified error handling for OpenGL backend, now error messages should be visible.
parent
73ca1ed7
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
109 additions
and
60 deletions
+109
-60
drawpanel_gal.cpp
common/drawpanel_gal.cpp
+20
-10
cached_container.cpp
common/gal/opengl/cached_container.cpp
+4
-3
gpu_manager.cpp
common/gal/opengl/gpu_manager.cpp
+6
-3
opengl_compositor.cpp
common/gal/opengl/opengl_compositor.cpp
+15
-14
opengl_gal.cpp
common/gal/opengl/opengl_gal.cpp
+24
-11
shader.cpp
common/gal/opengl/shader.cpp
+5
-3
vertex_manager.cpp
common/gal/opengl/vertex_manager.cpp
+3
-2
tool_manager.cpp
common/tool/tool_manager.cpp
+4
-4
class_drawpanel_gal.h
include/class_drawpanel_gal.h
+26
-9
move_tool.cpp
pcbnew/tools/move_tool.cpp
+2
-1
No files found.
common/drawpanel_gal.cpp
View file @
5235d7e5
...
...
@@ -93,7 +93,10 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
Connect
(
KIGFX
::
WX_VIEW_CONTROLS
::
EVT_REFRESH_MOUSE
,
wxEventHandler
(
EDA_DRAW_PANEL_GAL
::
onEvent
),
NULL
,
this
);
// Set up timer that prevents too frequent redraw commands
m_refreshTimer
.
SetOwner
(
this
);
m_pendingRefresh
=
false
;
m_drawing
=
false
;
Connect
(
wxEVT_TIMER
,
wxTimerEventHandler
(
EDA_DRAW_PANEL_GAL
::
onRefreshTimer
),
NULL
,
this
);
this
->
SetFocus
();
...
...
@@ -121,6 +124,10 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
m_pendingRefresh
=
false
;
m_lastRefresh
=
wxGetLocalTimeMillis
();
if
(
!
m_drawing
)
{
m_drawing
=
true
;
m_gal
->
BeginDrawing
();
m_gal
->
SetBackgroundColor
(
KIGFX
::
COLOR4D
(
0.0
,
0.0
,
0.0
,
1.0
)
);
m_gal
->
ClearScreen
();
...
...
@@ -133,6 +140,9 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
m_gal
->
DrawCursor
(
m_viewControls
->
GetCursorPosition
()
);
m_gal
->
EndDrawing
();
m_drawing
=
false
;
}
}
...
...
common/gal/opengl/cached_container.cpp
View file @
5235d7e5
...
...
@@ -33,6 +33,7 @@
#include <gal/opengl/vertex_manager.h>
#include <gal/opengl/vertex_item.h>
#include <gal/opengl/shader.h>
#include <confirm.h>
#include <wx/log.h>
#include <list>
#ifdef __WXDEBUG__
...
...
@@ -315,7 +316,7 @@ bool CACHED_CONTAINER::defragment( VERTEX* aTarget )
if
(
aTarget
==
NULL
)
{
wxLogError
(
wxT
(
"Run out of memory"
)
);
DisplayError
(
NULL
,
wxT
(
"Run out of memory"
)
);
return
false
;
}
}
...
...
@@ -439,7 +440,7 @@ bool CACHED_CONTAINER::resizeContainer( unsigned int aNewSize )
if
(
newContainer
==
NULL
)
{
wxLogError
(
wxT
(
"Run out of memory"
)
);
DisplayError
(
NULL
,
wxT
(
"Run out of memory"
)
);
return
false
;
}
...
...
@@ -458,7 +459,7 @@ bool CACHED_CONTAINER::resizeContainer( unsigned int aNewSize )
if
(
newContainer
==
NULL
)
{
wxLogError
(
wxT
(
"Run out of memory"
)
);
DisplayError
(
NULL
,
wxT
(
"Run out of memory"
)
);
return
false
;
}
...
...
common/gal/opengl/gpu_manager.cpp
View file @
5235d7e5
...
...
@@ -32,9 +32,12 @@
#include <gal/opengl/noncached_container.h>
#include <gal/opengl/shader.h>
#include <typeinfo>
#include <wx/log.h>
#include <wx/msgdlg.h>
#include <confirm.h>
#ifdef __WXDEBUG__
#include <profile.h>
#include <wx/debug.h>
#include <wx/log.h>
#endif
using
namespace
KIGFX
;
...
...
@@ -70,7 +73,7 @@ void GPU_MANAGER::SetShader( SHADER& aShader )
if
(
m_shaderAttrib
==
-
1
)
{
wxLogFatalError
(
wxT
(
"Could not get the shader attribute location"
)
);
DisplayError
(
NULL
,
wxT
(
"Could not get the shader attribute location"
)
);
}
}
...
...
@@ -205,7 +208,7 @@ void GPU_CACHED_MANAGER::uploadToGpu()
if
(
glGetError
()
!=
GL_NO_ERROR
)
{
wxLogError
(
wxT
(
"Error during data upload to the GPU memory"
)
);
DisplayError
(
NULL
,
wxT
(
"Error during data upload to the GPU memory"
)
);
}
#ifdef __WXDEBUG__
...
...
common/gal/opengl/opengl_compositor.cpp
View file @
5235d7e5
...
...
@@ -29,7 +29,8 @@
*/
#include <gal/opengl/opengl_compositor.h>
#include <wx/log.h>
#include <wx/msgdlg.h>
#include <confirm.h>
using
namespace
KIGFX
;
...
...
@@ -97,8 +98,8 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer()
if
(
usedBuffers
()
>=
m_maxBuffers
)
{
wxLogError
(
wxT
(
"Cannot create more framebuffers. OpenGL rendering backend requires at
"
"
least 3 framebuffers. You may try to update/change "
DisplayError
(
NULL
,
wxT
(
"Cannot create more framebuffers. OpenGL rendering
"
"backend requires at
least 3 framebuffers. You may try to update/change "
"your graphic drivers."
)
);
return
0
;
// Unfortunately we have no more free buffers left
}
...
...
@@ -131,38 +132,38 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer()
switch
(
status
)
{
case
GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT
:
wxLogFatalError
(
wxT
(
"Cannot create the framebuffer."
)
);
DisplayError
(
NULL
,
wxT
(
"Cannot create the framebuffer."
)
);
break
;
case
GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT
:
wxLogFatalError
(
wxT
(
"The framebuffer attachment points are incomplete."
)
);
DisplayError
(
NULL
,
wxT
(
"The framebuffer attachment points are incomplete."
)
);
break
;
case
GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT
:
wxLogFatalError
(
wxT
(
"The framebuffer does not have at least "
DisplayError
(
NULL
,
wxT
(
"The framebuffer does not have at least "
"one image attached to it."
)
);
break
;
case
GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT
:
wxLogFatalError
(
wxT
(
"The framebuffer read buffer is incomplete."
)
);
DisplayError
(
NULL
,
wxT
(
"The framebuffer read buffer is incomplete."
)
);
break
;
case
GL_FRAMEBUFFER_UNSUPPORTED_EXT
:
wxLogFatalError
(
wxT
(
"The combination of internal formats of the attached images "
DisplayError
(
NULL
,
wxT
(
"The combination of internal formats of the attached images "
"violates an implementation-dependent set of restrictions."
)
);
break
;
case
GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT
:
wxLogFatalError
(
wxT
(
"GL_RENDERBUFFER_SAMPLES is not the same "
DisplayError
(
NULL
,
wxT
(
"GL_RENDERBUFFER_SAMPLES is not the same "
"for all attached renderbuffers"
)
);
break
;
case
GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT
:
wxLogFatalError
(
wxT
(
"Framebuffer incomplete layer targets errors."
)
);
DisplayError
(
NULL
,
wxT
(
"Framebuffer incomplete layer targets errors."
)
);
break
;
default
:
wxLogFatalError
(
wxT
(
"Cannot create the framebuffer."
)
);
DisplayError
(
NULL
,
wxT
(
"Cannot create the framebuffer."
)
);
break
;
}
...
...
@@ -223,7 +224,7 @@ void OPENGL_COMPOSITOR::DrawBuffer( unsigned int aBufferHandle )
if
(
aBufferHandle
==
0
||
aBufferHandle
>
usedBuffers
()
)
{
wxLogError
(
wxT
(
"Wrong framebuffer handle"
)
);
DisplayError
(
NULL
,
wxT
(
"Wrong framebuffer handle"
)
);
return
;
}
...
...
common/gal/opengl/opengl_gal.cpp
View file @
5235d7e5
...
...
@@ -31,6 +31,7 @@
#include <wx/log.h>
#include <macros.h>
#include <confirm.h>
#ifdef __WXDEBUG__
#include <profile.h>
#endif
/* __WXDEBUG__ */
...
...
@@ -93,7 +94,8 @@ OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
if
(
tesselator
==
NULL
)
{
wxLogFatalError
(
wxT
(
"Could not create the tesselator"
)
);
DisplayError
(
parentWindow
,
wxT
(
"Could not create the tesselator"
)
);
exit
(
1
);
}
gluTessProperty
(
tesselator
,
GLU_TESS_WINDING_RULE
,
GLU_TESS_WINDING_POSITIVE
);
...
...
@@ -144,13 +146,22 @@ void OPENGL_GAL::BeginDrawing()
if
(
!
isShaderInitialized
)
{
if
(
!
shader
.
LoadBuiltinShader
(
0
,
SHADER_TYPE_VERTEX
)
)
wxLogFatalError
(
wxT
(
"Cannot compile vertex shader!"
)
);
{
DisplayError
(
parentWindow
,
wxT
(
"Cannot compile vertex shader!"
)
);
exit
(
1
);
}
if
(
!
shader
.
LoadBuiltinShader
(
1
,
SHADER_TYPE_FRAGMENT
)
)
wxLogFatalError
(
wxT
(
"Cannot compile fragment shader!"
)
);
{
DisplayError
(
parentWindow
,
wxT
(
"Cannot compile fragment shader!"
)
);
exit
(
1
);
}
if
(
!
shader
.
Link
()
)
wxLogFatalError
(
wxT
(
"Cannot link the shaders!"
)
);
{
DisplayError
(
parentWindow
,
wxT
(
"Cannot link the shaders!"
)
);
exit
(
1
);
}
// Make VBOs use shaders
cachedManager
.
SetShader
(
shader
);
...
...
@@ -915,7 +926,7 @@ void OPENGL_GAL::initGlew()
if
(
GLEW_OK
!=
err
)
{
wxLogError
(
wxString
::
FromUTF8
(
(
char
*
)
glewGetErrorString
(
err
)
)
);
DisplayError
(
parentWindow
,
wxString
::
FromUTF8
(
(
char
*
)
glewGetErrorString
(
err
)
)
);
exit
(
1
);
}
else
...
...
@@ -931,21 +942,21 @@ void OPENGL_GAL::initGlew()
}
else
{
wxLogError
(
wxT
(
"OpenGL Version 2.1 is not supported!"
)
);
DisplayError
(
parentWindow
,
wxT
(
"OpenGL Version 2.1 is not supported!"
)
);
exit
(
1
);
}
// Framebuffers have to be supported
if
(
!
GLEW_EXT_framebuffer_object
)
{
wxLogError
(
wxT
(
"Framebuffer objects are not supported!"
)
);
DisplayError
(
parentWindow
,
wxT
(
"Framebuffer objects are not supported!"
)
);
exit
(
1
);
}
// Vertex buffer have to be supported
if
(
!
GLEW_ARB_vertex_buffer_object
)
{
wxLogError
(
wxT
(
"Vertex buffer objects are not supported!"
)
);
DisplayError
(
parentWindow
,
wxT
(
"Vertex buffer objects are not supported!"
)
);
exit
(
1
);
}
...
...
@@ -1040,10 +1051,12 @@ void CALLBACK EdgeCallback( GLboolean aEdgeFlag )
void
CALLBACK
ErrorCallback
(
GLenum
aErrorCode
)
{
const
GLubyte
*
estring
;
const
GLubyte
*
eString
=
gluErrorString
(
aErrorCode
);
DisplayError
(
NULL
,
wxString
(
std
::
string
(
"Tessellation error: "
)
+
std
::
string
(
(
const
char
*
)(
eString
)
)
)
);
estring
=
gluErrorString
(
aErrorCode
);
wxLogError
(
wxT
(
"Tessellation Error: %s"
),
(
char
*
)
estring
);
exit
(
1
);
}
...
...
common/gal/opengl/shader.cpp
View file @
5235d7e5
...
...
@@ -30,6 +30,8 @@
#include <fstream>
#include <wx/log.h>
#include <wx/gdicmn.h>
#include <confirm.h>
#include <gal/opengl/shader.h>
#include "shader_src.h"
...
...
@@ -201,7 +203,7 @@ std::string SHADER::readSource( std::string aShaderSourceName )
if
(
!
inputFile
)
{
wxLogError
(
wxString
::
FromUTF8
(
"Can't read the shader source: "
)
+
DisplayError
(
NULL
,
wxString
::
FromUTF8
(
"Can't read the shader source: "
)
+
wxString
(
aShaderSourceName
.
c_str
(),
wxConvUTF8
)
);
exit
(
1
);
}
...
...
@@ -223,7 +225,7 @@ bool SHADER::addSource( const std::string& aShaderSource, SHADER_TYPE aShaderTyp
{
if
(
isShaderLinked
)
{
wxLog
Error
(
wxString
::
FromUTF8
(
"Shader is already linked!"
)
);
wxLog
Debug
(
wxT
(
"Shader is already linked!"
)
);
}
// Create the program
...
...
@@ -259,7 +261,7 @@ bool SHADER::addSource( const std::string& aShaderSource, SHADER_TYPE aShaderTyp
if
(
status
!=
GL_TRUE
)
{
wxLogError
(
wxT
(
"Shader compilation error"
)
);
DisplayError
(
NULL
,
wxT
(
"Shader compilation error"
)
);
shaderInfo
(
shaderNumber
);
...
...
common/gal/opengl/vertex_manager.cpp
View file @
5235d7e5
...
...
@@ -33,6 +33,7 @@
#include <gal/opengl/noncached_container.h>
#include <gal/opengl/gpu_manager.h>
#include <gal/opengl/vertex_item.h>
#include <confirm.h>
using
namespace
KIGFX
;
...
...
@@ -55,7 +56,7 @@ void VERTEX_MANAGER::Vertex( GLfloat aX, GLfloat aY, GLfloat aZ ) const
if
(
newVertex
==
NULL
)
{
wxLogError
(
wxT
(
"Vertex allocation error"
)
);
DisplayError
(
NULL
,
wxT
(
"Vertex allocation error"
)
);
return
;
}
...
...
@@ -70,7 +71,7 @@ void VERTEX_MANAGER::Vertices( const VERTEX aVertices[], unsigned int aSize ) co
if
(
newVertex
==
NULL
)
{
wxLogError
(
wxT
(
"Vertex allocation error"
)
);
DisplayError
(
NULL
,
wxT
(
"Vertex allocation error"
)
);
return
;
}
...
...
common/tool/tool_manager.cpp
View file @
5235d7e5
...
...
@@ -43,6 +43,7 @@
#include <tool/action_manager.h>
#include <wxPcbStruct.h>
#include <confirm.h>
#include <class_drawpanel_gal.h>
using
boost
::
optional
;
...
...
@@ -136,11 +137,10 @@ void TOOL_MANAGER::RegisterTool( TOOL_BASE* aTool )
if
(
aTool
->
GetType
()
==
INTERACTIVE
)
{
bool
initState
=
static_cast
<
TOOL_INTERACTIVE
*>
(
aTool
)
->
Init
();
if
(
!
initState
)
if
(
!
static_cast
<
TOOL_INTERACTIVE
*>
(
aTool
)
->
Init
()
)
{
wxLogError
(
wxT
(
"Initialization of the %s tool failed"
),
aTool
->
GetName
().
c_str
()
);
DisplayError
(
NULL
,
wxString
(
std
::
string
(
"Initialization of the %s tool failed"
)
+
aTool
->
GetName
()
)
);
// Unregister the tool
m_toolState
.
erase
(
aTool
);
...
...
include/class_drawpanel_gal.h
View file @
5235d7e5
...
...
@@ -121,18 +121,35 @@ protected:
static
const
int
MinRefreshPeriod
=
17
;
///< 60 FPS.
wxLongLong
m_lastRefresh
;
///< Last time the panel was refreshed
///< Last timestamp when the panel was refreshed
wxLongLong
m_lastRefresh
;
///< Is there a redraw event requested?
bool
m_pendingRefresh
;
///< True if GAL is currently redrawing the view
bool
m_drawing
;
///< Timer responsible for preventing too frequent refresh
wxTimer
m_refreshTimer
;
KIGFX
::
GAL
*
m_gal
;
///< Interface for drawing objects on a 2D-surface
KIGFX
::
VIEW
*
m_view
;
///< Stores view settings (scale, center, etc.)
///< and items to be drawn
KIGFX
::
PAINTER
*
m_painter
;
///< Contains information about how to draw items
///< using GAL
KIGFX
::
WX_VIEW_CONTROLS
*
m_viewControls
;
///< Control for VIEW (moving, zooming, etc.)
GalType
m_currentGal
;
///< Currently used GAL
TOOL_DISPATCHER
*
m_eventDispatcher
;
///< Processes and forwards events to tools
///< Interface for drawing objects on a 2D-surface
KIGFX
::
GAL
*
m_gal
;
///< Stores view settings (scale, center, etc.) and items to be drawn
KIGFX
::
VIEW
*
m_view
;
///< Contains information about how to draw items using GAL
KIGFX
::
PAINTER
*
m_painter
;
///< Control for VIEW (moving, zooming, etc.)
KIGFX
::
WX_VIEW_CONTROLS
*
m_viewControls
;
///< Currently used GAL
GalType
m_currentGal
;
///< Processes and forwards events to tools
TOOL_DISPATCHER
*
m_eventDispatcher
;
};
#endif
pcbnew/tools/move_tool.cpp
View file @
5235d7e5
...
...
@@ -26,6 +26,7 @@
#include <class_module.h>
#include <tool/tool_manager.h>
#include <view/view_controls.h>
#include <confirm.h>
#include "common_actions.h"
#include "selection_tool.h"
...
...
@@ -68,7 +69,7 @@ bool MOVE_TOOL::Init()
}
else
{
wxLogError
(
wxT
(
"pcbnew.InteractiveSelection tool is not available"
)
);
DisplayError
(
NULL
,
wxT
(
"pcbnew.InteractiveSelection tool is not available"
)
);
return
false
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment