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

Open
wants to merge 2 commits into
base: main
Choose a base branch
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.

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