47 if (
device->have_error()) {
70 tile_manager_.full_buffer_written_cb = [&](string_view filename) {
174 VLOG_INFO <<
"Rendering in main loop is done in " << render_time <<
" seconds.";
185 const bool did_cancel =
progress.get_cancel();
198 if (
device->have_error()) {
219 if (
device->have_error()) {
277 progress.set_status(
"Waiting for render to start");
310 bool have_tiles =
true;
311 bool switched_to_new_tile =
false;
312 bool did_reset =
false;
325 switched_to_new_tile =
true;
334 if (did_reset ||
scene->integrator->get_aa_samples() <
params.samples) {
347 path_trace_->set_adaptive_sampling(adaptive_sampling);
353 const bool guiding_reset = (guiding_params.
use) ?
scene->need_reset(
false) :
false;
354 path_trace_->set_guiding_params(guiding_params, guiding_reset);
372 switched_to_new_tile =
true;
379 if (switched_to_new_tile) {
430 string device_status;
431 while (!
device->is_ready(device_status)) {
436 std::this_thread::sleep_for(std::chrono::milliseconds(200));
454 if (!
pause_ && render_work) {
459 const bool no_work = !render_work;
497 if (!
params.use_auto_tile) {
507 const int64_t actual_tile_area =
static_cast<int64_t>(tile_size) * tile_size;
532 scene->film->get_use_approximate_shadow_catcher();
566 progress.set_time_limit(time_limit);
587 if (samples ==
params.samples) {
603 if (time_limit ==
params.time_limit) {
607 params.time_limit = time_limit;
647 path_trace_->set_display_driver(std::move(driver));
652 const double completed =
progress.get_progress();
653 if (completed == 0.0) {
659 double remaining = (1.0 - (
double)completed) * (render_time / (
double)completed);
663 if (time_limit != 0.0) {
664 remaining =
min(remaining,
max(time_limit - render_time, 0.0));
695 string prefix = status;
696 if (!prefix.empty()) {
699 return prefix + suffix;
704 string status, substatus;
706 const int current_tile =
progress.get_rendered_tiles();
709 const int current_sample =
progress.get_current_sample();
728 string device_status;
729 if (
device->is_ready(device_status) && !device_status.empty()) {
736 status =
"Rendering Paused";
738 else if (show_done) {
739 status =
"Rendering Done";
747 progress.set_status(status, substatus);
752 scene->device_free();
758 scene->collect_statistics(render_stats);
770 path_trace_->process_full_buffer_from_disk(filename);
static constexpr int image_width
static constexpr int image_height
typedef double(DMatrix)[4][4]
void update_offset_stride()
static Device * create(const DeviceInfo &info, Stats &stats, Profiler &profiler, bool headless)
static const int MAX_SAMPLES
void collect_statistics(RenderStats *stats)
RenderScheduler render_scheduler_
enum Session::@356104235353130171272174317343351122215134375167 session_thread_state_
void update_status_time(bool show_pause=false, bool show_done=false)
void set_pause(bool pause)
thread_mutex pause_mutex_
int2 get_effective_tile_size() const
void process_full_buffer_from_disk(string_view filename)
void set_display_driver(unique_ptr< DisplayDriver > driver)
void set_time_limit(double time_limit)
void cancel(bool quick=false)
thread_condition_variable pause_cond_
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)
bool update_scene(int width, int height)
function< void(string_view)> full_buffer_written_cb
void run_main_render_loop()
thread_mutex session_thread_mutex_
BufferParams buffer_params_
RenderWork run_update_for_next_iteration()
void reset(const SessionParams &session_params, const BufferParams &buffer_params)
bool is_session_thread_rendering()
thread_mutex buffers_mutex_
void set_output_driver(unique_ptr< OutputDriver > driver)
struct Session::DelayedReset delayed_reset_
void set_samples(int samples)
unique_ptr< PathTrace > path_trace_
TileManager tile_manager_
static void init(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
ccl_global const KernelWorkTile * tile
static string status_append(const string &status, const string &suffix)
unsigned __int64 uint64_t
CCL_NAMESPACE_BEGIN string string_printf(const char *format,...)
void set_screen_size(int width_, int height_)
void collect_profiling(Scene *scene, Profiler &prof)
std::unique_lock< std::mutex > thread_scoped_lock