Exemplo n.º 1
0
void SPPMPassCallback::pre_render(
    const Frame&            frame,
    JobQueue&               job_queue,
    AbortSwitch&            abort_switch)
{
    RENDERER_LOG_INFO(
        "sppm lookup radius is %f (%s of initial radius).",
        m_lookup_radius,
        pretty_percent(m_lookup_radius, m_initial_lookup_radius, 3).c_str());

    m_stopwatch.start();

    // Create a new set of photons.
    m_photons.clear_keep_memory();
    m_emitted_photon_count =
        m_photon_tracer.trace_photons(
            m_photons,
            hash_uint32(m_pass_number),
            job_queue,
            abort_switch);

    // Stop there if rendering was aborted.
    if (abort_switch.is_aborted())
        return;

    // Build a new photon map.
    m_photon_map.reset(new SPPMPhotonMap(m_photons));
}
void SampleGeneratorBase::generate_samples(
    const size_t                sample_count,
    SampleAccumulationBuffer&   buffer,
    AbortSwitch&                abort_switch)
{
    assert(sample_count > 0);

    clear_keep_memory(m_samples);
    m_samples.reserve(sample_count);

    size_t stored_sample_count = 0;

    while (stored_sample_count < sample_count)
    {
        stored_sample_count += generate_samples(m_sequence_index, m_samples);

        ++m_sequence_index;

        if (++m_current_batch_size == SampleBatchSize)
        {
            m_current_batch_size = 0;
            m_sequence_index += m_stride;

            if (abort_switch.is_aborted())
                break;
        }
    }

    if (stored_sample_count > 0)
        buffer.store_samples(stored_sample_count, &m_samples[0]);
}
Exemplo n.º 3
0
JobQueue::RunningJobInfo JobQueue::wait_for_scheduled_job(AbortSwitch& abort_switch)
{
    boost::mutex::scoped_lock lock(impl->m_mutex);

    // Wait for a scheduled job to be available.
    while (!abort_switch.is_aborted() && impl->m_scheduled_jobs.empty())    // order matters
        impl->m_event.wait(lock);

    return acquire_scheduled_job_unlocked();
}