-
Notifications
You must be signed in to change notification settings - Fork 201
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
Reuse shader effect for duplicate material networks. #950
Reuse shader effect for duplicate material networks. #950
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will indeed save a lot of shader recompilations. Thanks!
13990c2
to
59ac9e6
Compare
I have to rebase the branch so that it can compiled with latest UFE code. Aside from that, the new commit 59ac9e6 is to address the change proposed by @JGamache-autodesk . |
@kxl-adsk Please merge. |
Reasons why I commit this change: * HdSceneDelegate::GetScenePrimPath() is not available on old USD versions. * Even if it is available in new USD versions, it is bad to query the scene scene paths in the render delegate code (which should only care about the render index paths). * The new approach calculates concise relative paths which not only avoids ambiguity but only allows better reuse of shader effects, e.g. the following two material networks will be able to share a shader effect: - file1/UVReader -> file1 -> surface1 - UVReader -> file1 -> surface1
Another commit for this PR: 528f2c1. Click the commit link to see the reasons please. |
@@ -482,7 +503,7 @@ _LoadTexture(const std::string& path, bool& isColorSpaceSRGB, MFloatArray& uvSca | |||
#if USD_VERSION_NUM >= 2102 | |||
HioImageSharedPtr image = HioImage::OpenForReading(path); | |||
#else | |||
GlfImageSharedPtr image = GlfImage::OpenForReading(path); | |||
GlfImageSharedPtr image = GlfImage::OpenForReading(path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kxl-adsk Any idea why github clang-format-linter doesn't like this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is one more mysterious mystery about clang format. I will revert this change anyway so we don't have to wait on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've logged the problem in the wiki.
Implemented a shader instance cache to allow reuse of shader effect for duplicate material networks.