76 ccl::Film::add_default(
this);
77 ccl::ShaderManager::add_default(
this);
175 bool kernels_reloaded =
false;
184 update_stats->scene.times.add_entry({
"device_update", time});
195 if (
film->update_lightgroups(
this)) {
196 light_manager->tag_update(
this, ccl::LightManager::LIGHT_MODIFIED);
197 object_manager->tag_update(
this, ccl::ObjectManager::OBJECT_MODIFIED);
200 if (
film->exposure_is_modified()) {
205 progress.set_status(
"Updating Shaders");
214 film->update_passes(
this);
228 const uint kernel_features =
dscene.data.kernel_features;
259 progress.set_status(
"Updating Background");
267 progress.set_status(
"Updating Camera");
280 progress.set_status(
"Updating Objects");
287 progress.set_status(
"Updating Particle Systems");
295 progress.set_status(
"Updating Meshes");
303 progress.set_status(
"Updating Objects Flags");
311 progress.set_status(
"Updating Primitive Offsets");
320 progress.set_status(
"Updating Images");
327 progress.set_status(
"Updating Camera Volume");
334 progress.set_status(
"Updating Lookup Tables");
342 progress.set_status(
"Updating Lights");
349 progress.set_status(
"Updating Integrator");
356 progress.set_status(
"Updating Film");
364 progress.set_status(
"Updating Lookup Tables");
371 progress.set_status(
"Updating Baking");
378 if (
device->have_error() ==
false) {
381 progress.set_status(
"Updating Device",
"Writing constant memory");
385 device->optimize_for_scene(
this);
391 VLOG_INFO <<
"System memory statistics after full device sync:\n"
415 return camera->get_shuttertime();
475 film->tag_modified();
524 bool has_caustics_receiver =
false;
525 bool has_caustics_caster =
false;
526 bool has_caustics_light =
false;
529 if (object->get_is_caustics_caster()) {
530 has_caustics_caster =
true;
532 else if (object->get_is_caustics_receiver()) {
533 has_caustics_receiver =
true;
535 Geometry *geom =
object->get_geometry();
537 if (object->use_motion() || geom->get_use_motion_blur()) {
541 if (object->get_is_shadow_catcher() && !geom->
is_light()) {
551 const Light *light =
static_cast<const Light *
>(
object->get_geometry());
552 if (light->get_use_caustics()) {
553 has_caustics_light =
true;
556 if (object->has_light_linking()) {
559 if (object->has_shadow_linking()) {
564 dscene.data.integrator.use_caustics =
false;
565 if (
device->info.has_mnee && has_caustics_caster && has_caustics_receiver && has_caustics_light)
567 dscene.data.integrator.use_caustics =
true;
579 kernel_features |=
film->get_kernel_features(
this);
580 kernel_features |=
integrator->get_kernel_features();
581 kernel_features |=
camera->get_kernel_features();
583 dscene.data.kernel_features = kernel_features;
588 dscene.data.max_closures = max_closures;
599 progress.set_status(
"Updating Scene");
607 if (!
camera->set_screen_size(width, height)) {
613 progress.set_status(
"Updating Device",
"Writing constant memory");
650 progress.set_status(
"Loading render kernels (may take a few minutes the first time)");
654 const uint kernel_features =
dscene.data.kernel_features;
656 if (!
device->load_kernels(kernel_features)) {
657 string message =
device->error_message();
658 if (message.empty()) {
659 message =
"Failed loading render kernel, see console for errors";
681 int max_closures = 0;
685 const int num_closures = shader->
graph->get_num_closures();
686 max_closures =
max(max_closures, num_closures);
707 int volume_stack_size = 0;
714 volume_stack_size += 2;
718 bool has_volume_object =
false;
720 if (!object->get_geometry()->has_volume) {
724 if (object->intersects_volume) {
733 else if (!has_volume_object) {
738 has_volume_object =
true;
747 VLOG_WORK <<
"Detected required volume stack size " << volume_stack_size;
749 return volume_stack_size;
760 if (object->get_is_shadow_catcher() && !object->get_geometry()->is_light()) {
780 Light *node_ptr = node.get();
781 node->set_owner(
this);
782 geometry.push_back(std::move(node));
790 Mesh *node_ptr = node.get();
791 node->set_owner(
this);
792 geometry.push_back(std::move(node));
800 Hair *node_ptr = node.get();
801 node->set_owner(
this);
802 geometry.push_back(std::move(node));
810 Volume *node_ptr = node.get();
811 node->set_owner(
this);
812 geometry.push_back(std::move(node));
821 node->set_owner(
this);
822 geometry.push_back(std::move(node));
830 Object *node_ptr = node.get();
831 node->set_owner(
this);
832 objects.push_back(std::move(node));
841 node->set_owner(
this);
850 Shader *node_ptr = node.get();
851 node->set_owner(
this);
852 shaders.push_back(std::move(node));
861 AlembicProcedural *node_ptr = node.get();
862 node->set_owner(
this);
874 Pass *node_ptr = node.get();
875 node->set_owner(
this);
876 passes.push_back(std::move(node));
877 film->tag_modified();
884 Camera *node_ptr = node.get();
885 node->set_owner(
this);
886 cameras.push_back(std::move(node));
894 node->set_owner(
this);
903 node->set_owner(
this);
911 Film *node_ptr = node.get();
912 node->set_owner(
this);
913 films.push_back(std::move(node));
1008 passes.erase_by_swap(node);
1009 film->tag_modified();
1018 for (
const T *node : nodes) {
1019 assert(node->get_owner() == owner);
1049 for (
Shader *shader : nodes) {
1050 shader->clear_reference_count();
1064 passes.erase_in_set(nodes);
1065 film->tag_modified();
bool is_pointcloud() const
static bool contains(const unique_ptr_vector< Pass > &passes, PassType type)
static unique_ptr< ShaderManager > create(const int shadingsystem)
static void add_default(Scene *scene)
NODE_DECLARE unique_ptr< ShaderGraph > graph
#define KERNEL_FEATURE_VOLUME
#define MAX_VOLUME_STACK_SIZE
#define KERNEL_FEATURE_SHADOW_CATCHER
#define KERNEL_FEATURE_OBJECT_MOTION
#define KERNEL_FEATURE_PATH_GUIDING
#define KERNEL_FEATURE_TRANSPARENT
#define KERNEL_FEATURE_SUBSURFACE
#define KERNEL_FEATURE_NODE_BSDF
#define KERNEL_FEATURE_HAIR_THICK
#define KERNEL_FEATURE_NODE_VORONOI_EXTRA
#define KERNEL_FEATURE_NODE_VOLUME
#define KERNEL_FEATURE_PATH_TRACING
#define KERNEL_FEATURE_SHADOW_LINKING
#define KERNEL_FEATURE_DENOISING
#define KERNEL_FEATURE_LIGHT_LINKING
#define KERNEL_FEATURE_HAIR
#define KERNEL_FEATURE_NODE_RAYTRACE
#define KERNEL_FEATURE_BAKING
#define KERNEL_FEATURE_MNEE
#define KERNEL_FEATURE_POINTCLOUD
#define KERNEL_FEATURE_NODE_EMISSION
#define KERNEL_FEATURE_NODE_BUMP
#define CCL_NAMESPACE_END
#define assert(assertion)
#define MEM_GUARDED_CALL(progress, func,...)
size_t util_guarded_get_mem_used()
size_t util_guarded_get_mem_peak()
@ ATTR_STD_MOTION_VERTEX_NORMAL
@ ATTR_STD_VOLUME_VELOCITY_Y
@ ATTR_STD_VOLUME_VELOCITY_Z
@ ATTR_STD_VOLUME_VELOCITY
@ ATTR_STD_MOTION_VERTEX_POSITION
@ ATTR_STD_VOLUME_VELOCITY_X
static void assert_same_owner(const set< T * > &nodes, const NodeOwner *owner)
static void log_kernel_features(const uint features)
string string_from_bool(bool var)
string string_human_readable_size(size_t size)
string string_human_readable_number(size_t num)
int reference_count() const
const NodeOwner * get_owner() const
void clear_reference_count()
unique_ptr_vector< Procedural > procedurals
unique_ptr< ObjectManager > object_manager
bool need_global_attribute(AttributeStandard std)
MotionType need_motion() const
void need_global_attributes(AttributeRequestSet &attributes)
bool update(Progress &progress)
unique_ptr< LightManager > light_manager
unique_ptr< ParticleSystemManager > particle_system_manager
int get_max_closure_count()
bool scene_updated_while_loading_kernels
unique_ptr_vector< Geometry > geometry
unique_ptr< SceneUpdateStats > update_stats
void tag_shadow_catcher_modified()
void free_memory(bool final)
unique_ptr_vector< Camera > cameras
unique_ptr_vector< Background > backgrounds
void enable_update_stats()
Shader * default_background
uint loaded_kernel_features
unique_ptr< BakeManager > bake_manager
bool shadow_catcher_modified_
unique_ptr_vector< Shader > shaders
void update_kernel_features()
unique_ptr< ShaderManager > shader_manager
void delete_nodes(const set< T * > &nodes)
unique_ptr_vector< ParticleSystem > particle_systems
bool has_shadow_catcher()
unique_ptr< GeometryManager > geometry_manager
void delete_node(T *node)=delete
unique_ptr< OSLManager > osl_manager
unique_ptr_vector< Integrator > integrators
bool load_kernels(Progress &progress)
unique_ptr_vector< Object > objects
int get_volume_stack_size() const
unique_ptr< ImageManager > image_manager
unique_ptr< ProceduralManager > procedural_manager
bool need_reset(const bool check_camera=true)
bool update_camera_resolution(Progress &progress, int width, int height)
void collect_statistics(RenderStats *stats)
unique_ptr_vector< Pass > passes
unique_ptr_vector< Film > films
float motion_shutter_time()
unique_ptr< LookupTables > lookup_tables
void device_update(Device *device, Progress &progress)