KiCAD 3D Viewer - rounded pads rendered incorrectly (texture mapping or stencil test error)
Description
In KiCAD's 3D Viewer circular pads are rendered incorrectly for users with AMD GPUs since a few days. The circle texture is not applied correctly to render circular pads which are thus shown as squares.
Reporting users (including myself) consistently use Mesa >=24 with an AMD GPU. I couldn't test against a previous Mesa release yet, but there have not been reports about this bug in KiCAD with previous Mesa versions. Bug is tracked in KiCAD#17286.
Screenshots
Using a minimal example project of a circuit board with only one hole ("via"), the issue can be easily reproduced. In the following screenshots the circuit board was hidden for clarity, only the copper layer is shown:
Screenshot with artifact | Sofware rendering (LIBGL_ALWAYS_SOFTWARE=1 ) - for reference |
---|---|
The circular features of the horizontal disk are created by mapping a circle texture onto triangles and then doing stenciling (two triangles, each rendering a semi circle). A detailed description of the rendering process for circular pads in the KiCAD 3D viewer was given in a previous bug here, 6665#kicad-code-overview.
Steps to reproduce
Open the example project (round-pad-example-kicad8.zip) in KiCAD, open the PCB Editor, open the 3D viewer via hotkey Alt-3. Observe that the copper pad inner cut-out is always rendered as square (should be a circle). Rotating or moving the model or camera doesn't affect how the hole is rendered.
System Information
Regression
All reports with Mesa version >=24.
API Captures
An API capture was created as described in kicad#17286 (comment): kicad_egl-kerel.zip
Repeatedly replaying this trace / calling "lookup state" sometimes the artifact does not occur, see video in KiCAD#17286#note_1817486843.
Further information
With software rendering (LIBGL_ALWAYS_SOFTWARE=1
) the issue disappears.