MCPcopy Create free account
hub / github.com/MrKepzie/Natron / notifyFrameRendered

Method notifyFrameRendered

Engine/OutputSchedulerThread.cpp:1548–1731  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1546#endif // ifndef NATRON_PLAYBACK_USES_THREAD_POOL
1547
1548void
1549OutputSchedulerThread::notifyFrameRendered(int frame,
1550 ViewIdx viewIndex,
1551 const std::vector<ViewIdx>& viewsToRender,
1552 const RenderStatsPtr& stats,
1553 SchedulingPolicyEnum policy)
1554{
1555 assert(viewsToRender.size() > 0);
1556
1557 bool isLastView = viewIndex == viewsToRender[viewsToRender.size() - 1] || viewIndex == -1;
1558
1559 // Report render stats if desired
1560 boost::shared_ptr<OutputEffectInstance> effect = _imp->outputEffect.lock();
1561 if (stats) {
1562 double timeSpentForFrame;
1563 std::map<NodePtr, NodeRenderStats > statResults = stats->getStats(&timeSpentForFrame);
1564 if ( !statResults.empty() ) {
1565 effect->reportStats(frame, viewIndex, timeSpentForFrame, statResults);
1566 }
1567 }
1568
1569
1570 bool isBackground = appPTR->isBackground();
1571 boost::shared_ptr<OutputSchedulerThreadStartArgs> runArgs = _imp->runArgs.lock();
1572 assert(runArgs);
1573
1574 // If FFA all parallel renders call render on the Writer in their own thread,
1575 // otherwise the OutputSchedulerThread thread calls the render of the Writer.
1576 U64 nbTotalFrames;
1577 U64 nbFramesRendered;
1578 //bool renderingIsFinished = false;
1579 if (policy == eSchedulingPolicyFFA) {
1580 QMutexLocker l(&_imp->renderFinishedMutex);
1581 if (isLastView) {
1582 ++_imp->nFramesRendered;
1583 }
1584 nbTotalFrames = std::ceil( (double)(runArgs->lastFrame - runArgs->firstFrame + 1) / runArgs->frameStep );
1585 nbFramesRendered = _imp->nFramesRendered;
1586
1587
1588 if (_imp->nFramesRendered == nbTotalFrames) {
1589 _imp->renderFinished = true;
1590 l.unlock();
1591
1592 // Notify the scheduler rendering is finished by append a fake frame to the buffer
1593 {
1594 QMutexLocker bufLocker (&_imp->bufMutex);
1595 _imp->appendBufferedFrame( 0, viewIndex, RenderStatsPtr(), boost::shared_ptr<BufferableObject>() );
1596 _imp->bufEmptyCondition.wakeOne();
1597 }
1598 } else {
1599 l.unlock();
1600
1601#ifndef NATRON_SCHEDULER_SPAWN_THREADS_WITH_TIMER
1602
1603#ifndef NATRON_PLAYBACK_USES_THREAD_POOL
1604 ///////////
1605 /////Now set the appropriate number of threads to render.

Callers 1

renderFrameMethod · 0.80

Calls 15

ceilFunction · 0.85
floorFunction · 0.85
getStatsMethod · 0.80
emptyMethod · 0.80
appendBufferedFrameMethod · 0.80
getTimeSinceCreationMethod · 0.80
toStdStringMethod · 0.80
appendMethod · 0.80
writeToOutputPipeMethod · 0.80
s_frameRenderedMethod · 0.80
getAppIDStringMethod · 0.80

Tested by

no test coverage detected