diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2016-05-22 10:57:36 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2016-06-08 22:45:40 +0300 |
commit | ee08c87b4bdbce8a43ec7499dda4fe506ec51b32 (patch) | |
tree | 4a95f625288c631fa71492b525602cf4f83505cf /intern | |
parent | 8708eee988cffaaaac0357efce3590da7ef76053 (diff) |
Cleanup: remove Cycles layer bits checking in the kernel.
At some point the idea was that we could have an optimization where we could
render multiple render layers without re-exporting the scene, by just updating
the layer bits. We are not doing this now and in practice with the available
render layer control like exclude layers it's not always possible anyway.
This makes it easier to support an arbitrary number of layers in the future
(hopefully this summer), and frees up some useful bits in the kernel.
Reviewed By: sergey, dingto
Differential Revision: https://developer.blender.org/D2020
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/blender/blender_object.cpp | 10 | ||||
-rw-r--r-- | intern/cycles/blender/blender_sync.cpp | 6 | ||||
-rw-r--r-- | intern/cycles/blender/blender_sync.h | 2 | ||||
-rw-r--r-- | intern/cycles/blender/blender_util.h | 8 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_path_state.h | 3 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_types.h | 11 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_volume.h | 5 | ||||
-rw-r--r-- | intern/cycles/render/integrator.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/render/integrator.h | 1 |
9 files changed, 8 insertions, 40 deletions
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp index edd5f292c79..80768c096e3 100644 --- a/intern/cycles/blender/blender_object.cpp +++ b/intern/cycles/blender/blender_object.cpp @@ -365,13 +365,12 @@ Object *BlenderSync::sync_object(BL::Object& b_parent, } /* make holdout objects on excluded layer invisible for non-camera rays */ - if(use_holdout && (layer_flag & render_layer.exclude_layer)) + if(use_holdout && (layer_flag & render_layer.exclude_layer)) { visibility &= ~(PATH_RAY_ALL_VISIBILITY - PATH_RAY_CAMERA); + } - /* camera flag is not actually used, instead is tested against render layer - * flags */ - if(visibility & PATH_RAY_CAMERA) { - visibility |= layer_flag << PATH_RAY_LAYER_SHIFT; + /* hide objects not on render layer from camera rays */ + if(!(layer_flag & render_layer.layer)) { visibility &= ~PATH_RAY_CAMERA; } @@ -572,7 +571,6 @@ void BlenderSync::sync_objects(BL::SpaceView3D& b_v3d, float motion_time) bool hide = (render_layer.use_viewport_visibility)? b_ob.hide(): b_ob.hide_render(); uint ob_layer = get_layer(b_base->layers(), b_base->layers_local_view(), - render_layer.use_localview, object_is_light(b_ob), scene_layers); hide = hide || !(ob_layer & scene_layer); diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp index fd24593c6b6..00f9f58cd12 100644 --- a/intern/cycles/blender/blender_sync.cpp +++ b/intern/cycles/blender/blender_sync.cpp @@ -269,8 +269,6 @@ void BlenderSync::sync_integrator() SAMPLING_NUM_PATTERNS, SAMPLING_PATTERN_SOBOL); - integrator->layer_flag = render_layer.layer; - integrator->sample_clamp_direct = get_float(cscene, "sample_clamp_direct"); integrator->sample_clamp_indirect = get_float(cscene, "sample_clamp_indirect"); #ifdef __CAMERA_MOTION__ @@ -377,8 +375,7 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D& b_v3d, const char *layer) layer = layername.c_str(); } else { - render_layer.use_localview = (b_v3d.local_view() ? true : false); - render_layer.scene_layer = get_layer(b_v3d.layers(), b_v3d.layers_local_view(), render_layer.use_localview); + render_layer.scene_layer = get_layer(b_v3d.layers(), b_v3d.layers_local_view()); render_layer.layer = render_layer.scene_layer; render_layer.exclude_layer = 0; render_layer.holdout_layer = 0; @@ -421,7 +418,6 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D& b_v3d, const char *layer) render_layer.use_surfaces = b_rlay->use_solid(); render_layer.use_hair = b_rlay->use_strand(); render_layer.use_viewport_visibility = false; - render_layer.use_localview = false; render_layer.bound_samples = (use_layer_samples == 1); if(use_layer_samples != 2) { diff --git a/intern/cycles/blender/blender_sync.h b/intern/cycles/blender/blender_sync.h index e7062d1322a..d690adb5662 100644 --- a/intern/cycles/blender/blender_sync.h +++ b/intern/cycles/blender/blender_sync.h @@ -185,7 +185,6 @@ private: use_surfaces(true), use_hair(true), use_viewport_visibility(false), - use_localview(false), samples(0), bound_samples(false) {} @@ -200,7 +199,6 @@ private: bool use_surfaces; bool use_hair; bool use_viewport_visibility; - bool use_localview; int samples; bool bound_samples; } render_layer; diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h index d856982fddb..e23d8bf4e2d 100644 --- a/intern/cycles/blender/blender_util.h +++ b/intern/cycles/blender/blender_util.h @@ -275,7 +275,6 @@ static inline uint get_layer(const BL::Array<int, 20>& array) static inline uint get_layer(const BL::Array<int, 20>& array, const BL::Array<int, 8>& local_array, - bool use_local, bool is_light = false, uint scene_layers = (1 << 20) - 1) { @@ -300,13 +299,6 @@ static inline uint get_layer(const BL::Array<int, 20>& array, layer |= (1 << (20+i)); } - /* we don't have spare bits for localview (normally 20-28) because - * PATH_RAY_LAYER_SHIFT uses 20-32. So - check if we have localview and if - * so, shift local view bits down to 1-8, since this is done for the view - * port only - it should be OK and not conflict with render layers. */ - if(use_local) - layer >>= 20; - return layer; } diff --git a/intern/cycles/kernel/kernel_path_state.h b/intern/cycles/kernel/kernel_path_state.h index 540f289eae0..ef3765f7d89 100644 --- a/intern/cycles/kernel/kernel_path_state.h +++ b/intern/cycles/kernel/kernel_path_state.h @@ -131,9 +131,6 @@ ccl_device_inline uint path_state_ray_visibility(KernelGlobals *kg, PathState *s /* todo: this is not supported as its own ray visibility yet */ if(state->flag & PATH_RAY_VOLUME_SCATTER) flag |= PATH_RAY_DIFFUSE; - /* for camera visibility, use render layer flags */ - if(flag & PATH_RAY_CAMERA) - flag |= kernel_data.integrator.layer_flag; return flag; } diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index cc261ed37f8..ba50d180acf 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -276,10 +276,7 @@ enum SamplingPattern { SAMPLING_NUM_PATTERNS, }; -/* these flags values correspond to raytypes in osl.cpp, so keep them in sync! - * - * for ray visibility tests in BVH traversal, the upper 20 bits are used for - * layer visibility tests. */ +/* these flags values correspond to raytypes in osl.cpp, so keep them in sync! */ enum PathRayFlag { PATH_RAY_CAMERA = 1, @@ -303,9 +300,6 @@ enum PathRayFlag { PATH_RAY_MIS_SKIP = 2048, PATH_RAY_DIFFUSE_ANCESTOR = 4096, PATH_RAY_SINGLE_PASS_DONE = 8192, - - /* we need layer member flags to be the 20 upper bits */ - PATH_RAY_LAYER_SHIFT = (32-20) }; /* Closure Label */ @@ -1081,9 +1075,6 @@ typedef struct KernelIntegrator { /* seed */ int seed; - /* render layer */ - int layer_flag; - /* clamp */ float sample_clamp_direct; float sample_clamp_indirect; diff --git a/intern/cycles/kernel/kernel_volume.h b/intern/cycles/kernel/kernel_volume.h index 0af5ff50619..30a978f6c9e 100644 --- a/intern/cycles/kernel/kernel_volume.h +++ b/intern/cycles/kernel/kernel_volume.h @@ -1026,14 +1026,13 @@ ccl_device void kernel_volume_stack_init(KernelGlobals *kg, int stack_index = 0, enclosed_index = 0; - const uint visibility = PATH_RAY_ALL_VISIBILITY | kernel_data.integrator.layer_flag; #ifdef __VOLUME_RECORD_ALL__ Intersection hits[2*VOLUME_STACK_SIZE]; uint num_hits = scene_intersect_volume_all(kg, &volume_ray, hits, 2*VOLUME_STACK_SIZE, - visibility); + PATH_RAY_ALL_VISIBILITY); if(num_hits > 0) { int enclosed_volumes[VOLUME_STACK_SIZE]; Intersection *isect = hits; @@ -1083,7 +1082,7 @@ ccl_device void kernel_volume_stack_init(KernelGlobals *kg, step < 2 * VOLUME_STACK_SIZE) { Intersection isect; - if(!scene_intersect_volume(kg, &volume_ray, &isect, visibility)) { + if(!scene_intersect_volume(kg, &volume_ray, &isect, PATH_RAY_ALL_VISIBILITY)) { break; } diff --git a/intern/cycles/render/integrator.cpp b/intern/cycles/render/integrator.cpp index a136e9ad76b..41e2571dc24 100644 --- a/intern/cycles/render/integrator.cpp +++ b/intern/cycles/render/integrator.cpp @@ -50,7 +50,6 @@ NODE_DEFINE(Integrator) SOCKET_BOOLEAN(caustics_refractive, "Refractive Caustics", true); SOCKET_FLOAT(filter_glossy, "Filter Glossy", 0.0f); SOCKET_INT(seed, "Seed", 0); - SOCKET_INT(layer_flag, "Layer Flag", ~0); SOCKET_FLOAT(sample_clamp_direct, "Sample Clamp Direct", 0.0f); SOCKET_FLOAT(sample_clamp_indirect, "Sample Clamp Indirect", 0.0f); SOCKET_BOOLEAN(motion_blur, "Motion Blur", false); @@ -137,7 +136,6 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene kintegrator->filter_glossy = (filter_glossy == 0.0f)? FLT_MAX: 1.0f/filter_glossy; kintegrator->seed = hash_int(seed); - kintegrator->layer_flag = layer_flag << PATH_RAY_LAYER_SHIFT; kintegrator->use_ambient_occlusion = ((Pass::contains(scene->film->passes, PASS_AO)) || dscene->data.background.ao_factor != 0.0f); diff --git a/intern/cycles/render/integrator.h b/intern/cycles/render/integrator.h index 7d2cda3e116..a5cfb0c7863 100644 --- a/intern/cycles/render/integrator.h +++ b/intern/cycles/render/integrator.h @@ -51,7 +51,6 @@ public: float filter_glossy; int seed; - int layer_flag; float sample_clamp_direct; float sample_clamp_indirect; |