Commit d6ad0a15 authored by hrchilds's avatar hrchilds

Update from March 1, 2006

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@627 18c085ea-50e0-402c-830e-de6fd14e8384
parent 47aef661
......@@ -32,6 +32,9 @@ void *avtCallback::updatePlotAttributesCallbackArgs
GetDatabaseCallback avtCallback::getDatabaseCallback = NULL;
void *avtCallback::getDatabaseCallbackArgs = NULL;
bool avtCallback::haveRenderingException = false;
std::string avtCallback::renderingExceptionMessage;
// ****************************************************************************
// Method: avtCallback::RegisterWarningCallback
......
......@@ -56,6 +56,9 @@ typedef ref_ptr<avtDatabase> (*GetDatabaseCallback)(void *,
// Hank Childs, Sat Dec 3 20:27:16 PST 2005
// Added swRendering.
//
// Hank Childs, Tue Feb 28 14:12:16 PST 2006
// Added rendering exceptions.
//
// ****************************************************************************
class PIPELINE_API avtCallback
......@@ -95,6 +98,15 @@ class PIPELINE_API avtCallback
static ref_ptr<avtDatabase> GetDatabase(const std::string &, int,
const char *);
static void ClearRenderingExceptions(void)
{ haveRenderingException = false; };
static void SetRenderingException(const std::string &s)
{ haveRenderingException = true;
renderingExceptionMessage = s; };
static std::string GetRenderingException(void)
{ return (haveRenderingException
? renderingExceptionMessage : ""); };
protected:
static WarningCallback warningCallback;
static void *warningCallbackArgs;
......@@ -114,6 +126,9 @@ class PIPELINE_API avtCallback
static GetDatabaseCallback getDatabaseCallback;
static void *getDatabaseCallbackArgs;
static bool haveRenderingException;
static std::string renderingExceptionMessage;
};
......
......@@ -6,8 +6,13 @@
#include <vtkObjectFactory.h>
#include <vtkRenderer.h>
#include <ColorAttribute.h>
#include <avtCallback.h>
#include <VisItException.h>
// ****************************************************************************
// Method: avtUserDefinedMapper constructor
......@@ -350,6 +355,12 @@ vtkUserDefinedMapperBridge::SetRenderer(avtCustomRenderer_p r)
// Programmer: Hank Childs
// Creation: March 26, 2001
//
// Modifications:
//
// Hank Childs, Wed Mar 1 09:59:45 PST 2006
// Added some exception handling. Not a good idea to let an exception
// be thrown up through VTK's GL code.
//
// ****************************************************************************
void
......@@ -368,7 +379,21 @@ vtkUserDefinedMapperBridge::Render(vtkRenderer *r, vtkActor *)
//
vtkDataSet *input = this->GetInput();
ren->SetVTKRenderer(r);
ren->Execute(input);
TRY
{
ren->Execute(input);
}
CATCH2(VisItException, ve)
{
//
// We do not want to throw an exception here. This call has a bunch
// of VTK/GL code above it and throwing an exception will leave it
// in a very bad state. So, log the exception in avtCallback and let
// the VisWindow look for it after the render is finished.
//
avtCallback::SetRenderingException(ve.Message());
}
ENDTRY
}
......
......@@ -533,6 +533,10 @@ VisWinRendering::EnableUpdates(void)
// Added args to Start/Stop timer to force acquisition of timing information
// even if timings were not enabled on the command-line.
// Added 3 most recent rendering times to set of times returned
//
// Hank Childs, Wed Mar 1 10:05:25 PST 2006
// Look for exceptions that occurred during a Render.
//
// ****************************************************************************
void
......@@ -546,7 +550,15 @@ VisWinRendering::Render()
if (realized)
{
if (mediator.UpdatesEnabled() && !avtCallback::GetNowinMode())
{
avtCallback::ClearRenderingExceptions();
GetRenderWindow()->Render();
std::string errorMsg = avtCallback::GetRenderingException();
if (errorMsg != "")
{
EXCEPTION1(VisItException, errorMsg.c_str());
}
}
else
{
needsUpdate = true;
......@@ -796,6 +808,9 @@ VisWinRendering::GetCaptureRegion(int& r0, int& c0, int& w, int& h,
// this to work even if we are doing two-pass rendering with OpenGL
// (which isn't supported right now anyway).
//
// Hank Childs, Wed Mar 1 11:26:15 PST 2006
// Add some exception handling.
//
// ****************************************************************************
avtImage_p
......@@ -869,6 +884,7 @@ VisWinRendering::ScreenCapture(bool doViewportOnly, bool doCanvasZBufferToo,
//
// Make sure that the window is up-to-date.
//
avtCallback::ClearRenderingExceptions();
if (second_pass)
{
// We can't erase the rgb/z data we just worked
......@@ -883,6 +899,11 @@ VisWinRendering::ScreenCapture(bool doViewportOnly, bool doCanvasZBufferToo,
// so we better darn well allow erasing before drawing.
renWin->Render();
}
std::string errorMsg = avtCallback::GetRenderingException();
if (errorMsg != "")
{
EXCEPTION1(VisItException, errorMsg.c_str());
}
//
// Set region origin/size to be captured
......
......@@ -5870,25 +5870,40 @@ ViewerPlotList::UpdateWindow(bool immediateUpdate)
//
window->SetMergeViewLimits(false);
if (updatesEnabled)
TRY
{
if (immediateUpdate)
{
//
// Enable updates in the window now.
//
window->EnableUpdates();
}
else
if (updatesEnabled)
{
//
// Send a message to the rendering thread to render the window.
//
window->SendUpdateMessage();
if (immediateUpdate)
{
//
// Enable updates in the window now.
//
window->EnableUpdates();
}
else
{
//
// Send a message to the rendering thread to render the window.
//
window->SendUpdateMessage();
}
}
}
CATCH2(VisItException, ve)
{
Error(ve.Message().c_str());
for (int i = 0; i < nPlots; i++)
if (plots[i].plot->IsInRange() &&
plots[i].realized == true && plots[i].hidden == false)
plots[i].plot->SetErrorFlag(true);
window->ClearPlots();
}
ENDTRY
}
// ****************************************************************************
// Method: ViewerPlotList::UpdateColorTable
//
......
......@@ -1157,6 +1157,10 @@ ViewerSubject::DisconnectClient(ViewerClientConnection *client)
// Brad Whitlock, Fri Jul 25 12:24:37 PDT 2003
// Moved most of the code elsewhere.
//
// Hank Childs, Tue Feb 28 11:28:37 PST 2006
// Catch all exceptions and keep executing. This will probably lead to
// crashes in some cases, but the alternative is to just quit.
//
// ****************************************************************************
int
......@@ -1166,17 +1170,32 @@ ViewerSubject::Execute()
// Enter the event processing loop.
//
int retval;
TRY
{
retval = mainApp->exec();
}
CATCH(LostConnectionException)
while (1)
{
cerr << "The component that launched VisIt's viewer has terminated "
"abnormally." << endl;
retval = -1;
TRY
{
retval = mainApp->exec();
}
CATCH(LostConnectionException)
{
cerr << "The component that launched VisIt's viewer has terminated "
"abnormally." << endl;
retval = -1;
}
CATCH2(VisItException, ve)
{
char msg[1024];
sprintf(msg, "VisIt has encountered the following error: %s.\n"
"VisIt will attempt to continue processing, but it may "
"behave unreliably. Please save this error message and "
"give it to a VisIt developer. In addition, you may want"
" to save your session and re-start. Of course, this "
"session may still cause VisIt to malfunction.",
ve.Message().c_str());
Error(msg);
}
ENDTRY
}
ENDTRY
return retval;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment