Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/scene/scene.cpp
| Show First 20 Lines • Show All 479 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| void Scene::update_kernel_features() | void Scene::update_kernel_features() | ||||
| { | { | ||||
| if (!need_update()) { | if (!need_update()) { | ||||
| return; | return; | ||||
| } | } | ||||
| thread_scoped_lock scene_lock(mutex); | |||||
| /* These features are not being tweaked as often as shaders, | /* These features are not being tweaked as often as shaders, | ||||
| * so could be done selective magic for the viewport as well. */ | * so could be done selective magic for the viewport as well. */ | ||||
| uint kernel_features = shader_manager->get_kernel_features(this); | uint kernel_features = shader_manager->get_kernel_features(this); | ||||
| bool use_motion = need_motion() == Scene::MotionType::MOTION_BLUR; | bool use_motion = need_motion() == Scene::MotionType::MOTION_BLUR; | ||||
| kernel_features |= KERNEL_FEATURE_PATH_TRACING; | kernel_features |= KERNEL_FEATURE_PATH_TRACING; | ||||
| if (params.hair_shape == CURVE_THICK) { | if (params.hair_shape == CURVE_THICK) { | ||||
| kernel_features |= KERNEL_FEATURE_HAIR_THICK; | kernel_features |= KERNEL_FEATURE_HAIR_THICK; | ||||
| ▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| bool Scene::update(Progress &progress) | bool Scene::update(Progress &progress) | ||||
| { | { | ||||
| if (!need_update()) { | if (!need_update()) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| /* Load render kernels, before device update where we upload data to the GPU. */ | |||||
| load_kernels(progress, false); | |||||
| /* Upload scene data to the GPU. */ | /* Upload scene data to the GPU. */ | ||||
| progress.set_status("Updating Scene"); | progress.set_status("Updating Scene"); | ||||
| MEM_GUARDED_CALL(&progress, device_update, device, progress); | MEM_GUARDED_CALL(&progress, device_update, device, progress); | ||||
| return true; | return true; | ||||
| } | } | ||||
| static void log_kernel_features(const uint features) | static void log_kernel_features(const uint features) | ||||
| Show All 23 Lines | static void log_kernel_features(const uint features) | ||||
| VLOG_INFO << "Use Subsurface " << string_from_bool(features & KERNEL_FEATURE_SUBSURFACE) << "\n"; | VLOG_INFO << "Use Subsurface " << string_from_bool(features & KERNEL_FEATURE_SUBSURFACE) << "\n"; | ||||
| VLOG_INFO << "Use Volume " << string_from_bool(features & KERNEL_FEATURE_VOLUME) << "\n"; | VLOG_INFO << "Use Volume " << string_from_bool(features & KERNEL_FEATURE_VOLUME) << "\n"; | ||||
| VLOG_INFO << "Use Patch Evaluation " | VLOG_INFO << "Use Patch Evaluation " | ||||
| << string_from_bool(features & KERNEL_FEATURE_PATCH_EVALUATION) << "\n"; | << string_from_bool(features & KERNEL_FEATURE_PATCH_EVALUATION) << "\n"; | ||||
| VLOG_INFO << "Use Shadow Catcher " << string_from_bool(features & KERNEL_FEATURE_SHADOW_CATCHER) | VLOG_INFO << "Use Shadow Catcher " << string_from_bool(features & KERNEL_FEATURE_SHADOW_CATCHER) | ||||
| << "\n"; | << "\n"; | ||||
| } | } | ||||
| bool Scene::load_kernels(Progress &progress, bool lock_scene) | bool Scene::load_kernels(Progress &progress) | ||||
| { | { | ||||
| thread_scoped_lock scene_lock; | |||||
| if (lock_scene) { | |||||
| scene_lock = thread_scoped_lock(mutex); | |||||
| } | |||||
| update_kernel_features(); | update_kernel_features(); | ||||
| const uint kernel_features = dscene.data.kernel_features; | const uint kernel_features = dscene.data.kernel_features; | ||||
| if (!kernels_loaded || loaded_kernel_features != kernel_features) { | if (!kernels_loaded || loaded_kernel_features != kernel_features) { | ||||
| progress.set_status("Loading render kernels (may take a few minutes the first time)"); | progress.set_status("Loading render kernels (may take a few minutes the first time)"); | ||||
| scoped_timer timer; | scoped_timer timer; | ||||
| ▲ Show 20 Lines • Show All 379 Lines • Show Last 20 Lines | |||||