remove unnecessary glUseProgram(0) #5944
Merged
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.
Unbinding a shader program is not necessary, it was useful to enable the old fixed-function pipeline which libgdx don't use.
ShaderProgram begin and end method are deprecated for a smooth transition.
I made a quick dumb test to see how my GPU was impacted (if my GPU driver optimize it or not) :
here is the code:
by commenting begin/end in all combinations i get:
GPU : Nvidia GTX 950m
I'm not calling this a benchmark, i just wanted to highlight this small optimization and ensure there was no drawbacks. Most of games try to minimize shader switches to only a few anyway, so i don't think it would improve perf. noticeably. But it still better to not call it at all.
Note that my original issue was GLProfiler counting a shader switch as twice because of it. This issue is then fixed by this PR as well.