diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-11-18 16:33:21 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-11-18 16:33:43 +0300 |
commit | c0d52db783eb3a6288c9af04298b2358fec76357 (patch) | |
tree | 7a94549ce03451bfb5e19ac1fb376cf7ce7c092f /intern | |
parent | 2b63a76041c0ba6c1fe19d0b343d3e70af4d4f59 (diff) | |
parent | f71813204c405821bb2efb8e4ad65d240d390eaf (diff) |
Merge branch 'blender-v3.0-release'
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/integrator/render_scheduler.cpp | 20 | ||||
-rw-r--r-- | intern/cycles/kernel/CMakeLists.txt | 6 | ||||
-rw-r--r-- | intern/cycles/session/session.cpp | 18 |
3 files changed, 41 insertions, 3 deletions
diff --git a/intern/cycles/integrator/render_scheduler.cpp b/intern/cycles/integrator/render_scheduler.cpp index 538d751e8b1..971173a5e96 100644 --- a/intern/cycles/integrator/render_scheduler.cpp +++ b/intern/cycles/integrator/render_scheduler.cpp @@ -840,6 +840,26 @@ int RenderScheduler::get_num_samples_to_path_trace() const num_samples_to_occupy = lround(state_.occupancy_num_samples * 0.7f / state_.occupancy); } + /* When time limit is used clamp the calculated number of samples to keep occupancy. + * This is because time limit causes the last render iteration to happen with less number of + * samples, which conflicts with the occupancy (lower number of samples causes lower + * occupancy, also the calculation is based on number of previously rendered samples). + * + * When time limit is not used the number of samples per render iteration is either increasing + * or stays the same, so there is no need to clamp number of samples calculated for occupancy. + */ + if (time_limit_ != 0.0 && state_.start_render_time != 0.0) { + const double remaining_render_time = max( + 0.0, time_limit_ - (time_dt() - state_.start_render_time)); + const double time_per_sample_average = path_trace_time_.get_average(); + const double predicted_render_time = num_samples_to_occupy * time_per_sample_average; + + if (predicted_render_time > remaining_render_time) { + num_samples_to_occupy = lround(num_samples_to_occupy * + (remaining_render_time / predicted_render_time)); + } + } + num_samples_to_render = max(num_samples_to_render, min(num_samples_to_occupy, max_num_samples_to_render)); } diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt index e7a7d226bae..36335d4c377 100644 --- a/intern/cycles/kernel/CMakeLists.txt +++ b/intern/cycles/kernel/CMakeLists.txt @@ -571,6 +571,12 @@ if(WITH_CYCLES_HIP_BINARIES AND WITH_CYCLES_DEVICE_HIP) -ffast-math -o ${CMAKE_CURRENT_BINARY_DIR}/${hip_file}) + if(WITH_NANOVDB) + set(hip_flags ${hip_flags} + -D WITH_NANOVDB + -I "${NANOVDB_INCLUDE_DIR}") + endif() + if(WITH_CYCLES_DEBUG) set(hip_flags ${hip_flags} -D WITH_CYCLES_DEBUG) endif() diff --git a/intern/cycles/session/session.cpp b/intern/cycles/session/session.cpp index aa58a039ed1..af5c6b3f1fd 100644 --- a/intern/cycles/session/session.cpp +++ b/intern/cycles/session/session.cpp @@ -368,14 +368,26 @@ void Session::draw() int2 Session::get_effective_tile_size() const { + const int image_width = buffer_params_.width; + const int image_height = buffer_params_.height; + /* No support yet for baking with tiles. */ if (!params.use_auto_tile || scene->bake_manager->get_baking()) { - return make_int2(buffer_params_.width, buffer_params_.height); + return make_int2(image_width, image_height); } - /* TODO(sergey): Take available memory into account, and if there is enough memory do not tile - * and prefer optimal performance. */ + const int64_t image_area = static_cast<int64_t>(image_width) * image_height; + + /* TODO(sergey): Take available memory into account, and if there is enough memory do not + * tile and prefer optimal performance. */ + const int tile_size = tile_manager_.compute_render_tile_size(params.tile_size); + const int64_t actual_tile_area = static_cast<int64_t>(tile_size) * tile_size; + + if (actual_tile_area >= image_area) { + return make_int2(image_width, image_height); + } + return make_int2(tile_size, tile_size); } |