diff options
Diffstat (limited to 'intern/cycles/integrator')
36 files changed, 166 insertions, 167 deletions
diff --git a/intern/cycles/integrator/CMakeLists.txt b/intern/cycles/integrator/CMakeLists.txt index 949254606b8..dedde513409 100644 --- a/intern/cycles/integrator/CMakeLists.txt +++ b/intern/cycles/integrator/CMakeLists.txt @@ -61,9 +61,11 @@ set(SRC_HEADERS ) set(LIB + cycles_device + # NOTE: Is required for RenderBuffers access. Might consider moving files around a bit to # avoid such cyclic dependency. - cycles_render + cycles_session cycles_util ) diff --git a/intern/cycles/integrator/adaptive_sampling.cpp b/intern/cycles/integrator/adaptive_sampling.cpp index 23fbcfea5c2..253879d67e3 100644 --- a/intern/cycles/integrator/adaptive_sampling.cpp +++ b/intern/cycles/integrator/adaptive_sampling.cpp @@ -16,7 +16,7 @@ #include "integrator/adaptive_sampling.h" -#include "util/util_math.h" +#include "util/math.h" CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/integrator/denoiser.cpp b/intern/cycles/integrator/denoiser.cpp index 598bbd497a5..b6ca96faebf 100644 --- a/intern/cycles/integrator/denoiser.cpp +++ b/intern/cycles/integrator/denoiser.cpp @@ -19,9 +19,9 @@ #include "device/device.h" #include "integrator/denoiser_oidn.h" #include "integrator/denoiser_optix.h" -#include "render/buffers.h" -#include "util/util_logging.h" -#include "util/util_progress.h" +#include "session/buffers.h" +#include "util/log.h" +#include "util/progress.h" CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/integrator/denoiser.h b/intern/cycles/integrator/denoiser.h index b02bcbeb046..8d7a644f8d9 100644 --- a/intern/cycles/integrator/denoiser.h +++ b/intern/cycles/integrator/denoiser.h @@ -19,10 +19,10 @@ /* TODO(sergey): The integrator folder might not be the best. Is easy to move files around if the * better place is figured out. */ +#include "device/denoise.h" #include "device/device.h" -#include "device/device_denoise.h" -#include "util/util_function.h" -#include "util/util_unique_ptr.h" +#include "util/function.h" +#include "util/unique_ptr.h" CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/integrator/denoiser_device.cpp b/intern/cycles/integrator/denoiser_device.cpp index e8361c50f2f..2121dee500a 100644 --- a/intern/cycles/integrator/denoiser_device.cpp +++ b/intern/cycles/integrator/denoiser_device.cpp @@ -16,13 +16,13 @@ #include "integrator/denoiser_device.h" +#include "device/denoise.h" #include "device/device.h" -#include "device/device_denoise.h" -#include "device/device_memory.h" -#include "device/device_queue.h" -#include "render/buffers.h" -#include "util/util_logging.h" -#include "util/util_progress.h" +#include "device/memory.h" +#include "device/queue.h" +#include "session/buffers.h" +#include "util/log.h" +#include "util/progress.h" CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/integrator/denoiser_device.h b/intern/cycles/integrator/denoiser_device.h index 0fd934dba79..2bacecaa2a2 100644 --- a/intern/cycles/integrator/denoiser_device.h +++ b/intern/cycles/integrator/denoiser_device.h @@ -17,7 +17,7 @@ #pragma once #include "integrator/denoiser.h" -#include "util/util_unique_ptr.h" +#include "util/unique_ptr.h" CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/integrator/denoiser_oidn.cpp b/intern/cycles/integrator/denoiser_oidn.cpp index cc9a3f51387..b09b95a11b0 100644 --- a/intern/cycles/integrator/denoiser_oidn.cpp +++ b/intern/cycles/integrator/denoiser_oidn.cpp @@ -19,12 +19,12 @@ #include <array> #include "device/device.h" -#include "device/device_queue.h" +#include "device/queue.h" #include "integrator/pass_accessor_cpu.h" -#include "render/buffers.h" -#include "util/util_array.h" -#include "util/util_logging.h" -#include "util/util_openimagedenoise.h" +#include "session/buffers.h" +#include "util/array.h" +#include "util/log.h" +#include "util/openimagedenoise.h" #include "kernel/device/cpu/compat.h" #include "kernel/device/cpu/kernel.h" diff --git a/intern/cycles/integrator/denoiser_oidn.h b/intern/cycles/integrator/denoiser_oidn.h index 566e761ae79..a0ec3e26b9c 100644 --- a/intern/cycles/integrator/denoiser_oidn.h +++ b/intern/cycles/integrator/denoiser_oidn.h @@ -17,8 +17,8 @@ #pragma once #include "integrator/denoiser.h" -#include "util/util_thread.h" -#include "util/util_unique_ptr.h" +#include "util/thread.h" +#include "util/unique_ptr.h" CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/integrator/denoiser_optix.cpp b/intern/cycles/integrator/denoiser_optix.cpp index 5f9de23bfe6..ebd95d62ae4 100644 --- a/intern/cycles/integrator/denoiser_optix.cpp +++ b/intern/cycles/integrator/denoiser_optix.cpp @@ -16,8 +16,8 @@ #include "integrator/denoiser_optix.h" +#include "device/denoise.h" #include "device/device.h" -#include "device/device_denoise.h" CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/integrator/pass_accessor.cpp b/intern/cycles/integrator/pass_accessor.cpp index 1308b03b06c..7e19de51daa 100644 --- a/intern/cycles/integrator/pass_accessor.cpp +++ b/intern/cycles/integrator/pass_accessor.cpp @@ -16,12 +16,12 @@ #include "integrator/pass_accessor.h" -#include "render/buffers.h" -#include "util/util_logging.h" +#include "session/buffers.h" +#include "util/log.h" // clang-format off #include "kernel/device/cpu/compat.h" -#include "kernel/kernel_types.h" +#include "kernel/types.h" // clang-format on CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/integrator/pass_accessor.h b/intern/cycles/integrator/pass_accessor.h index 624bf7d0b2c..09eae0156c9 100644 --- a/intern/cycles/integrator/pass_accessor.h +++ b/intern/cycles/integrator/pass_accessor.h @@ -16,10 +16,10 @@ #pragma once -#include "render/pass.h" -#include "util/util_half.h" -#include "util/util_string.h" -#include "util/util_types.h" +#include "scene/pass.h" +#include "util/half.h" +#include "util/string.h" +#include "util/types.h" CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/integrator/pass_accessor_cpu.cpp b/intern/cycles/integrator/pass_accessor_cpu.cpp index e3cb81d31b7..820da757be0 100644 --- a/intern/cycles/integrator/pass_accessor_cpu.cpp +++ b/intern/cycles/integrator/pass_accessor_cpu.cpp @@ -16,15 +16,15 @@ #include "integrator/pass_accessor_cpu.h" -#include "render/buffers.h" -#include "util/util_logging.h" -#include "util/util_tbb.h" +#include "session/buffers.h" +#include "util/log.h" +#include "util/tbb.h" // clang-format off #include "kernel/device/cpu/compat.h" #include "kernel/device/cpu/globals.h" -#include "kernel/kernel_types.h" -#include "kernel/kernel_film.h" +#include "kernel/types.h" +#include "kernel/film/read.h" // clang-format on CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/integrator/pass_accessor_gpu.cpp b/intern/cycles/integrator/pass_accessor_gpu.cpp index 7b01d061708..c03ef64a2b2 100644 --- a/intern/cycles/integrator/pass_accessor_gpu.cpp +++ b/intern/cycles/integrator/pass_accessor_gpu.cpp @@ -16,9 +16,9 @@ #include "integrator/pass_accessor_gpu.h" -#include "device/device_queue.h" -#include "render/buffers.h" -#include "util/util_logging.h" +#include "device/queue.h" +#include "session/buffers.h" +#include "util/log.h" CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/integrator/pass_accessor_gpu.h b/intern/cycles/integrator/pass_accessor_gpu.h index bc37e4387f3..f3442d90013 100644 --- a/intern/cycles/integrator/pass_accessor_gpu.h +++ b/intern/cycles/integrator/pass_accessor_gpu.h @@ -17,7 +17,7 @@ #pragma once #include "integrator/pass_accessor.h" -#include "kernel/kernel_types.h" +#include "kernel/types.h" CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/integrator/path_trace.cpp b/intern/cycles/integrator/path_trace.cpp index 9f3049c6484..daf270d6686 100644 --- a/intern/cycles/integrator/path_trace.cpp +++ b/intern/cycles/integrator/path_trace.cpp @@ -22,14 +22,14 @@ #include "integrator/path_trace_display.h" #include "integrator/path_trace_tile.h" #include "integrator/render_scheduler.h" -#include "render/pass.h" -#include "render/scene.h" -#include "render/tile.h" -#include "util/util_algorithm.h" -#include "util/util_logging.h" -#include "util/util_progress.h" -#include "util/util_tbb.h" -#include "util/util_time.h" +#include "scene/pass.h" +#include "scene/scene.h" +#include "session/tile.h" +#include "util/algorithm.h" +#include "util/log.h" +#include "util/progress.h" +#include "util/tbb.h" +#include "util/time.h" CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/integrator/path_trace.h b/intern/cycles/integrator/path_trace.h index dbb22c204d9..9b079352a63 100644 --- a/intern/cycles/integrator/path_trace.h +++ b/intern/cycles/integrator/path_trace.h @@ -20,11 +20,11 @@ #include "integrator/pass_accessor.h" #include "integrator/path_trace_work.h" #include "integrator/work_balancer.h" -#include "render/buffers.h" -#include "util/util_function.h" -#include "util/util_thread.h" -#include "util/util_unique_ptr.h" -#include "util/util_vector.h" +#include "session/buffers.h" +#include "util/function.h" +#include "util/thread.h" +#include "util/unique_ptr.h" +#include "util/vector.h" CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/integrator/path_trace_display.cpp b/intern/cycles/integrator/path_trace_display.cpp index 28f0a7f7745..c1cade923b1 100644 --- a/intern/cycles/integrator/path_trace_display.cpp +++ b/intern/cycles/integrator/path_trace_display.cpp @@ -16,9 +16,9 @@ #include "integrator/path_trace_display.h" -#include "render/buffers.h" +#include "session/buffers.h" -#include "util/util_logging.h" +#include "util/log.h" CCL_NAMESPACE_BEGIN @@ -30,29 +30,16 @@ void PathTraceDisplay::reset(const BufferParams &buffer_params) { thread_scoped_lock lock(mutex_); - const DisplayDriver::Params old_params = params_; - params_.full_offset = make_int2(buffer_params.full_x, buffer_params.full_y); params_.full_size = make_int2(buffer_params.full_width, buffer_params.full_height); params_.size = make_int2(buffer_params.width, buffer_params.height); - /* If the parameters did change tag texture as unusable. This avoids drawing old texture content - * in an updated configuration of the viewport. For example, avoids drawing old frame when render - * border did change. - * If the parameters did not change, allow drawing the current state of the texture, which will - * not count as an up-to-date redraw. This will avoid flickering when doping camera navigation by - * showing a previously rendered frame for until the new one is ready. */ - if (old_params.modified(params_)) { - texture_state_.is_usable = false; - } - texture_state_.is_outdated = true; } void PathTraceDisplay::mark_texture_updated() { texture_state_.is_outdated = false; - texture_state_.is_usable = true; } /* -------------------------------------------------------------------- @@ -248,19 +235,15 @@ bool PathTraceDisplay::draw() * The drawing itself is non-blocking however, for better performance and to avoid * potential deadlocks due to locks held by the subclass. */ DisplayDriver::Params params; - bool is_usable; bool is_outdated; { thread_scoped_lock lock(mutex_); params = params_; - is_usable = texture_state_.is_usable; is_outdated = texture_state_.is_outdated; } - if (is_usable) { - driver_->draw(params); - } + driver_->draw(params); return !is_outdated; } diff --git a/intern/cycles/integrator/path_trace_display.h b/intern/cycles/integrator/path_trace_display.h index 24aaa0df6b1..b69ee85fbbc 100644 --- a/intern/cycles/integrator/path_trace_display.h +++ b/intern/cycles/integrator/path_trace_display.h @@ -16,12 +16,12 @@ #pragma once -#include "render/display_driver.h" +#include "session/display_driver.h" -#include "util/util_half.h" -#include "util/util_thread.h" -#include "util/util_types.h" -#include "util/util_unique_ptr.h" +#include "util/half.h" +#include "util/thread.h" +#include "util/types.h" +#include "util/unique_ptr.h" CCL_NAMESPACE_BEGIN @@ -174,15 +174,6 @@ class PathTraceDisplay { /* State of the texture, which is needed for an integration with render session and interactive * updates and navigation. */ struct { - /* Denotes whether possibly existing state of GPU side texture is still usable. - * It will not be usable in cases like render border did change (in this case we don't want - * previous texture to be rendered at all). - * - * However, if only navigation or object in scene did change, then the outdated state of the - * texture is still usable for draw, preventing display viewport flickering on navigation and - * object modifications. */ - bool is_usable = false; - /* Texture is considered outdated after `reset()` until the next call of * `copy_pixels_to_texture()`. */ bool is_outdated = true; diff --git a/intern/cycles/integrator/path_trace_tile.cpp b/intern/cycles/integrator/path_trace_tile.cpp index 540f4aa5f68..4834769f476 100644 --- a/intern/cycles/integrator/path_trace_tile.cpp +++ b/intern/cycles/integrator/path_trace_tile.cpp @@ -18,10 +18,10 @@ #include "integrator/pass_accessor_cpu.h" #include "integrator/path_trace.h" -#include "render/buffers.h" -#include "render/film.h" -#include "render/pass.h" -#include "render/scene.h" +#include "scene/film.h" +#include "scene/pass.h" +#include "scene/scene.h" +#include "session/buffers.h" CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/integrator/path_trace_tile.h b/intern/cycles/integrator/path_trace_tile.h index fd3e2969f6c..6c7bddf2ca5 100644 --- a/intern/cycles/integrator/path_trace_tile.h +++ b/intern/cycles/integrator/path_trace_tile.h @@ -16,7 +16,7 @@ #pragma once -#include "render/output_driver.h" +#include "session/output_driver.h" CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/integrator/path_trace_work.cpp b/intern/cycles/integrator/path_trace_work.cpp index d46f095d0d7..b0c40cfe15c 100644 --- a/intern/cycles/integrator/path_trace_work.cpp +++ b/intern/cycles/integrator/path_trace_work.cpp @@ -20,11 +20,11 @@ #include "integrator/path_trace_work.h" #include "integrator/path_trace_work_cpu.h" #include "integrator/path_trace_work_gpu.h" -#include "render/buffers.h" -#include "render/film.h" -#include "render/scene.h" +#include "scene/film.h" +#include "scene/scene.h" +#include "session/buffers.h" -#include "kernel/kernel_types.h" +#include "kernel/types.h" CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/integrator/path_trace_work.h b/intern/cycles/integrator/path_trace_work.h index 404165b7c55..0dc7cd2f896 100644 --- a/intern/cycles/integrator/path_trace_work.h +++ b/intern/cycles/integrator/path_trace_work.h @@ -17,10 +17,10 @@ #pragma once #include "integrator/pass_accessor.h" -#include "render/buffers.h" -#include "render/pass.h" -#include "util/util_types.h" -#include "util/util_unique_ptr.h" +#include "scene/pass.h" +#include "session/buffers.h" +#include "util/types.h" +#include "util/unique_ptr.h" CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/integrator/path_trace_work_cpu.cpp b/intern/cycles/integrator/path_trace_work_cpu.cpp index 1cadcd9ec5c..541a7eca02f 100644 --- a/intern/cycles/integrator/path_trace_work_cpu.cpp +++ b/intern/cycles/integrator/path_trace_work_cpu.cpp @@ -19,17 +19,17 @@ #include "device/cpu/kernel.h" #include "device/device.h" -#include "kernel/kernel_path_state.h" +#include "kernel/integrator/path_state.h" #include "integrator/pass_accessor_cpu.h" #include "integrator/path_trace_display.h" -#include "render/buffers.h" -#include "render/scene.h" +#include "scene/scene.h" +#include "session/buffers.h" -#include "util/util_atomic.h" -#include "util/util_logging.h" -#include "util/util_tbb.h" +#include "util/atomic.h" +#include "util/log.h" +#include "util/tbb.h" CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/integrator/path_trace_work_cpu.h b/intern/cycles/integrator/path_trace_work_cpu.h index 91c024f4e4a..6e734690811 100644 --- a/intern/cycles/integrator/path_trace_work_cpu.h +++ b/intern/cycles/integrator/path_trace_work_cpu.h @@ -16,14 +16,14 @@ #pragma once -#include "kernel/integrator/integrator_state.h" +#include "kernel/integrator/state.h" #include "device/cpu/kernel_thread_globals.h" -#include "device/device_queue.h" +#include "device/queue.h" #include "integrator/path_trace_work.h" -#include "util/util_vector.h" +#include "util/vector.h" CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/integrator/path_trace_work_gpu.cpp b/intern/cycles/integrator/path_trace_work_gpu.cpp index 36f275e1075..251bec0dc8f 100644 --- a/intern/cycles/integrator/path_trace_work_gpu.cpp +++ b/intern/cycles/integrator/path_trace_work_gpu.cpp @@ -20,14 +20,14 @@ #include "device/device.h" #include "integrator/pass_accessor_gpu.h" -#include "render/buffers.h" -#include "render/scene.h" -#include "util/util_logging.h" -#include "util/util_string.h" -#include "util/util_tbb.h" -#include "util/util_time.h" +#include "scene/scene.h" +#include "session/buffers.h" +#include "util/log.h" +#include "util/string.h" +#include "util/tbb.h" +#include "util/time.h" -#include "kernel/kernel_types.h" +#include "kernel/types.h" CCL_NAMESPACE_BEGIN @@ -53,9 +53,9 @@ static size_t estimate_single_state_size() * rely on this. */ #define KERNEL_STRUCT_VOLUME_STACK_SIZE 4 -#include "kernel/integrator/integrator_state_template.h" +#include "kernel/integrator/state_template.h" -#include "kernel/integrator/integrator_shadow_state_template.h" +#include "kernel/integrator/shadow_state_template.h" #undef KERNEL_STRUCT_BEGIN #undef KERNEL_STRUCT_MEMBER @@ -120,7 +120,7 @@ void PathTraceWorkGPU::alloc_integrator_soa() * TODO: store float3 in separate XYZ arrays. */ #define KERNEL_STRUCT_BEGIN(name) for (int array_index = 0;; array_index++) { #define KERNEL_STRUCT_MEMBER(parent_struct, type, name, feature) \ - if ((kernel_features & feature) && (integrator_state_gpu_.parent_struct.name == nullptr)) { \ + if ((kernel_features & (feature)) && (integrator_state_gpu_.parent_struct.name == nullptr)) { \ device_only_memory<type> *array = new device_only_memory<type>(device_, \ "integrator_state_" #name); \ array->alloc_to_device(max_num_paths_); \ @@ -128,7 +128,7 @@ void PathTraceWorkGPU::alloc_integrator_soa() integrator_state_gpu_.parent_struct.name = (type *)array->device_pointer; \ } #define KERNEL_STRUCT_ARRAY_MEMBER(parent_struct, type, name, feature) \ - if ((kernel_features & feature) && \ + if ((kernel_features & (feature)) && \ (integrator_state_gpu_.parent_struct[array_index].name == nullptr)) { \ device_only_memory<type> *array = new device_only_memory<type>(device_, \ "integrator_state_" #name); \ @@ -146,9 +146,9 @@ void PathTraceWorkGPU::alloc_integrator_soa() } #define KERNEL_STRUCT_VOLUME_STACK_SIZE (integrator_state_soa_volume_stack_size_) -#include "kernel/integrator/integrator_state_template.h" +#include "kernel/integrator/state_template.h" -#include "kernel/integrator/integrator_shadow_state_template.h" +#include "kernel/integrator/shadow_state_template.h" #undef KERNEL_STRUCT_BEGIN #undef KERNEL_STRUCT_MEMBER @@ -258,7 +258,10 @@ void PathTraceWorkGPU::render_samples(RenderStatistics &statistics, * schedules work in halves of available number of paths. */ work_tile_scheduler_.set_max_num_path_states(max_num_paths_ / 8); - work_tile_scheduler_.reset(effective_buffer_params_, start_sample, samples_num); + work_tile_scheduler_.reset(effective_buffer_params_, + start_sample, + samples_num, + device_scene_->data.integrator.scrambling_distance); enqueue_reset(); @@ -1082,7 +1085,7 @@ bool PathTraceWorkGPU::kernel_creates_shadow_paths(DeviceKernel kernel) bool PathTraceWorkGPU::kernel_creates_ao_paths(DeviceKernel kernel) { - return (device_scene_->data.film.pass_ao != PASS_UNUSED) && + return (device_scene_->data.kernel_features & KERNEL_FEATURE_AO) && (kernel == DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE || kernel == DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_RAYTRACE); } diff --git a/intern/cycles/integrator/path_trace_work_gpu.h b/intern/cycles/integrator/path_trace_work_gpu.h index 8734d2c2852..c5e291e72db 100644 --- a/intern/cycles/integrator/path_trace_work_gpu.h +++ b/intern/cycles/integrator/path_trace_work_gpu.h @@ -16,16 +16,16 @@ #pragma once -#include "kernel/integrator/integrator_state.h" +#include "kernel/integrator/state.h" -#include "device/device_graphics_interop.h" -#include "device/device_memory.h" -#include "device/device_queue.h" +#include "device/graphics_interop.h" +#include "device/memory.h" +#include "device/queue.h" #include "integrator/path_trace_work.h" #include "integrator/work_tile_scheduler.h" -#include "util/util_vector.h" +#include "util/vector.h" CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/integrator/render_scheduler.cpp b/intern/cycles/integrator/render_scheduler.cpp index 322d3d5f94c..f776d01ef67 100644 --- a/intern/cycles/integrator/render_scheduler.cpp +++ b/intern/cycles/integrator/render_scheduler.cpp @@ -16,11 +16,11 @@ #include "integrator/render_scheduler.h" -#include "render/session.h" -#include "render/tile.h" -#include "util/util_logging.h" -#include "util/util_math.h" -#include "util/util_time.h" +#include "session/session.h" +#include "session/tile.h" +#include "util/log.h" +#include "util/math.h" +#include "util/time.h" CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/integrator/render_scheduler.h b/intern/cycles/integrator/render_scheduler.h index c4ab15e54ba..d7b7413ae31 100644 --- a/intern/cycles/integrator/render_scheduler.h +++ b/intern/cycles/integrator/render_scheduler.h @@ -18,8 +18,8 @@ #include "integrator/adaptive_sampling.h" #include "integrator/denoiser.h" /* For DenoiseParams. */ -#include "render/buffers.h" -#include "util/util_string.h" +#include "session/buffers.h" +#include "util/string.h" CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/integrator/shader_eval.cpp b/intern/cycles/integrator/shader_eval.cpp index 3de7bb6fd16..42cbf87f254 100644 --- a/intern/cycles/integrator/shader_eval.cpp +++ b/intern/cycles/integrator/shader_eval.cpp @@ -17,14 +17,14 @@ #include "integrator/shader_eval.h" #include "device/device.h" -#include "device/device_queue.h" +#include "device/queue.h" #include "device/cpu/kernel.h" #include "device/cpu/kernel_thread_globals.h" -#include "util/util_logging.h" -#include "util/util_progress.h" -#include "util/util_tbb.h" +#include "util/log.h" +#include "util/progress.h" +#include "util/tbb.h" CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/integrator/shader_eval.h b/intern/cycles/integrator/shader_eval.h index 43b6b1bdd47..3ae63b84d04 100644 --- a/intern/cycles/integrator/shader_eval.h +++ b/intern/cycles/integrator/shader_eval.h @@ -16,11 +16,11 @@ #pragma once -#include "device/device_memory.h" +#include "device/memory.h" -#include "kernel/kernel_types.h" +#include "kernel/types.h" -#include "util/util_function.h" +#include "util/function.h" CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/integrator/tile.cpp b/intern/cycles/integrator/tile.cpp index 3387b7bedf1..4a1558cce09 100644 --- a/intern/cycles/integrator/tile.cpp +++ b/intern/cycles/integrator/tile.cpp @@ -16,8 +16,8 @@ #include "integrator/tile.h" -#include "util/util_logging.h" -#include "util/util_math.h" +#include "util/log.h" +#include "util/math.h" CCL_NAMESPACE_BEGIN @@ -48,7 +48,8 @@ ccl_device_inline uint round_up_to_power_of_two(uint x) TileSize tile_calculate_best_size(const int2 &image_size, const int num_samples, - const int max_num_path_states) + const int max_num_path_states, + const float scrambling_distance) { if (max_num_path_states == 1) { /* Simple case: avoid any calculation, which could cause rounding issues. */ @@ -71,17 +72,24 @@ TileSize tile_calculate_best_size(const int2 &image_size, * - Keep values a power of two, for more integer fit into the maximum number of paths. */ TileSize tile_size; - - /* Calculate tile size as if it is the most possible one to fit an entire range of samples. - * The idea here is to keep tiles as small as possible, and keep device occupied by scheduling - * multiple tiles with the same coordinates rendering different samples. */ const int num_path_states_per_sample = max_num_path_states / num_samples; - if (num_path_states_per_sample != 0) { - tile_size.width = round_down_to_power_of_two(lround(sqrt(num_path_states_per_sample))); - tile_size.height = tile_size.width; + if (scrambling_distance < 0.9f) { + /* Prefer large tiles for scrambling distance, bounded by max num path states. */ + tile_size.width = min(image_size.x, max_num_path_states); + tile_size.height = min(image_size.y, max(max_num_path_states / tile_size.width, 1)); } else { - tile_size.width = tile_size.height = 1; + /* Calculate tile size as if it is the most possible one to fit an entire range of samples. + * The idea here is to keep tiles as small as possible, and keep device occupied by scheduling + * multiple tiles with the same coordinates rendering different samples. */ + + if (num_path_states_per_sample != 0) { + tile_size.width = round_down_to_power_of_two(lround(sqrt(num_path_states_per_sample))); + tile_size.height = tile_size.width; + } + else { + tile_size.width = tile_size.height = 1; + } } if (num_samples == 1) { @@ -93,7 +101,7 @@ TileSize tile_calculate_best_size(const int2 &image_size, tile_size.num_samples = min(round_up_to_power_of_two(lround(sqrt(num_samples / 2))), static_cast<uint>(num_samples)); - const int tile_area = tile_size.width / tile_size.height; + const int tile_area = tile_size.width * tile_size.height; tile_size.num_samples = min(tile_size.num_samples, max_num_path_states / tile_area); } diff --git a/intern/cycles/integrator/tile.h b/intern/cycles/integrator/tile.h index d0824843ddb..61f7d736115 100644 --- a/intern/cycles/integrator/tile.h +++ b/intern/cycles/integrator/tile.h @@ -18,7 +18,7 @@ #include <ostream> -#include "util/util_types.h" +#include "util/types.h" CCL_NAMESPACE_BEGIN @@ -51,6 +51,7 @@ std::ostream &operator<<(std::ostream &os, const TileSize &tile_size); * possible, and have as many threads active for every tile as possible. */ TileSize tile_calculate_best_size(const int2 &image_size, const int num_samples, - const int max_num_path_states); + const int max_num_path_states, + const float scrambling_distance); CCL_NAMESPACE_END diff --git a/intern/cycles/integrator/work_balancer.cpp b/intern/cycles/integrator/work_balancer.cpp index 9f96fe3632b..4c6fa341f35 100644 --- a/intern/cycles/integrator/work_balancer.cpp +++ b/intern/cycles/integrator/work_balancer.cpp @@ -16,9 +16,9 @@ #include "integrator/work_balancer.h" -#include "util/util_math.h" +#include "util/math.h" -#include "util/util_logging.h" +#include "util/log.h" CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/integrator/work_balancer.h b/intern/cycles/integrator/work_balancer.h index fc5e561845e..86ff9335f91 100644 --- a/intern/cycles/integrator/work_balancer.h +++ b/intern/cycles/integrator/work_balancer.h @@ -16,7 +16,7 @@ #pragma once -#include "util/util_vector.h" +#include "util/vector.h" CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/integrator/work_tile_scheduler.cpp b/intern/cycles/integrator/work_tile_scheduler.cpp index 234b1fae915..2d1ac07db7f 100644 --- a/intern/cycles/integrator/work_tile_scheduler.cpp +++ b/intern/cycles/integrator/work_tile_scheduler.cpp @@ -16,11 +16,11 @@ #include "integrator/work_tile_scheduler.h" -#include "device/device_queue.h" +#include "device/queue.h" #include "integrator/tile.h" -#include "render/buffers.h" -#include "util/util_atomic.h" -#include "util/util_logging.h" +#include "session/buffers.h" +#include "util/atomic.h" +#include "util/log.h" CCL_NAMESPACE_BEGIN @@ -33,13 +33,17 @@ void WorkTileScheduler::set_max_num_path_states(int max_num_path_states) max_num_path_states_ = max_num_path_states; } -void WorkTileScheduler::reset(const BufferParams &buffer_params, int sample_start, int samples_num) +void WorkTileScheduler::reset(const BufferParams &buffer_params, + int sample_start, + int samples_num, + float scrambling_distance) { /* Image buffer parameters. */ image_full_offset_px_.x = buffer_params.full_x; image_full_offset_px_.y = buffer_params.full_y; image_size_px_ = make_int2(buffer_params.width, buffer_params.height); + scrambling_distance_ = scrambling_distance; offset_ = buffer_params.offset; stride_ = buffer_params.stride; @@ -54,7 +58,8 @@ void WorkTileScheduler::reset(const BufferParams &buffer_params, int sample_star void WorkTileScheduler::reset_scheduler_state() { - tile_size_ = tile_calculate_best_size(image_size_px_, samples_num_, max_num_path_states_); + tile_size_ = tile_calculate_best_size( + image_size_px_, samples_num_, max_num_path_states_, scrambling_distance_); VLOG(3) << "Will schedule tiles of size " << tile_size_; diff --git a/intern/cycles/integrator/work_tile_scheduler.h b/intern/cycles/integrator/work_tile_scheduler.h index 85f11b601c7..d9fa7e84431 100644 --- a/intern/cycles/integrator/work_tile_scheduler.h +++ b/intern/cycles/integrator/work_tile_scheduler.h @@ -17,7 +17,7 @@ #pragma once #include "integrator/tile.h" -#include "util/util_types.h" +#include "util/types.h" CCL_NAMESPACE_BEGIN @@ -38,7 +38,10 @@ class WorkTileScheduler { void set_max_num_path_states(int max_num_path_states); /* Scheduling will happen for pixels within a big tile denotes by its parameters. */ - void reset(const BufferParams &buffer_params, int sample_start, int samples_num); + void reset(const BufferParams &buffer_params, + int sample_start, + int samples_num, + float scrambling_distance); /* Get work for a device. * Returns true if there is still work to be done and initialize the work tile to all @@ -68,6 +71,9 @@ class WorkTileScheduler { * Will be passed over to the KernelWorkTile. */ int offset_, stride_; + /* Scrambling Distance requires adapted tile size */ + float scrambling_distance_; + /* Start sample of index and number of samples which are to be rendered. * The scheduler will cover samples range of [start, start + num] over the entire image * (splitting into a smaller work tiles). */ |