49 kernels_loaded(
false),
76 ccl::Film::add_default(
this);
77 ccl::ShaderManager::add_default(
this);
175 bool kernels_reloaded =
false;
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()) {
287 progress.
set_status(
"Updating Particle Systems");
303 progress.
set_status(
"Updating Objects Flags");
311 progress.
set_status(
"Updating Primitive Offsets");
327 progress.
set_status(
"Updating Camera Volume");
334 progress.
set_status(
"Updating Lookup Tables");
364 progress.
set_status(
"Updating Lookup Tables");
381 progress.
set_status(
"Updating Device",
"Writing constant memory");
391 VLOG_INFO <<
"System memory statistics after full device sync:\n"
415 return camera->get_shuttertime();
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()) {
565 if (
device->
info.
has_mnee && has_caustics_caster && has_caustics_receiver && has_caustics_light)
581 kernel_features |=
camera->get_kernel_features();
583 dscene.
data.kernel_features = kernel_features;
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)");
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()) {
779 unique_ptr<Light>
node = make_unique<Light>();
789 unique_ptr<Mesh>
node = make_unique<Mesh>();
799 unique_ptr<Hair>
node = make_unique<Hair>();
809 unique_ptr<Volume>
node = make_unique<Volume>();
819 unique_ptr<PointCloud>
node = make_unique<PointCloud>();
829 unique_ptr<Object>
node = make_unique<Object>();
839 unique_ptr<ParticleSystem>
node = make_unique<ParticleSystem>();
849 unique_ptr<Shader>
node = make_unique<Shader>();
860 unique_ptr<AlembicProcedural>
node = make_unique<AlembicProcedural>();
861 AlembicProcedural *node_ptr =
node.get();
862 node->set_owner(
this);
873 unique_ptr<Pass>
node = make_unique<Pass>();
883 unique_ptr<Camera>
node = make_unique<Camera>();
892 unique_ptr<Integrator>
node = make_unique<Integrator>();
901 unique_ptr<Background>
node = make_unique<Background>();
910 unique_ptr<Film>
node = make_unique<Film>();
957 if (
node->is_hair()) {
986 node->clear_reference_count();
1018 for (
const T *
node : nodes) {
1049 for (
Shader *shader : nodes) {
1050 shader->clear_reference_count();
void device_update(Device *device, DeviceScene *dscene, Scene *scene)
void device_free(Device *device, DeviceScene *dscene)
void tag_update(Scene *scene)
virtual void optimize_for_scene(Scene *)
virtual const string & error_message()
virtual void const_copy_to(const char *name, void *host, const size_t size)=0
virtual bool load_kernels(uint)
uint get_kernel_features(const Scene *scene) const
void update_passes(Scene *scene)
void device_free(Device *device, DeviceScene *dscene, Scene *scene)
void device_update(Device *device, DeviceScene *dscene, Scene *scene)
bool update_lightgroups(Scene *scene)
bool is_pointcloud() const
void tag_update(Scene *scene, const uint32_t flag)
void device_update(Device *device, DeviceScene *dscene, Scene *scene)
void device_free(Device *device, DeviceScene *dscene, bool force_free=false)
GuidingParams get_guiding_params(const Device *device) const
uint get_kernel_features() const
static bool contains(const unique_ptr_vector< Pass > &passes, PassType type)
void set_status(const string &status_, const string &substatus_="")
void set_error(const string &error_message_)
CurveShapeType hair_shape
ShadingSystem shadingsystem
static unique_ptr< ShaderManager > create(const int shadingsystem)
static void add_default(Scene *scene)
NODE_DECLARE unique_ptr< ShaderGraph > graph
void push_back(unique_ptr< T > &&value)
void erase_in_set(const set< T * > &values)
void erase_by_swap(const T *value)
#define CCL_NAMESPACE_END
#define assert(assertion)
size_t util_guarded_get_mem_used()
size_t util_guarded_get_mem_peak()
#define MEM_GUARDED_CALL(progress, func,...)
#define KERNEL_FEATURE_VOLUME
#define MAX_VOLUME_STACK_SIZE
#define KERNEL_FEATURE_SHADOW_CATCHER
#define KERNEL_FEATURE_OBJECT_MOTION
@ 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
#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
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
void set_owner(const NodeOwner *owner_)
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()
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)