Cleanup: Unused device argument in host update functions

Better not to tempt anyone from using unsafe access to device
functionality during host update.
This commit is contained in:
Sergey Sharybin
2021-10-19 11:13:26 +02:00
parent 6e859f7ff8
commit d6b54068d4
8 changed files with 12 additions and 14 deletions

View File

@@ -91,7 +91,7 @@ void OSLShaderManager::reset(Scene * /*scene*/)
shading_system_init(); shading_system_init();
} }
void OSLShaderManager::host_update_specific(Device * /*device*/, Scene *scene, Progress &progress) void OSLShaderManager::host_update_specific(Scene *scene, Progress &progress)
{ {
if (!need_update()) { if (!need_update()) {
return; return;

View File

@@ -79,7 +79,7 @@ class OSLShaderManager : public ShaderManager {
return true; return true;
} }
void host_update_specific(Device *device, Scene *scene, Progress &progress) override; void host_update_specific(Scene *scene, Progress &progress) override;
void device_update_specific(Device *device, void device_update_specific(Device *device,
DeviceScene *dscene, DeviceScene *dscene,

View File

@@ -228,7 +228,7 @@ void Scene::free_memory(bool final)
} }
} }
void Scene::host_update(Device *device, Progress &progress) void Scene::host_update(Progress &progress)
{ {
if (update_stats) { if (update_stats) {
update_stats->clear(); update_stats->clear();
@@ -241,7 +241,7 @@ void Scene::host_update(Device *device, Progress &progress)
}); });
progress.set_status("Updating Shaders"); progress.set_status("Updating Shaders");
shader_manager->host_update(device, this, progress); shader_manager->host_update(this, progress);
} }
void Scene::device_update(Device *device_, Progress &progress) void Scene::device_update(Device *device_, Progress &progress)
@@ -552,7 +552,7 @@ bool Scene::update(Progress &progress)
/* Update scene data on the host side. /* Update scene data on the host side.
* Only updates which do not depend on the kernel (including kernel features). */ * Only updates which do not depend on the kernel (including kernel features). */
progress.set_status("Updating Scene"); progress.set_status("Updating Scene");
MEM_GUARDED_CALL(&progress, host_update, device, progress); MEM_GUARDED_CALL(&progress, host_update, progress);
/* Load render kernels. After host scene update so that the required kernel features are known. /* Load render kernels. After host scene update so that the required kernel features are known.
*/ */

View File

@@ -251,9 +251,7 @@ class Scene : public NodeOwner {
Scene(const SceneParams &params, Device *device); Scene(const SceneParams &params, Device *device);
~Scene(); ~Scene();
/* NOTE: Device can only use used to access invariant data. For example, OSL globals is valid void host_update(Progress &progress);
* but anything what is related on kernel and kernel features is not. */
void host_update(Device *device, Progress &progress);
void device_update(Device *device, Progress &progress); void device_update(Device *device, Progress &progress);

View File

@@ -462,7 +462,7 @@ int ShaderManager::get_shader_id(Shader *shader, bool smooth)
return id; return id;
} }
void ShaderManager::host_update(Device *device, Scene *scene, Progress &progress) void ShaderManager::host_update(Scene *scene, Progress &progress)
{ {
if (!need_update()) { if (!need_update()) {
return; return;
@@ -480,7 +480,7 @@ void ShaderManager::host_update(Device *device, Scene *scene, Progress &progress
assert(scene->default_background->reference_count() != 0); assert(scene->default_background->reference_count() != 0);
assert(scene->default_empty->reference_count() != 0); assert(scene->default_empty->reference_count() != 0);
host_update_specific(device, scene, progress); host_update_specific(scene, progress);
} }
void ShaderManager::device_update(Device *device, void ShaderManager::device_update(Device *device,

View File

@@ -193,8 +193,8 @@ class ShaderManager {
return false; return false;
} }
void host_update(Device *device, Scene *scene, Progress &progress); void host_update(Scene *scene, Progress &progress);
virtual void host_update_specific(Device *device, Scene *scene, Progress &progress) = 0; virtual void host_update_specific(Scene *scene, Progress &progress) = 0;
/* device update */ /* device update */
void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress &progress); void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress &progress);

View File

@@ -69,7 +69,7 @@ static void host_compile_shader(Scene *scene,
<< summary.full_report(); << summary.full_report();
} }
void SVMShaderManager::host_update_specific(Device * /*device*/, Scene *scene, Progress &progress) void SVMShaderManager::host_update_specific(Scene *scene, Progress &progress)
{ {
if (!need_update()) { if (!need_update()) {
return; return;

View File

@@ -46,7 +46,7 @@ class SVMShaderManager : public ShaderManager {
void reset(Scene *scene) override; void reset(Scene *scene) override;
void host_update_specific(Device *device, Scene *scene, Progress &progress) override; void host_update_specific(Scene *scene, Progress &progress) override;
void device_update_specific(Device *device, void device_update_specific(Device *device,
DeviceScene *dscene, DeviceScene *dscene,