Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve material network creation times by caching the nodes returned by Arnold #1813

Merged
merged 4 commits into from
Jan 18, 2024

Conversation

cpichard
Copy link
Collaborator

Changes proposed in this pull request

  • The functions AiMaterialXGetNodeEntryFromDefinition and AiMaterialXGetOslShaderCode are costly and we called them for every shader prim. The easiest solution is to cache the returned node entry associated to a particular shader type. We do the same for the osl code.

Issues fixed in this pull request
Fixes #1812

@cpichard cpichard marked this pull request as ready for review January 16, 2024 14:22
Copy link
Collaborator

@sebastienblor sebastienblor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid this is not thread-safe. This function can be called simultaneously by different threads to translate different shading trees

@cpichard
Copy link
Collaborator Author

even worse, it seems that some cached memory becomes invalid when the render delegate is destroyed and recreated. We can't reliably use static variables.

@cpichard cpichard merged commit 61b55a8 into Autodesk:fix-7.2.5 Jan 18, 2024
9 checks passed
cpichard added a commit that referenced this pull request Jan 25, 2024
* Update tests after arnold changes on curves (#1766)

(cherry picked from commit 2fcc262)

* Fix the incorrect orientation of the PointInstancer instances in the render delegate (#1777)

* add test for #1776

* Initialize the rotation matrix with the quad directly

* update changelog for #1776

* Fix changelog for 7.2.5 release (#1788)

* More changelog fixes

* handle vertex interpolated uvs on bspline curves (#1792)

* FIx the error "Cannot load _htoa_pygeo library required for volume rendering in Solaris" (#1811)

* Improve material network creation times by caching the nodes returned by Arnold (#1813)

* Improve material network creation by caching the nodes returned by arnold

* optimize further by first checking if the shader is an arnold shader

* move shader node entry and osl code cache in the render delegate and use lock/mutex

* cache materialx nodes only

* Fix build with older versions of arnold (#1820)

* fix build with older versions of arnold

* fix compatibility with older versions of arnold

* convert AtString to string

* allow materialx for versions > 7.1.4

* fix ifdef versions for materialx

* compatibility with older arnold versions

---------

Co-authored-by: Sebastien Blaineau-Ortega <sebastien.blaineau.ortega@autodesk.com>
cpichard added a commit that referenced this pull request Jan 25, 2024
* Update tests after arnold changes on curves (#1766)

(cherry picked from commit 2fcc262)

* Fix the incorrect orientation of the PointInstancer instances in the render delegate (#1777)

* add test for #1776

* Initialize the rotation matrix with the quad directly

* update changelog for #1776

* Fix changelog for 7.2.5 release (#1788)

* More changelog fixes

* handle vertex interpolated uvs on bspline curves (#1792)

* FIx the error "Cannot load _htoa_pygeo library required for volume rendering in Solaris" (#1811)

* Improve material network creation times by caching the nodes returned by Arnold (#1813)

* Improve material network creation by caching the nodes returned by arnold

* optimize further by first checking if the shader is an arnold shader

* move shader node entry and osl code cache in the render delegate and use lock/mutex

* cache materialx nodes only

* Fix build with older versions of arnold (#1820)

* fix build with older versions of arnold

* fix compatibility with older versions of arnold

* convert AtString to string

* allow materialx for versions > 7.1.4

* fix ifdef versions for materialx

* compatibility with older arnold versions

* update changelog for fix-7.2.5.0 (#1827)

* Fix crash happening in maya aiStandin when scrolling the timeline (#1830)

* make the UsdArnoldReaderRegistry non static

* register readers before reading

---------

Co-authored-by: Sebastien Blaineau-Ortega <sebastien.blaineau.ortega@autodesk.com>
sebastienblor added a commit that referenced this pull request Feb 15, 2024
* Update tests after arnold changes on curves (#1766)

(cherry picked from commit 2fcc262)

* Fix the incorrect orientation of the PointInstancer instances in the render delegate (#1777)

* add test for #1776

* Initialize the rotation matrix with the quad directly

* update changelog for #1776

* Fix changelog for 7.2.5 release (#1788)

* More changelog fixes

* handle vertex interpolated uvs on bspline curves (#1792)

* FIx the error "Cannot load _htoa_pygeo library required for volume rendering in Solaris" (#1811)

* Improve material network creation times by caching the nodes returned by Arnold (#1813)

* Improve material network creation by caching the nodes returned by arnold

* optimize further by first checking if the shader is an arnold shader

* move shader node entry and osl code cache in the render delegate and use lock/mutex

* cache materialx nodes only

* Fix build with older versions of arnold (#1820)

* fix build with older versions of arnold

* fix compatibility with older versions of arnold

* convert AtString to string

* allow materialx for versions > 7.1.4

* fix ifdef versions for materialx

* compatibility with older arnold versions

* update changelog for fix-7.2.5.0 (#1827)

* Fix crash happening in maya aiStandin when scrolling the timeline (#1830)

* make the UsdArnoldReaderRegistry non static

* register readers before reading

* Convert the ArnoldProceduralCustom transform matrix to Arnold in the procedural code (#1832)

* read the matrix in the ArnoldProceduralCustom procedural reader

* update test_0739 reference image

* rename unrelease to fix-7.2.5 to follow master convention (#1843)

* Update tests after core changes in fix-7.2.5 (#1849)

* Changed HtoAConvertPrimVdbToArnold symbol lookup from pythonX.Xlibs/_htoa_pygeo lookup to scripts/bin/htoa_geo.dll (#1850)

* update fix-7.2.5 changelog for 7.2.5.2 (#1856)

* update fix-7.2.5 changelog for 7.2.5.2

* correct version

* Fix merge conflict

* Temporarily remove test_0202 from the hydra group

* Fix slowness in the render delegate due to scene update when the camera moves (#1855)

* fix the test of the camera type

* update changelog

* merge and fix changelog

* Remove legacy code

* Fixing changelog

* Fix indentation

---------

Co-authored-by: cpichard <cpichard@users.noreply.github.com>
Co-authored-by: Tom Minor <5022079+TomMinor@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants