make all circle drawing high-precision and faster too #943
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.
This PR adds a new drawing mode and shaders for drawing circles directly and uses that in
draw_circle
instead of the previousdraw_poly
approach. This makes it faster in all cases!It uses the great implementation from #521 as a foundation and adds a bugfix and an update to the current shader APIs to it.
This PR supersedes #939 and #940.
There are still two things to do before this can be merged:
First frame takes a very long time to load if theDrawMode
is swapped often #945 must be resolved independently of this PRPerformance
Here is my benchmarking code to test both variants:
Results on my laptop are for circles of radius 1:
When dealing with larger circles (replace
0..1000
with0..5
and radius1.
with100.
), the new versions speed advantage remains or is even clearer (in addition to the circle being round and not polygonal):Image: Old version
Image: New version