diff options
author | Patrick Mours <pmours@nvidia.com> | 2022-09-09 12:55:35 +0300 |
---|---|---|
committer | Patrick Mours <pmours@nvidia.com> | 2022-09-09 16:35:44 +0300 |
commit | ef7c9e793ec5331ac694eec9336565bd2254c406 (patch) | |
tree | ca30908bae0bac8c58d18b964af7dc388f9de463 /intern/cycles/scene/osl.cpp | |
parent | 291c313f80b4cccc8fcce3035584caeaa654844f (diff) |
Cycles: Remove separate OSL attribute map and instead always use SVM attribute map
The SVM attribute map is always generated and uses a simple
linear search to lookup by an opaque ID, so can reuse that for OSL
as well and simply use the attribute name hash as ID instead of
generating a unique value separately. This works for both object
and geometry attributes since the SVM attribute map already
stores both. Simplifies code somewhat and reduces memory
usage slightly.
This patch was split from D15902.
Differential Revision: https://developer.blender.org/D15918
Diffstat (limited to 'intern/cycles/scene/osl.cpp')
-rw-r--r-- | intern/cycles/scene/osl.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/intern/cycles/scene/osl.cpp b/intern/cycles/scene/osl.cpp index f5ee0c0f1d3..7c8d9bcd3e2 100644 --- a/intern/cycles/scene/osl.cpp +++ b/intern/cycles/scene/osl.cpp @@ -78,6 +78,18 @@ void OSLShaderManager::reset(Scene * /*scene*/) shading_system_init(); } +uint64_t OSLShaderManager::get_attribute_id(ustring name) +{ + return name.hash(); +} + +uint64_t OSLShaderManager::get_attribute_id(AttributeStandard std) +{ + /* if standard attribute, use geom: name convention */ + ustring stdname(string("geom:") + string(Attribute::standard_name(std))); + return stdname.hash(); +} + void OSLShaderManager::device_update_specific(Device *device, DeviceScene *dscene, Scene *scene, |