RenderListener::workEndEvent now includes a flag on whether the work unit was finished successfully

metadata
Wenzel Jakob 2013-12-03 11:50:20 +01:00
parent b17916e679
commit 687b56e73d
6 changed files with 10 additions and 10 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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();

View File

@ -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<void>(m_self, "workEndEvent", bp::ptr(job), bp::ptr(wr));
bp::call_method<void>(m_self, "workEndEvent", bp::ptr(job), bp::ptr(wr), cancelled);
} catch (bp::error_already_set &) { check_python_exception(); }
}

View File

@ -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) {

View File

@ -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; i<m_listeners.size(); ++i)
m_listeners[i]->workEndEvent(job, wr);
m_listeners[i]->workEndEvent(job, wr, cancelled);
}
void RenderQueue::signalWorkCanceled(const RenderJob *job, const Point2i &offset, const Vector2i &size) {