diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-08-22 11:18:38 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-08-22 11:21:05 +0300 |
commit | bd935b5aed202e37084cb4952b4efd2dace2bfe7 (patch) | |
tree | 57722f5b2350905a80ce77ed41c023a233776571 /intern | |
parent | ccff7c3c828ec81c740fe0e0cde0011d27e30021 (diff) | |
parent | 691ed21842397e52445fa8368fa81d757ba66123 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/blender/addon/ui.py | 31 | ||||
-rw-r--r-- | intern/cycles/blender/blender_python.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/blender/blender_sync.cpp | 8 | ||||
-rw-r--r-- | intern/cycles/kernel/split/kernel_buffer_update.h | 36 | ||||
-rw-r--r-- | intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h | 20 | ||||
-rw-r--r-- | intern/cycles/kernel/split/kernel_path_init.h | 20 | ||||
-rw-r--r-- | intern/cycles/util/util_debug.cpp | 3 | ||||
-rw-r--r-- | intern/cycles/util/util_debug.h | 3 |
8 files changed, 57 insertions, 66 deletions
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 459d0d7d05e..fdacd52df0e 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -397,6 +397,8 @@ class CyclesRender_PT_performance(CyclesButtonsPanel, Panel): sub.enabled = rd.threads_mode == 'FIXED' sub.prop(rd, "threads") + col.separator() + sub = col.column(align=True) sub.label(text="Tiles:") sub.prop(cscene, "tile_order", text="") @@ -406,20 +408,10 @@ class CyclesRender_PT_performance(CyclesButtonsPanel, Panel): sub.prop(cscene, "use_progressive_refine") - subsub = sub.column(align=True) - subsub.prop(rd, "use_save_buffers") - - col = split.column(align=True) - - col.label(text="Viewport:") - col.prop(cscene, "debug_bvh_type", text="") - col.separator() - col.prop(cscene, "preview_start_resolution") - col.prop(rd, "preview_pixel_size", text="") - - col.separator() + col = split.column() col.label(text="Final Render:") + col.prop(rd, "use_save_buffers") col.prop(rd, "use_persistent_data", text="Persistent Images") col.separator() @@ -432,6 +424,12 @@ class CyclesRender_PT_performance(CyclesButtonsPanel, Panel): row.active = not cscene.debug_use_spatial_splits row.prop(cscene, "debug_bvh_time_steps") + col = layout.column() + col.label(text="Viewport Resolution:") + split = col.split() + split.prop(rd, "preview_pixel_size", text="") + split.prop(cscene, "preview_start_resolution") + class CyclesRender_PT_layer_options(CyclesButtonsPanel, Panel): bl_label = "Layer" @@ -1575,11 +1573,15 @@ class CyclesRender_PT_debug(CyclesButtonsPanel, Panel): col.prop(cscene, "debug_use_qbvh") col.prop(cscene, "debug_use_cpu_split_kernel") + col.separator() + col = layout.column() col.label('CUDA Flags:') col.prop(cscene, "debug_use_cuda_adaptive_compile") col.prop(cscene, "debug_use_cuda_split_kernel") + col.separator() + col = layout.column() col.label('OpenCL Flags:') col.prop(cscene, "debug_opencl_kernel_type", text="Kernel") @@ -1588,6 +1590,11 @@ class CyclesRender_PT_debug(CyclesButtonsPanel, Panel): col.prop(cscene, "debug_use_opencl_debug", text="Debug") col.prop(cscene, "debug_opencl_mem_limit") + col.separator() + + col = layout.column() + col.prop(cscene, "debug_bvh_type") + class CyclesParticle_PT_CurveSettings(CyclesButtonsPanel, Panel): bl_label = "Cycles Hair Settings" diff --git a/intern/cycles/blender/blender_python.cpp b/intern/cycles/blender/blender_python.cpp index 772ce1d555e..300ccc06ea9 100644 --- a/intern/cycles/blender/blender_python.cpp +++ b/intern/cycles/blender/blender_python.cpp @@ -60,6 +60,8 @@ bool debug_flags_sync_from_scene(BL::Scene b_scene) /* Backup some settings for comparison. */ DebugFlags::OpenCL::DeviceType opencl_device_type = flags.opencl.device_type; DebugFlags::OpenCL::KernelType opencl_kernel_type = flags.opencl.kernel_type; + /* Synchronize shared flags. */ + flags.viewport_static_bvh = get_enum(cscene, "debug_bvh_type"); /* Synchronize CPU flags. */ flags.cpu.avx2 = get_boolean(cscene, "debug_use_cpu_avx2"); flags.cpu.avx = get_boolean(cscene, "debug_use_cpu_avx"); diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp index 19d8044cd4a..432f67f3b5e 100644 --- a/intern/cycles/blender/blender_sync.cpp +++ b/intern/cycles/blender/blender_sync.cpp @@ -611,14 +611,10 @@ SceneParams BlenderSync::get_scene_params(BL::Scene& b_scene, else if(shadingsystem == 1) params.shadingsystem = SHADINGSYSTEM_OSL; - if(background) + if(background || DebugFlags().viewport_static_bvh) params.bvh_type = SceneParams::BVH_STATIC; else - params.bvh_type = (SceneParams::BVHType)get_enum( - cscene, - "debug_bvh_type", - SceneParams::BVH_NUM_TYPES, - SceneParams::BVH_STATIC); + params.bvh_type = SceneParams::BVH_DYNAMIC; params.use_bvh_spatial_split = RNA_boolean_get(&cscene, "debug_use_spatial_splits"); params.use_bvh_unaligned_nodes = RNA_boolean_get(&cscene, "debug_use_hair_bvh"); diff --git a/intern/cycles/kernel/split/kernel_buffer_update.h b/intern/cycles/kernel/split/kernel_buffer_update.h index de0c4160ca0..3b61319e349 100644 --- a/intern/cycles/kernel/split/kernel_buffer_update.h +++ b/intern/cycles/kernel/split/kernel_buffer_update.h @@ -75,7 +75,6 @@ ccl_device void kernel_buffer_update(KernelGlobals *kg, if(ray_index != QUEUE_EMPTY_SLOT) { #endif - ccl_global uint *rng_state = kernel_split_params.rng_state; int stride = kernel_split_params.stride; ccl_global char *ray_state = kernel_split_state.ray_state; @@ -83,29 +82,17 @@ ccl_device void kernel_buffer_update(KernelGlobals *kg, PathRadiance *L = &kernel_split_state.path_radiance[ray_index]; ccl_global Ray *ray = &kernel_split_state.ray[ray_index]; ccl_global float3 *throughput = &kernel_split_state.throughput[ray_index]; - ccl_global float *buffer = kernel_split_params.buffer; - unsigned int work_index; - ccl_global uint *initial_rng; - - unsigned int sample; - unsigned int tile_x; - unsigned int tile_y; - unsigned int pixel_x; - unsigned int pixel_y; + if(IS_STATE(ray_state, ray_index, RAY_UPDATE_BUFFER)) { + uint work_index = kernel_split_state.work_array[ray_index]; + uint sample = get_work_sample(kg, work_index, ray_index) + kernel_split_params.start_sample; - work_index = kernel_split_state.work_array[ray_index]; - sample = get_work_sample(kg, work_index, ray_index) + kernel_split_params.start_sample; - get_work_pixel_tile_position(kg, &pixel_x, &pixel_y, - &tile_x, &tile_y, - work_index, - ray_index); - initial_rng = rng_state; + uint tile_x, tile_y, pixel_x, pixel_y; + get_work_pixel_tile_position(kg, &pixel_x, &pixel_y, &tile_x, &tile_y, work_index, ray_index); - rng_state += kernel_split_params.offset + pixel_x + pixel_y*stride; - buffer += (kernel_split_params.offset + pixel_x + pixel_y*stride) * kernel_data.film.pass_stride; + ccl_global float *buffer = kernel_split_params.buffer; + buffer += (kernel_split_params.offset + pixel_x + pixel_y*stride) * kernel_data.film.pass_stride; - if(IS_STATE(ray_state, ray_index, RAY_UPDATE_BUFFER)) { /* accumulate result in output buffer */ bool is_shadow_catcher = (state->flag & PATH_RAY_SHADOW_CATCHER); kernel_write_result(kg, buffer, sample, L, is_shadow_catcher); @@ -115,6 +102,7 @@ ccl_device void kernel_buffer_update(KernelGlobals *kg, if(IS_STATE(ray_state, ray_index, RAY_TO_REGENERATE)) { /* We have completed current work; So get next work */ + uint work_index; int valid_work = get_next_work(kg, &work_index, ray_index); if(!valid_work) { /* If work is invalid, this means no more work is available and the thread may exit */ @@ -124,13 +112,17 @@ ccl_device void kernel_buffer_update(KernelGlobals *kg, if(IS_STATE(ray_state, ray_index, RAY_TO_REGENERATE)) { kernel_split_state.work_array[ray_index] = work_index; /* Get the sample associated with the current work */ - sample = get_work_sample(kg, work_index, ray_index) + kernel_split_params.start_sample; + uint sample = get_work_sample(kg, work_index, ray_index) + kernel_split_params.start_sample; /* Get pixel and tile position associated with current work */ + uint tile_x, tile_y, pixel_x, pixel_y; get_work_pixel_tile_position(kg, &pixel_x, &pixel_y, &tile_x, &tile_y, work_index, ray_index); /* Remap rng_state according to the current work */ - rng_state = initial_rng + kernel_split_params.offset + pixel_x + pixel_y*stride; + ccl_global uint *rng_state = kernel_split_params.rng_state; + rng_state += kernel_split_params.offset + pixel_x + pixel_y*stride; + /* Remap buffer according to the current work */ + ccl_global float *buffer = kernel_split_params.buffer; buffer += (kernel_split_params.offset + pixel_x + pixel_y*stride) * kernel_data.film.pass_stride; /* Initialize random numbers and ray. */ diff --git a/intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h b/intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h index 3fc45afbd92..253b78526e7 100644 --- a/intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h +++ b/intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h @@ -92,28 +92,19 @@ ccl_device void kernel_holdout_emission_blurring_pathtermination_ao( int stride = kernel_split_params.stride; - unsigned int work_index; - unsigned int pixel_x; - unsigned int pixel_y; - - unsigned int tile_x; - unsigned int tile_y; - unsigned int sample; - ccl_global PathState *state = 0x0; float3 throughput; + uint sample; ccl_global char *ray_state = kernel_split_state.ray_state; ShaderData *sd = &kernel_split_state.sd[ray_index]; ccl_global float *buffer = kernel_split_params.buffer; if(IS_STATE(ray_state, ray_index, RAY_ACTIVE)) { - - throughput = kernel_split_state.throughput[ray_index]; - state = &kernel_split_state.path_state[ray_index]; - - work_index = kernel_split_state.work_array[ray_index]; + uint work_index = kernel_split_state.work_array[ray_index]; sample = get_work_sample(kg, work_index, ray_index) + kernel_split_params.start_sample; + + uint pixel_x, pixel_y, tile_x, tile_y; get_work_pixel_tile_position(kg, &pixel_x, &pixel_y, &tile_x, &tile_y, work_index, @@ -121,6 +112,9 @@ ccl_device void kernel_holdout_emission_blurring_pathtermination_ao( buffer += (kernel_split_params.offset + pixel_x + pixel_y * stride) * kernel_data.film.pass_stride; + throughput = kernel_split_state.throughput[ray_index]; + state = &kernel_split_state.path_state[ray_index]; + #ifdef __SHADOW_TRICKS__ if((sd->object_flag & SD_OBJECT_SHADOW_CATCHER)) { if(state->flag & PATH_RAY_CAMERA) { diff --git a/intern/cycles/kernel/split/kernel_path_init.h b/intern/cycles/kernel/split/kernel_path_init.h index 8b70df16d2a..c75931855b2 100644 --- a/intern/cycles/kernel/split/kernel_path_init.h +++ b/intern/cycles/kernel/split/kernel_path_init.h @@ -29,13 +29,7 @@ ccl_device void kernel_path_init(KernelGlobals *kg) { */ kernel_split_state.ray_state[ray_index] = RAY_ACTIVE; - unsigned int my_sample; - unsigned int pixel_x; - unsigned int pixel_y; - unsigned int tile_x; - unsigned int tile_y; - - unsigned int work_index = 0; + uint work_index = 0; /* Get work. */ if(!get_next_work(kg, &work_index, ray_index)) { /* No more work, mark ray as inactive */ @@ -45,9 +39,10 @@ ccl_device void kernel_path_init(KernelGlobals *kg) { } /* Get the sample associated with the work. */ - my_sample = get_work_sample(kg, work_index, ray_index) + kernel_split_params.start_sample; + uint sample = get_work_sample(kg, work_index, ray_index) + kernel_split_params.start_sample; /* Get pixel and tile position associated with the work. */ + uint pixel_x, pixel_y, tile_x, tile_y; get_work_pixel_tile_position(kg, &pixel_x, &pixel_y, &tile_x, &tile_y, work_index, @@ -60,12 +55,11 @@ ccl_device void kernel_path_init(KernelGlobals *kg) { ccl_global float *buffer = kernel_split_params.buffer; buffer += (kernel_split_params.offset + pixel_x + pixel_y * kernel_split_params.stride) * kernel_data.film.pass_stride; - uint rng_hash; - /* Initialize random numbers and ray. */ + uint rng_hash; kernel_path_trace_setup(kg, rng_state, - my_sample, + sample, pixel_x, pixel_y, &rng_hash, &kernel_split_state.ray[ray_index]); @@ -80,7 +74,7 @@ ccl_device void kernel_path_init(KernelGlobals *kg) { &kernel_split_state.sd_DL_shadow[ray_index], &kernel_split_state.path_state[ray_index], rng_hash, - my_sample, + sample, &kernel_split_state.ray[ray_index]); #ifdef __SUBSURFACE__ kernel_path_subsurface_init_indirect(&kernel_split_state.ss_rays[ray_index]); @@ -90,7 +84,7 @@ ccl_device void kernel_path_init(KernelGlobals *kg) { /* These rays do not participate in path-iteration. */ float4 L_rad = make_float4(0.0f, 0.0f, 0.0f, 0.0f); /* Accumulate result in output buffer. */ - kernel_write_pass_float4(buffer, my_sample, L_rad); + kernel_write_pass_float4(buffer, sample, L_rad); ASSIGN_RAY_STATE(kernel_split_state.ray_state, ray_index, RAY_TO_REGENERATE); } } diff --git a/intern/cycles/util/util_debug.cpp b/intern/cycles/util/util_debug.cpp index 10895f2e918..eb078d69252 100644 --- a/intern/cycles/util/util_debug.cpp +++ b/intern/cycles/util/util_debug.cpp @@ -122,13 +122,16 @@ void DebugFlags::OpenCL::reset() } DebugFlags::DebugFlags() +: viewport_static_bvh(false) { /* Nothing for now. */ } void DebugFlags::reset() { + viewport_static_bvh = false; cpu.reset(); + cuda.reset(); opencl.reset(); } diff --git a/intern/cycles/util/util_debug.h b/intern/cycles/util/util_debug.h index 450cd900a9f..9255279c5ab 100644 --- a/intern/cycles/util/util_debug.h +++ b/intern/cycles/util/util_debug.h @@ -30,6 +30,9 @@ CCL_NAMESPACE_BEGIN */ class DebugFlags { public: + /* Use static BVH in viewport, to match final render exactly. */ + bool viewport_static_bvh; + /* Descriptor of CPU feature-set to be used. */ struct CPU { CPU(); |