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

Flush all resource caches on exit #2529

Merged
merged 2 commits into from
Aug 22, 2022
Merged

Conversation

JGamache-autodesk
Copy link
Collaborator

This makes sure textures and shaders are freed before VP2 shuts down.

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;
Copy link
Collaborator Author

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.

seando-adsk
seando-adsk previously approved these changes Aug 5, 2022
@seando-adsk seando-adsk added the vp2renderdelegate Related to VP2RenderDelegate label Aug 5, 2022
if (!_IsDisabledAsyncTextureLoading() && !_localTextureMap.empty()) {
std::mutex removalTaskMutex;
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

@JGamache-autodesk JGamache-autodesk added the ready-for-merge Development process is finished, PR is ready for merge label Aug 5, 2022
@seando-adsk seando-adsk merged commit a6f0b8d into dev Aug 22, 2022
@seando-adsk seando-adsk deleted the t_gamaj/fix_assert_on_maya_exit branch August 22, 2022 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge Development process is finished, PR is ready for merge vp2renderdelegate Related to VP2RenderDelegate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants