Repository navigation
Use simpler shader for rect-like glyphs without rounded corners - #13651
Conversation
| this._show.update() | ||
|
|
||
| this._draw_one_marker_type(marker_type, transform, main_gl_glyph) | ||
| this._draw_one_marker_type(main_gl_glyph.marker_type, transform, main_gl_glyph) |
There was a problem hiding this comment.
Note the marker_type is now determined after set_data is called as that is where _border_radius_nonzero is set.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## branch-3.4 #13651 +/- ##
==============================================
+ Coverage 92.55% 92.57% +0.02%
==============================================
Files 323 323
Lines 20525 20525
==============================================
+ Hits 18996 19002 +6
+ Misses 1529 1523 -6 |
mattpap
left a comment
There was a problem hiding this comment.
Looks good. Is there a measurable performance difference between this and the original approach?
There is, just. Using the following test code on my dev machine (Quadro T1000 graphics card, ubuntu 23.10, chromium 118) and panning in small circles using this branch gives 40-45 frames per second without rounded corners, 35-40 FPS with them. from bokeh.plotting import figure, show
import numpy as np
n = 20000
rng = np.random.default_rng(12314)
x = rng.uniform(size=n)
y = rng.uniform(size=n)
backend = "webgl"
p = figure(width=800, height=800, title=f"{backend} {n}", output_backend=backend)
p.rect(
x=x, y=y, width=0.1, height=0.1, line_width=0, fill_alpha=0.01,
#border_radius=20,
)
show(p) |
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Rectglyphs and their relatives (Block,Quad, etc) support rounded corners via theborder_radiusproperty. The WebGL backend now has full support for these rounded corners (#13649). Because of the way GLSL shaders work (massively in parallel) the rounded corner rendering code is executed even if rounded corners are not required. This is unnecessary processing for thoseRect-like glyphs that don't have rounded corners.This PR introduces a new
GLMarkerTypeof"round_rect"for rects with rounded corners, and keeps the use of"rect"for non-rounded corners. Actually the"rect"marker type reuses the"square"shader code, so it is not even new shader code. There is a new boolean flag onBaseMarkerGLto indicate if round corners are set and this is used to determine whichGLMarkerTypeis used for rendering.There are no changes at all in baseline test images.