Autodesk: Add more strict check when using texture prim path as hash #3523
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Change(s)
If a scene have multiple texture prims with same names, e.g., there're lots of texture prim named as /full_color_texture in the ALab scene (link), when different USD prims with materials refer to its own /full_color_texture are put together into the scene, and the problem happens when we do "texture off" and "texture on" mode switch on the scene:
When switch to "texture off" mode, we dirty the scene by disconnect texture inputs nodes of all materials via
HdDataSourceMaterialNetworkInterface::DeleteNodeInputConnection()
, then some prims might be drawn in a batch now as the texture inputs are disconnected.When we switch to "texture on" mode by reconnect texture inputs nodes of all materials, then in
HdStMaterial::Sync(...)
, the previous batched draw prims are still not broken as now the texture prim path are all /full_color_texture, which produces same hash code due to that perf optimization code, and the drawing result is incorrect as those prims are actually referring to different texture files.To fix is, when _isInitialized is true, adding another check on that TextureDescriptor to see if the texture's prim path is changed or not, if yes, do not use texture prim path as hash.
Link to proposal (if applicable)
Fixes Issue(s)
Checklist
I have created this PR based on the dev branch
I have followed the coding conventions
I have added unit tests that exercise this functionality (Reference:
testing guidelines)
I have verified that all unit tests pass with the proposed changes
I have submitted a signed Contributor License Agreement (Reference:
Contributor License Agreement instructions)