42 if (
device->have_error()) {
46 scene = make_unique<Scene>(scene_params,
device.get());
69 tile_manager_.full_buffer_written_cb = [&](string_view filename) {
172 LOG_INFO <<
"Rendering in main loop is done in " << render_time <<
" seconds.";
183 const bool did_cancel =
progress.get_cancel();
196 if (
device->have_error()) {
217 if (
device->have_error()) {
275 progress.set_status(
"Waiting for render to start");
315 bool have_tiles =
true;
316 bool switched_to_new_tile =
false;
323 switched_to_new_tile =
true;
335 path_trace_->set_adaptive_sampling(adaptive_sampling);
341 const bool guiding_reset = (guiding_params.
use) ? reset_scene :
false;
342 path_trace_->set_guiding_params(guiding_params, guiding_reset);
347 params.sample_subset_offset,
348 params.sample_subset_length);
362 switched_to_new_tile =
true;
369 if (switched_to_new_tile) {
409 string device_status;
410 while (!
device->is_ready(device_status)) {
415 std::this_thread::sleep_for(std::chrono::milliseconds(200));
433 if (!
pause_ && render_work) {
438 const bool no_work = !render_work;
476 if (!
params.use_auto_tile) {
486 const int64_t actual_tile_area =
static_cast<int64_t>(tile_size) * tile_size;
517 scene->film->get_use_approximate_shadow_catcher();
530 params.sample_subset_offset,
531 params.sample_subset_length);
554 progress.set_time_limit(time_limit);
567 scene->scene_updated_while_loading_kernels =
true;
577 if (samples ==
params.samples) {
593 if (time_limit ==
params.time_limit) {
597 params.time_limit = time_limit;
637 path_trace_->set_display_driver(std::move(driver));
642 const double completed =
progress.get_progress();
643 if (completed == 0.0) {
650 double remaining = (1.0 - (double)completed) * (render_time / (
double)completed);
654 if (time_limit != 0.0) {
655 remaining =
min(remaining,
max(time_limit - render_time, 0.0));
680 if (reset_samples ||
scene->integrator->get_aa_samples() <
params.samples) {
684 scene->integrator->set_use_sample_subset(
params.use_sample_subset);
685 scene->integrator->set_sample_subset_offset(
params.sample_subset_offset);
686 scene->integrator->set_sample_subset_length(
params.sample_subset_length);
704 if (!prefix.empty()) {
707 return prefix + suffix;
715 const int current_tile =
progress.get_rendered_tiles();
718 const int current_sample =
progress.get_current_sample();
737 string device_status;
738 if (
device->is_ready(device_status) && !device_status.empty()) {
745 status =
"Rendering Paused";
747 else if (show_done) {
748 status =
"Rendering Done";
761 scene->device_free();
767 scene->collect_statistics(render_stats);
779 path_trace_->process_full_buffer_from_disk(filename);
static constexpr int image_width
static constexpr int image_height
unsigned long long int uint64_t
void update_offset_stride()
static unique_ptr< Device > create(const DeviceInfo &info, Stats &stats, Profiler &profiler, bool headless)
static const int MAX_SAMPLES
unique_ptr< Scene > scene
void collect_statistics(RenderStats *stats)
RenderScheduler render_scheduler_
unique_ptr< thread > session_thread_
enum Session::@160214110334236026320245177267173251377254361251 session_thread_state_
void update_status_time(bool show_pause=false, bool show_done=false)
void set_pause(bool pause)
thread_mutex pause_mutex_
Device * denoise_device()
int2 get_effective_tile_size() const
void process_full_buffer_from_disk(string_view filename)
void set_display_driver(unique_ptr< DisplayDriver > driver)
std::function< void(string_view)> full_buffer_written_cb
void cancel(bool quick=false)
thread_condition_variable pause_cond_
bool update_scene(const bool reset_samples)
bool run_wait_for_work(const RenderWork &render_work)
double get_estimated_remaining_time() const
thread_condition_variable session_thread_cond_
Session(const SessionParams ¶ms, const SceneParams &scene_params)
void update_buffers_for_params()
void run_main_render_loop()
thread_mutex session_thread_mutex_
BufferParams buffer_params_
unique_ptr< Device > denoise_device_
RenderWork run_update_for_next_iteration()
void set_time_limit(const double time_limit)
void reset(const SessionParams &session_params, const BufferParams &buffer_params)
bool is_session_thread_rendering()
void set_samples(const int samples)
unique_ptr< Device > device
thread_mutex buffers_mutex_
void set_output_driver(unique_ptr< OutputDriver > driver)
struct Session::DelayedReset delayed_reset_
bool delayed_reset_buffer_params()
unique_ptr< PathTrace > path_trace_
TileManager tile_manager_
static void init(const int num_threads=0)
static const int MAX_TILE_SIZE
#define CCL_NAMESPACE_END
ccl_gpu_kernel_postfix ccl_global KernelWorkTile const int num_tiles
const ccl_global KernelWorkTile * tile
static string status_append(const string &status, const string &suffix)
CCL_NAMESPACE_BEGIN string string_printf(const char *format,...)
void collect_profiling(Scene *scene, Profiler &prof)
std::unique_lock< std::mutex > thread_scoped_lock