diff options
Diffstat (limited to 'intern/cycles/render/object.h')
-rw-r--r-- | intern/cycles/render/object.h | 60 |
1 files changed, 59 insertions, 1 deletions
diff --git a/intern/cycles/render/object.h b/intern/cycles/render/object.h index 379d1748cdd..c2a79ca8dc4 100644 --- a/intern/cycles/render/object.h +++ b/intern/cycles/render/object.h @@ -17,9 +17,12 @@ #ifndef __OBJECT_H__ #define __OBJECT_H__ +#include "scene.h" + #include "util_boundbox.h" #include "util_param.h" #include "util_transform.h" +#include "util_thread.h" #include "util_types.h" CCL_NAMESPACE_BEGIN @@ -76,7 +79,12 @@ public: ~ObjectManager(); void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress); - void device_update_transforms(Device *device, DeviceScene *dscene, Scene *scene, uint *object_flag, Progress& progress); + void device_update_transforms(Device *device, + DeviceScene *dscene, + Scene *scene, + uint *object_flag, + Progress& progress); + void device_update_flags(Device *device, DeviceScene *dscene, Scene *scene, @@ -87,6 +95,56 @@ public: void tag_update(Scene *scene); void apply_static_transforms(DeviceScene *dscene, Scene *scene, uint *object_flag, Progress& progress); + +protected: + /* Global state of object transform update. */ + struct UpdateObejctTransformState { + /* Global state used by device_update_object_transform(). + * Common for both threaded and non-threaded update. + */ + + /* Type of the motion required by the scene settings. */ + Scene::MotionType need_motion; + + /* Mapping from particle system to a index in packed particle array. + * Only used for read. + */ + map<ParticleSystem*, int> particle_offset; + + /* Mesh area. + * Used to avoid calculation of mesh area multiple times. Used for both + * read and write. Acquire surface_area_lock to keep it all thread safe. + */ + map<Mesh*, float> surface_area_map; + + /* Packed object arrays. Those will be filled in. */ + uint *object_flag; + float4 *objects; + float4 *objects_vector; + + /* Flags which will be synchronized to Integrator. */ + bool have_motion; + bool have_curves; + + /* ** Scheduling queue. ** */ + + Scene *scene; + + /* Some locks to keep everything thread-safe. */ + thread_spin_lock queue_lock; + thread_spin_lock surface_area_lock; + + /* First unused object index in the queue. */ + int queue_start_object; + }; + void device_update_object_transform(UpdateObejctTransformState *state, + Object *ob, + const int object_index); + void device_update_object_transform_task(UpdateObejctTransformState *state); + bool device_update_object_transform_pop_work( + UpdateObejctTransformState *state, + int *start_index, + int *num_objects); }; CCL_NAMESPACE_END |