RenderListener::workEndEvent now includes a flag on whether the work unit was finished successfully
parent
b17916e679
commit
687b56e73d
|
@ -601,7 +601,7 @@ class MitsubaRenderBuffer(RenderListener):
|
||||||
self.bitmap.drawWorkUnit(wu.getOffset(), wu.getSize(), thr)
|
self.bitmap.drawWorkUnit(wu.getOffset(), wu.getSize(), thr)
|
||||||
self._potentially_send_update()
|
self._potentially_send_update()
|
||||||
|
|
||||||
def workEndEvent(self, job, wr):
|
def workEndEvent(self, job, wr, cancelled):
|
||||||
""" Callback: a worker thread finished rendering an image block.
|
""" Callback: a worker thread finished rendering an image block.
|
||||||
Tonemap the associated pixels and store them in 'self.bitmap' """
|
Tonemap the associated pixels and store them in 'self.bitmap' """
|
||||||
film = self._get_film_ensure_initialized(job)
|
film = self._get_film_ensure_initialized(job)
|
||||||
|
|
|
@ -36,7 +36,7 @@ public:
|
||||||
virtual void workBeginEvent(const RenderJob *job, const RectangularWorkUnit *wu, int worker);
|
virtual void workBeginEvent(const RenderJob *job, const RectangularWorkUnit *wu, int worker);
|
||||||
|
|
||||||
/// Called when work has finished in a rectangular image region
|
/// 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
|
/// Called when work has been canceled in a rectangular image region
|
||||||
virtual void workCanceledEvent(const RenderJob *job, const Point2i &offset,
|
virtual void workCanceledEvent(const RenderJob *job, const Point2i &offset,
|
||||||
|
@ -99,7 +99,7 @@ public:
|
||||||
|
|
||||||
/* Event distribution */
|
/* Event distribution */
|
||||||
void signalWorkBegin(const RenderJob *job, const RectangularWorkUnit *wu, int worker);
|
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 signalWorkCanceled(const RenderJob *job, const Point2i &offset, const Vector2i &size);
|
||||||
void signalFinishJob(const RenderJob *job, bool cancelled);
|
void signalFinishJob(const RenderJob *job, bool cancelled);
|
||||||
void signalRefresh(const RenderJob *job);
|
void signalRefresh(const RenderJob *job);
|
||||||
|
|
|
@ -401,7 +401,7 @@ void BDPTProcess::processResult(const WorkResult *wr, bool cancelled) {
|
||||||
bool developFilm = m_config.lightImage &&
|
bool developFilm = m_config.lightImage &&
|
||||||
(m_parent->isInteractive() && m_refreshTimer->getMilliseconds() > 2000);
|
(m_parent->isInteractive() && m_refreshTimer->getMilliseconds() > 2000);
|
||||||
|
|
||||||
m_queue->signalWorkEnd(m_parent, result->getImageBlock());
|
m_queue->signalWorkEnd(m_parent, result->getImageBlock(), false);
|
||||||
|
|
||||||
if (developFilm)
|
if (developFilm)
|
||||||
develop();
|
develop();
|
||||||
|
|
|
@ -179,10 +179,10 @@ public:
|
||||||
} catch (bp::error_already_set &) { check_python_exception(); }
|
} 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();
|
CALLBACK_SYNC_GIL();
|
||||||
try {
|
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(); }
|
} catch (bp::error_already_set &) { check_python_exception(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ void BlockedRenderProcess::processResult(const WorkResult *result, bool cancelle
|
||||||
m_film->put(block);
|
m_film->put(block);
|
||||||
m_progress->update(++m_resultCount);
|
m_progress->update(++m_resultCount);
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
m_queue->signalWorkEnd(m_parent, block);
|
m_queue->signalWorkEnd(m_parent, block, cancelled);
|
||||||
}
|
}
|
||||||
|
|
||||||
ParallelProcess::EStatus BlockedRenderProcess::generateWork(WorkUnit *unit, int worker) {
|
ParallelProcess::EStatus BlockedRenderProcess::generateWork(WorkUnit *unit, int worker) {
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
MTS_NAMESPACE_BEGIN
|
MTS_NAMESPACE_BEGIN
|
||||||
|
|
||||||
void RenderListener::workBeginEvent(const RenderJob *job, const RectangularWorkUnit *wu, int worker) { }
|
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::workCanceledEvent(const RenderJob *job, const Point2i &offset, const Vector2i &size) { }
|
||||||
void RenderListener::refreshEvent(const RenderJob *job) { }
|
void RenderListener::refreshEvent(const RenderJob *job) { }
|
||||||
void RenderListener::finishJobEvent(const RenderJob *job, bool cancelled) { }
|
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);
|
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);
|
LockGuard lock(m_mutex);
|
||||||
for (size_t i=0; i<m_listeners.size(); ++i)
|
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) {
|
void RenderQueue::signalWorkCanceled(const RenderJob *job, const Point2i &offset, const Vector2i &size) {
|
||||||
|
|
Loading…
Reference in New Issue