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

igl | opengl | Fix memory leak in RenderPipelineState::activeAttributesLocations_ #187

Closed
wants to merge 4 commits into from

Conversation

vinsentli
Copy link
Contributor

When a RenderCommandEncoder sequentially binds two IRenderPipelineStates, if both of these states have the same VertexInputState, the previous IRenderPipelineState is unable to execute unbindVertexAttributes(). As a result, the activeAttributesLocations_ of the previous RenderPipelineState remains in a continuous state of memory growth and cannot be released.

@facebook-github-bot
Copy link
Contributor

@corporateshark has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@EricGriffith
Copy link

This PR fixes a memory leak, but it may cause some perf overhead if things are unbound and then immediately rebound. Is there a way to fix the memory leak without the perf overhead?

…or the new draw call, only disable the attribute locations that are not needed. This way, the number of glEnable/glDisableVertexAttribArray calls can be reduced.
@vinsentli
Copy link
Contributor Author

@EricGriffith
My solution is to save the activeAttributesLocations_ of the previous pipeline state, for the new draw call, only disable the attribute locations that are not needed. This way, the number of glEnable/glDisableVertexAttribArray calls can be reduced.

@facebook-github-bot
Copy link
Contributor

@corporateshark has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@vinsentli
Copy link
Contributor Author

@corporateshark This PR has opened for a long time ,is there any problem with it ?

@corporateshark
Copy link
Contributor

This PR has opened for a long time ,is there any problem with it ?

@vinsentli Thank you for following up! We’re still conducting some internal testing. Rest assured, as long as this PR remains open, someone on the team will review it at some point.

@vinsentli
Copy link
Contributor Author

@corporateshark Thanks for your reply.

Copy link
Contributor

@corporateshark corporateshark left a comment

Choose a reason for hiding this comment

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

Please rebase this on top of the latest main branch.

src/igl/opengl/RenderCommandAdapter.cpp Outdated Show resolved Hide resolved
@vinsentli
Copy link
Contributor Author

Please rebase this on top of the latest main branch.

done

@facebook-github-bot
Copy link
Contributor

@corporateshark has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@corporateshark merged this pull request in 3a61b4e.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants