Merge branch 'blender-v3.4-release'

This commit is contained in:
Sergey Sharybin 2022-11-23 10:36:11 +01:00
commit 5938e97a24
3 changed files with 16 additions and 10 deletions

View File

@ -485,6 +485,8 @@ void Scene::update_kernel_features()
return;
}
thread_scoped_lock scene_lock(mutex);
/* These features are not being tweaked as often as shaders,
* so could be done selective magic for the viewport as well. */
uint kernel_features = shader_manager->get_kernel_features(this);
@ -571,9 +573,6 @@ bool Scene::update(Progress &progress)
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. */
progress.set_status("Updating Scene");
MEM_GUARDED_CALL(&progress, device_update, device, progress);
@ -613,13 +612,8 @@ static void log_kernel_features(const uint features)
<< "\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();
const uint kernel_features = dscene.data.kernel_features;

View File

@ -270,6 +270,7 @@ class Scene : public NodeOwner {
void enable_update_stats();
bool load_kernels(Progress &progress);
bool update(Progress &progress);
bool has_shadow_catcher();
@ -333,7 +334,6 @@ class Scene : public NodeOwner {
uint loaded_kernel_features;
void update_kernel_features();
bool load_kernels(Progress &progress, bool lock_scene = true);
bool has_shadow_catcher_ = false;
bool shadow_catcher_modified_ = true;

View File

@ -378,6 +378,18 @@ RenderWork Session::run_update_for_next_iteration()
const int width = max(1, buffer_params_.full_width / resolution);
const int height = max(1, buffer_params_.full_height / resolution);
{
/* Load render kernels, before device update where we upload data to the GPU.
* Do it outside of the scene mutex since the heavy part of the loading (i.e. kernel
* compilation) does not depend on the scene and some other functionality (like display
* driver) might be waiting on the scene mutex to synchronize display pass.
*
* The scene will lock itself for the short period if it needs to update kernel features. */
scene_lock.unlock();
scene->load_kernels(progress);
scene_lock.lock();
}
if (update_scene(width, height)) {
profiler.reset(scene->shaders.size(), scene->objects.size());
}