Skip to content
This repository has been archived by the owner on Nov 27, 2024. It is now read-only.

Commit

Permalink
Merge branch 'next' of github.com:LuisaGroup/LuisaRender-coroutine in…
Browse files Browse the repository at this point in the history
…to next
  • Loading branch information
Mike-Leo-Smith committed May 16, 2024
2 parents 22d448a + 915e3a2 commit 7e146dc
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/integrators/coro_path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,16 @@ class CoroutinePathTracing final : public ProgressiveIntegrator {
Wavefront,
Persistent,
};

#define PT_CORO_SIGNATURE float, float, uint
using SchedulerBase = coroutine::CoroScheduler<PT_CORO_SIGNATURE>;
using SimpleScheduler = coroutine::StateMachineCoroScheduler<PT_CORO_SIGNATURE>;
using WavefrontScheduler = coroutine::WavefrontCoroScheduler<PT_CORO_SIGNATURE>;
using PersistentScheduler = coroutine::PersistentThreadsCoroScheduler<PT_CORO_SIGNATURE>;
#undef PT_CORO_SIGNATURE
using SchedulerBase = coroutine::CoroScheduler<float, float, uint>;

private:
uint _max_depth;
uint _rr_depth;
float _rr_threshold;
uint _samples_per_pass;
Scheduler _scheduler;
WavefrontScheduler::Config _wavefront_config;
PersistentScheduler::Config _persistent_config;
coroutine::WavefrontCoroSchedulerConfig _wavefront_config;
coroutine::PersistentThreadsCoroSchedulerConfig _persistent_config;

public:
CoroutinePathTracing(Scene *scene, const SceneNodeDesc *desc) noexcept
Expand Down Expand Up @@ -138,7 +132,8 @@ class CoroutinePathTracingInstance final : public ProgressiveIntegrator::Instanc
auto &stream = *command_buffer.stream();
switch (coro_pt->scheduler()) {
case CoroutinePathTracing::Scheduler::Simple: {
return luisa::make_unique<CoroutinePathTracing::SimpleScheduler>(device, render);
coroutine::StateMachineCoroScheduler s{device, render};
return luisa::make_unique<decltype(s)>(std::move(s));
}
case CoroutinePathTracing::Scheduler::Wavefront: {
auto config = coro_pt->wavefront_config();
Expand All @@ -157,7 +152,8 @@ class CoroutinePathTracingInstance final : public ProgressiveIntegrator::Instanc
config.thread_count,
config.hint_range,
!config.hint_fields.empty() ? config.hint_fields[0] : "NULL");
return luisa::make_unique<CoroutinePathTracing::WavefrontScheduler>(device, render, config);
coroutine::WavefrontCoroScheduler s{device, render, config};
return luisa::make_unique<decltype(s)>(std::move(s));
}
case CoroutinePathTracing::Scheduler::Persistent: {
auto config = coro_pt->persistent_config();
Expand All @@ -166,7 +162,8 @@ class CoroutinePathTracingInstance final : public ProgressiveIntegrator::Instanc
config.block_size,
config.fetch_size,
config.global_memory_ext);
return luisa::make_unique<CoroutinePathTracing::PersistentScheduler>(device, render, config);
coroutine::PersistentThreadsCoroScheduler s{device, render, config};
return luisa::make_unique<decltype(s)>(std::move(s));
}
default:
break;
Expand Down

0 comments on commit 7e146dc

Please sign in to comment.