示例#1
0
void TileQueue::cycleData( const uint32_t frameNumber, const Compound* compound)
{
    for( unsigned i = 0; i < NUM_EYES; ++i )
    {
        if( !compound->isInheritActive( Eye( 1<<i )))// eye pass not used
        {
            _queueMaster[i] = 0;
            continue;
        }

        // reuse unused queues
        LatencyQueue* queue    = _queues.empty() ? 0 : _queues.back();
        const uint32_t latency = getAutoObsolete();
        const uint32_t dataAge = queue ? queue->_frameNumber : 0;

        if( queue && dataAge < frameNumber-latency && frameNumber > latency )
            // not used anymore
            _queues.pop_back();
        else // still used - allocate new data
        {
            queue = new LatencyQueue;

            getLocalNode()->registerObject( &queue->_queue );
            queue->_queue.setAutoObsolete( 1 ); // current + in use by render nodes
        }

        queue->_queue.clear();
        queue->_frameNumber = frameNumber;

        _queues.push_front( queue );
        _queueMaster[i] = queue;
    }
}
示例#2
0
void Frame::cycleData(const uint32_t frameNumber, const Compound* compound)
{
    _masterFrameData = 0;
    for (unsigned i = 0; i < NUM_EYES; ++i)
    {
        _inputFrames[i].clear();

        const Eye eye = Eye(1 << i);
        if (!compound->isInheritActive(eye)) // eye pass not used
        {
            _frameData[i] = 0;
            continue;
        }

        // reuse unused frame data
        FrameData* data = _datas.empty() ? 0 : _datas.back();
        const uint32_t latency = getAutoObsolete();
        const uint32_t dataAge = data ? data->getFrameNumber() : 0;

        if (data && dataAge < frameNumber - latency && frameNumber > latency)
            // not used anymore
            _datas.pop_back();
        else // still used - allocate new data
        {
            data = new FrameData;

            getLocalNode()->registerObject(data);
            data->setAutoObsolete(1); // current + in use by render nodes
        }

        data->setFrameNumber(frameNumber);

        _datas.push_front(data);
        _frameData[i] = data;
        _getInputNodes(i).clear();
        _getInputNetNodes(i).clear();
        if (!_masterFrameData)
            _masterFrameData = data;
    }
}