This is a driver limitation in the default open-source Mesa radeonsi driver atm. The hardware can only do line stippling by itself (cfe. Screen('LineStipple')
if it uses non-perpendicular line endcaps. The TODO says roughly “change to perpendicular endcaps, once somebody writes a driver internal fragment shader implementation of line stippling to overcome this limit.” - So far nobody felt the calling… I gave it a stab sunday evening, but it turns out to be more involved than i hoped, so i don’t think i can complete it soon without proper funding in place – paid projects take precedence. This is one of the reasons we really need the labs to buy memberships, so we can build up a big enough pot of money to pay for my time doing such work… I do have a simple source-code patch to enable perpendicular endcaps, but as the code comments said, that breaks line stippling, so this is not going to fly, fixing one thing to break another thing…
This is btw. what the OpenGL standard says about line endcaps:
https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glLineWidth.xhtml
My undestanding is that these vertical or horizontal line endings are exactly what is supposed to happen if you choose line smoothing flag 0 (ie. no line smoothing) , and the standard is not very strict about how implementations are supposed to draw lines. In principle they are also allowed to not draw smooth lines at all.
Anyway, i did a quick test of this feature on different OS + GPU combos, and in general, line rendering is quite inconsistent across systems:
macOS + AMD: Horizontl/Vertical line endings on wide lines, regardless what is requested.
Win10 + AMD: Smoothed lines are perpendicular, non-smoothed are horizontal/vertical, regardless if multi-sample anti-aliasing MSAA is on or off.
Win10 + NVidia: Smooth or MSAA perpendicular, hor/vert otherwise.
Win10 + Intel: Smooth on → perpendicular, smooth off → hor/vert. But if MSAA is also enabled, then lines are always hor/vert.!
Linux + Intel: Smooth on or MSAA on → perpendicular, hor/vert. otherwise.
Linux + Nvidia: Untestes.
Linux + AMD: What you found.
So it’s a bit all over the place also on Windows and macOS…
I guess the only way we’d get consistent line rendering on all OS + HW combos would be if we implemented our own line drawing by use of anti-aliased rectangles. Doable, but again, paying work takes precedence, unless enough labs contribute financially to PTB’s upkeep.
In general however, the combo Linux + AMD (and also the generation of AMD gpu you have) is the by far most well tested and well supported one by myself, followed by Linux + Intel, and maybe Linux + RaspberryPi. Everything else is a lower priority, because i couldn’t do anything about bugs or problems anyway, given other systems only have proprietary drivers.
In theory you could try installing the amdgpu-pro driver which is a hybrid out of open-source low-level kernel driver and proprietary OpenGL driver. In pracice, that driver will lose you all the high precision timing and other advantages of the mostly superior open-source driver, and in my experience that driver is way more buggy.
-mario