make all circle drawing high-precision and faster too - #943
Open
cyrgani wants to merge 2 commits into
Open
Conversation
Contributor
Author
|
Any help with the metal shader would be most appreciated, since I have no experience with them and no way to test them either. |
cyrgani
force-pushed
the
better-circles-v2
branch
from
April 9, 2025 20:43
b8c927a to
7fe344e
Compare
cyrgani
force-pushed
the
better-circles-v2
branch
from
April 9, 2025 21:20
b6bb019 to
4df88b7
Compare
Contributor
|
Judging by the implementation, you draw a circle as a texture on a rectangular surface of 2 triangles. Perhaps you should not be categorical and change the initial implementation (using a polygon) to a new one. However, you can always add this as a new function so as not to break compatibility, because some users could rely in their shaders on the fact that a circle is a set of triangles. Example of names: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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_circleinstead of the previousdraw_polyapproach. 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 theDrawModeis 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..1000with0..5and 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