-
Notifications
You must be signed in to change notification settings - Fork 202
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
Flush all resource caches on exit #2529
Conversation
This makes sure textures and shaders are freed before VP2 shuts down.
// If the textures would have been requested to reload in `ApplyPendingUpdates()`, | ||
// we could still reuse the loaded one from cache, otherwise the idle task can | ||
// safely release the texture. | ||
std::unordered_set<HdVP2TextureInfoSharedPtr> pendingRemovalTextures; |
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.
Moved from the destructor so it can be accessed by OnMayaExit.
if (!_IsDisabledAsyncTextureLoading() && !_localTextureMap.empty()) { | ||
std::mutex removalTaskMutex; |
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 thought that this mutex needs to be static so that all HdVP2Material will share the same mutex? With this version of the code the lock_guard does nothing and we could have unsafe parallel modification of pendingRemovalTextures.
Can we go back to the original changes and see if we can figure out the workflow that requires the lock?
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.
Agreed. The mutex and the structure it protects should ideally be kept together.
This makes sure textures and shaders are freed before VP2 shuts down.