Fix rendering of web Rect with large corner radius #13649
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.
This fixes the rendering of WebGL Rect glyphs with large corner radii. Here is the
Glyph_models__should_support_Rect_with_large_rounded_corners_that_need_scaling.png
baseline test image before and after:There isn't a simple Python reproducer until #13637 is fixed.
Code changes are all in the shaders. Previously we were only considering the distance to the nearest
Rect
corner so we only looked at the local x,y quadrant. This isn't sufficient and we have to look at all 4 corners to support large radii. This changes the logic of the fragment shader, necessarily making it more complicated. I have also moved the calculation to limit the corner radii to the vertex shader so that it only needs to be calculated 4 times (one per rect vertex) rather than once per pixel rendered, and written it in a more condensed and faster form.