From 687b56e73da56b6ac3361daa6c9a707ab6459cce Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Tue, 3 Dec 2013 11:50:20 +0100 Subject: [PATCH] RenderListener::workEndEvent now includes a flag on whether the work unit was finished successfully --- doc/python.tex | 2 +- include/mitsuba/render/renderqueue.h | 4 ++-- src/integrators/bdpt/bdpt_proc.cpp | 2 +- src/libpython/render.cpp | 4 ++-- src/librender/renderproc.cpp | 2 +- src/librender/renderqueue.cpp | 6 +++--- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/python.tex b/doc/python.tex index e4f32767..d5abec72 100644 --- a/doc/python.tex +++ b/doc/python.tex @@ -601,7 +601,7 @@ class MitsubaRenderBuffer(RenderListener): self.bitmap.drawWorkUnit(wu.getOffset(), wu.getSize(), thr) self._potentially_send_update() - def workEndEvent(self, job, wr): + def workEndEvent(self, job, wr, cancelled): """ Callback: a worker thread finished rendering an image block. Tonemap the associated pixels and store them in 'self.bitmap' """ film = self._get_film_ensure_initialized(job) diff --git a/include/mitsuba/render/renderqueue.h b/include/mitsuba/render/renderqueue.h index 65342eb1..5bd0e4fa 100644 --- a/include/mitsuba/render/renderqueue.h +++ b/include/mitsuba/render/renderqueue.h @@ -36,7 +36,7 @@ public: virtual void workBeginEvent(const RenderJob *job, const RectangularWorkUnit *wu, int worker); /// Called when work has finished in a rectangular image region - virtual void workEndEvent(const RenderJob *job, const ImageBlock *wr); + virtual void workEndEvent(const RenderJob *job, const ImageBlock *wr, bool cancelled); /// Called when work has been canceled in a rectangular image region virtual void workCanceledEvent(const RenderJob *job, const Point2i &offset, @@ -99,7 +99,7 @@ public: /* Event distribution */ void signalWorkBegin(const RenderJob *job, const RectangularWorkUnit *wu, int worker); - void signalWorkEnd(const RenderJob *job, const ImageBlock *block); + void signalWorkEnd(const RenderJob *job, const ImageBlock *block, bool cancelled); void signalWorkCanceled(const RenderJob *job, const Point2i &offset, const Vector2i &size); void signalFinishJob(const RenderJob *job, bool cancelled); void signalRefresh(const RenderJob *job); diff --git a/src/integrators/bdpt/bdpt_proc.cpp b/src/integrators/bdpt/bdpt_proc.cpp index 0ef85c64..bda2f24f 100644 --- a/src/integrators/bdpt/bdpt_proc.cpp +++ b/src/integrators/bdpt/bdpt_proc.cpp @@ -401,7 +401,7 @@ void BDPTProcess::processResult(const WorkResult *wr, bool cancelled) { bool developFilm = m_config.lightImage && (m_parent->isInteractive() && m_refreshTimer->getMilliseconds() > 2000); - m_queue->signalWorkEnd(m_parent, result->getImageBlock()); + m_queue->signalWorkEnd(m_parent, result->getImageBlock(), false); if (developFilm) develop(); diff --git a/src/libpython/render.cpp b/src/libpython/render.cpp index dc11b1e9..5d69c3b0 100644 --- a/src/libpython/render.cpp +++ b/src/libpython/render.cpp @@ -179,10 +179,10 @@ public: } catch (bp::error_already_set &) { check_python_exception(); } } - void workEndEvent(const RenderJob *job, const ImageBlock *wr) { + void workEndEvent(const RenderJob *job, const ImageBlock *wr, bool cancelled) { CALLBACK_SYNC_GIL(); try { - bp::call_method(m_self, "workEndEvent", bp::ptr(job), bp::ptr(wr)); + bp::call_method(m_self, "workEndEvent", bp::ptr(job), bp::ptr(wr), cancelled); } catch (bp::error_already_set &) { check_python_exception(); } } diff --git a/src/librender/renderproc.cpp b/src/librender/renderproc.cpp index a76b88bc..acb04a2b 100644 --- a/src/librender/renderproc.cpp +++ b/src/librender/renderproc.cpp @@ -123,7 +123,7 @@ void BlockedRenderProcess::processResult(const WorkResult *result, bool cancelle m_film->put(block); m_progress->update(++m_resultCount); lock.unlock(); - m_queue->signalWorkEnd(m_parent, block); + m_queue->signalWorkEnd(m_parent, block, cancelled); } ParallelProcess::EStatus BlockedRenderProcess::generateWork(WorkUnit *unit, int worker) { diff --git a/src/librender/renderqueue.cpp b/src/librender/renderqueue.cpp index f8d02666..9bc97e1c 100644 --- a/src/librender/renderqueue.cpp +++ b/src/librender/renderqueue.cpp @@ -22,7 +22,7 @@ MTS_NAMESPACE_BEGIN void RenderListener::workBeginEvent(const RenderJob *job, const RectangularWorkUnit *wu, int worker) { } -void RenderListener::workEndEvent(const RenderJob *job, const ImageBlock *wr) { } +void RenderListener::workEndEvent(const RenderJob *job, const ImageBlock *wr, bool cancelled) { } void RenderListener::workCanceledEvent(const RenderJob *job, const Point2i &offset, const Vector2i &size) { } void RenderListener::refreshEvent(const RenderJob *job) { } void RenderListener::finishJobEvent(const RenderJob *job, bool cancelled) { } @@ -119,10 +119,10 @@ void RenderQueue::signalWorkBegin(const RenderJob *job, const RectangularWorkUni m_listeners[i]->workBeginEvent(job, wu, worker); } -void RenderQueue::signalWorkEnd(const RenderJob *job, const ImageBlock *wr) { +void RenderQueue::signalWorkEnd(const RenderJob *job, const ImageBlock *wr, bool cancelled) { LockGuard lock(m_mutex); for (size_t i=0; iworkEndEvent(job, wr); + m_listeners[i]->workEndEvent(job, wr, cancelled); } void RenderQueue::signalWorkCanceled(const RenderJob *job, const Point2i &offset, const Vector2i &size) {