WebGL2: Severe triangular/geometric rendering corruption on Raspberry Pi V3D – Canvas and llvmpip...





Title:

WebGL2: Severe triangular/geometric rendering corruption on Raspberry Pi V3D – Canvas and llvmpipe render correctly

Hi Rive team,

we have been investigating a severe rendering issue with @rive-app/webgl2 on Raspberry Pi 4 and Raspberry Pi 5.

The WebGL2 renderer produces obvious triangular/geometric corruption in text, buttons, numbers and other vector artwork when running through the Raspberry Pi V3D hardware graphics path.

The exact same .riv renders visually correctly with @rive-app/canvas.

Most importantly, the same @rive-app/webgl2 runtime also renders correctly on the same Raspberry Pi when Mesa llvmpipe software rendering is used instead of the V3D hardware renderer.

We spent two days isolating the issue and can reproduce it completely independently of our application.

============================================================

CURRENT CLEAN REPRODUCTION

============================================================

Hardware:

Raspberry Pi 4 Model B Rev 1.5

Operating system:

Debian GNU/Linux 13 (trixie)

Debian 13.5

Kernel:

6.18.34+rpt-rpi-v8

Desktop:

rpd-labwc

Session:

Wayland

Firefox:

151.0.3

Mesa:

25.0.7-2+rpt4 arm64

Relevant kernel graphics modules:

vc4

v3d

Rive WebGL2:

@rive-app/webgl2 2.42.0

Rive Canvas:

@rive-app/canvas 2.42.0

============================================================

RESULT ON A COMPLETELY STOCK RASPBERRY PI OS DESKTOP

============================================================

We installed a fresh Raspberry Pi OS Desktop system on a separate SD card.

None of our application software was installed.

No custom player.

No agent.

No custom X11 configuration.

No Xfce installation.

No kiosk configuration.

No custom browser configuration.

No installation scripts from our project.

The stock desktop runs:

rpd-labwc

Wayland

Firefox 151.0.3

Mesa 25.0.7-2+rpt4

We then copied only a standalone Rive test page to the system.

Result:

@rive-app/webgl2 2.42.0

=> visible triangular/geometric rendering corruption

@rive-app/canvas 2.42.0

=> visually correct

This test used:

- the same Raspberry Pi

- the same operating system

- the same Firefox browser

- the same .riv file

- the same animation

- the same canvas size

- the same Rive version number

Only the Rive rendering runtime was changed from WebGL2 to Canvas.

============================================================

ORIGINAL VISUAL SYMPTOM

============================================================

The corruption appears as malformed or displaced triangular/geometric fragments.

We see it in:

- text / individual letters

- buttons

- numbers

- vector graphics

- outlines and filled shapes

Parts of letters or shapes appear to be cut into triangles, displaced, or replaced by incorrect geometric fragments.

The corruption is also visible in screenshots captured from the system.

Therefore the physical monitor, HDMI cable and display panel are not the source of the problem. The incorrect pixels already exist in the rendered image.

============================================================

STANDALONE REPRODUCTION OUTSIDE OUR APPLICATION

============================================================

The issue does not require our application.

We stopped our player, agent and kiosk services and created a completely independent HTML test page.

The page was served only with:

python3 -m http.server 8080

The relevant files were:

test.riv

rive.js

rive.wasm

The JavaScript runtime was verified as:

"name":"@rive-app/webgl2","version":"2.42.0"

The simplified initialization is:

<canvas id="riveCanvas" width="1280" height="800"></canvas>

<script src="rive.js"></script>

<script>

rive.RuntimeLoader.setWasmUrl("./rive.wasm");

const canvas = document.getElementById("riveCanvas");

const r = new rive.Rive({

src: "./test.riv",

canvas: canvas,

autoplay: false,

stateMachines: "hm_machine",

onLoad: () => {

r.resizeDrawingSurfaceToCanvas();

const inputs =

r.stateMachineInputs("hm_machine") || [];

const start =

inputs.find(i => i.name === "start");

if (start && typeof start.fire === "function") {

start.fire();

}

}

});

</script>

The same corruption occurred in this minimal standalone page.

Therefore the following parts of our original application are not required to reproduce the problem:

- our Rust player

- our agent

- our template system

- iframe embedding

- variable/data binding

- ViewModels

- our Rive integration bridge

- event handling

- Firefox kiosk configuration

- our player cache logic

============================================================

RASPBERRY PI 4 VS RASPBERRY PI 5

============================================================

We reproduced the issue on both Raspberry Pi generations.

Raspberry Pi 4:

OpenGL vendor:

Broadcom

Renderer:

V3D 4.2.14.0

Rive WebGL2:

corrupted

Raspberry Pi 5:

OpenGL vendor:

Broadcom

Renderer:

V3D 7.1.10.2

Rive WebGL2:

corrupted

Therefore the issue is not specific to Raspberry Pi 5 or a single V3D GPU generation.

============================================================

FIREFOX VS CHROMIUM

============================================================

We reproduced the issue with both browsers.

Firefox + V3D + Rive WebGL2

=> corrupted

Chromium + V3D + Rive WebGL2

=> corrupted

The visual corruption is of the same general type.

Therefore the issue does not appear to be Firefox-specific.

============================================================

V3D HARDWARE RENDERING VS LLVMPIPE SOFTWARE RENDERING

============================================================

This was one of the most important isolation tests.

We verified that Mesa llvmpipe was available:

OpenGL vendor:

Mesa

OpenGL renderer:

llvmpipe

Accelerated:

no

We then forced the same browser to use software rendering:

LIBGL_ALWAYS_SOFTWARE=true

GALLIUM_DRIVER=llvmpipe

Result in Firefox:

Firefox + V3D

=> corrupted

Firefox + llvmpipe

=> correct

We repeated the test with Chromium.

Chromium initially blocklisted WebGL2 under software rendering, so we explicitly enabled WebGL for the diagnostic test.

Result:

Chromium + V3D

=> corrupted

Chromium + llvmpipe

=> correct

The resulting matrix is:

V3D hardware llvmpipe software

Firefox + WebGL2 corrupted correct

Chromium + WebGL2 corrupted correct

This is one of the strongest observations from our testing.

The same WebGL2 Rive content renders correctly on the same Raspberry Pi when the V3D hardware rendering path is replaced by llvmpipe.

============================================================

RIVE WEBGL2 VS RIVE CANVAS

============================================================

Using the same .riv file:

@rive-app/webgl2 2.41.0

=> corrupted

@rive-app/canvas 2.41.0

=> correct

Later, on the clean stock Raspberry Pi OS installation:

@rive-app/webgl2 2.42.0

=> corrupted

@rive-app/canvas 2.42.0

=> visually correct

Therefore the .riv itself is not generally broken.

The same content can be rendered correctly by the Rive Canvas runtime on the same Raspberry Pi.

============================================================

RIVE VERSION TEST

============================================================

We initially reproduced the problem with:

@rive-app/webgl2 2.41.0

We later replaced the runtime with:

@rive-app/webgl2 2.42.0

We verified the actually loaded cached JavaScript file and confirmed:

"name":"@rive-app/webgl2","version":"2.42.0"

Result:

WebGL2 2.41.0

=> corrupted

WebGL2 2.42.0

=> corrupted

Therefore the problem is not limited to 2.41.0 and is not caused by accidentally loading an old cached runtime.

============================================================

MESA VERSION TESTS

============================================================

We tested several Mesa configurations.

1.

Mesa:

25.0.7-2+deb13u1

V3D:

enabled

Result:

corrupted

2.

Mesa:

26.2.1-2~bpo13+0~rpt1

V3D:

enabled

Result:

corrupted

3. Fresh stock Raspberry Pi OS:

Mesa:

25.0.7-2+rpt4

Packages:

libegl-mesa0 25.0.7-2+rpt4 arm64

libgbm1 25.0.7-2+rpt4 arm64

libgl1-mesa-dri 25.0.7-2+rpt4 arm64

libglx-mesa0 25.0.7-2+rpt4 arm64

mesa-libgallium 25.0.7-2+rpt4 arm64

mesa-vulkan-drivers 25.0.7-2+rpt4 arm64

Result:

corrupted

Therefore this does not appear to be a regression introduced only by Mesa 26.2.1.

============================================================

CUSTOM X11 SYSTEM VS STOCK WAYLAND SYSTEM

============================================================

Our original player system was based on:

Raspberry Pi OS Lite

Xorg / X11

Xfce

LightDM

Rive WebGL2 result:

corrupted

To exclude our installation and X11 configuration, we installed a completely stock Raspberry Pi OS Desktop on a new SD card.

The stock system used:

rpd-labwc

Wayland

Rive WebGL2 result:

corrupted

Therefore:

X11 system

=> corrupted

Stock Wayland system

=> corrupted

This strongly suggests that our custom Raspberry Pi installation is not the cause of the problem.

============================================================

WEBGL2 CAPABILITIES

============================================================

On Raspberry Pi 4 we inspected the WebGL2 context.

Chromium reported:

WEBGL2:

available

Renderer:

ANGLE (Broadcom, V3D 4.2.14.0, OpenGL ES 3.1)

WebGL:

WebGL 2.0

MAX_SAMPLES:

4

The following extensions were not available:

WEBGL_shader_pixel_local_storage

=> false

EXT_multisampled_render_to_texture

=> false

The Rive WebGL2 runtime contains code paths involving:

WEBGL_shader_pixel_local_storage

renderbufferStorageMultisample

blitFramebuffer

We therefore instrumented the actual WebGL2 calls.

============================================================

WEBGL2 CONTEXT INSTRUMENTATION

============================================================

We intercepted creation of the WebGL2 context.

Rive initially requested:

antialias=true

The resulting context reported:

SAMPLE_BUFFERS=1

SAMPLES=4

MAX_SAMPLES=4

Pixel Local Storage was unavailable:

WEBGL_shader_pixel_local_storage=false

We then forced the browser/default framebuffer to use:

antialias=false

The context correctly reported:

SAMPLE_BUFFERS=0

SAMPLES=0

The Rive rendering corruption remained.

============================================================

RIVE INTERNAL MULTISAMPLE RENDERBUFFERS

============================================================

Our instrumentation showed that Rive also creates its own multisampled renderbuffers.

Observed calls included:

renderbufferStorageMultisample

samples=4

format=DEPTH24_STENCIL8

size=1280x800

and:

renderbufferStorageMultisample

samples=4

format=RGBA8

size=1280x800

The renderer then repeatedly used:

blitFramebuffer

This suggested that MSAA or the resolve path might be involved, so we tested that directly.

============================================================

FORCING RIVE INTERNAL MSAA FROM 4 SAMPLES TO 0

============================================================

We intercepted renderbufferStorageMultisample and replaced every requested sample count of 4 with 0.

We then verified the actual renderbuffer state using:

RENDERBUFFER_SAMPLES

The result was confirmed as:

0 samples

At this point we had:

Browser/default framebuffer:

0x MSAA

Rive internal renderbuffers:

0x MSAA

The geometric corruption still remained.

Therefore the issue does not appear to be caused simply by the MSAA sample count.

We are not claiming that the broader fallback/framebuffer path is unrelated, only that changing the actual multisample count from 4 to 0 did not fix the issue.

============================================================

USEOFFSCREENRENDERER TEST

============================================================

We also initialized Rive with:

useOffscreenRenderer: true

Result:

no visible improvement

The same corruption remained.

============================================================

FIREFOX HARDWARE ACCELERATION TEST

============================================================

We also temporarily disabled Firefox hardware acceleration / WebRender through Firefox configuration.

This did not visibly change the corruption.

We do not consider this test alone conclusive, but combined with the Chromium and llvmpipe tests it further indicates that the issue is below our normal Firefox configuration layer.

============================================================

CURRENT TEST MATRIX

============================================================

Raspberry Pi 4 + V3D + WebGL2 2.41.0

=> corrupted

Raspberry Pi 4 + V3D + WebGL2 2.42.0

=> corrupted

Raspberry Pi 5 + V3D + WebGL2 2.41.0

=> corrupted

Firefox + V3D

=> corrupted

Chromium + V3D

=> corrupted

Firefox + llvmpipe + WebGL2

=> correct

Chromium + llvmpipe + WebGL2

=> correct

Rive Canvas + same .riv

=> correct

Mesa 25.0.7-2+deb13u1 + V3D

=> corrupted

Mesa 25.0.7-2+rpt4 + V3D

=> corrupted

Mesa 26.2.1-2~bpo13+0~rpt1 + V3D

=> corrupted

Custom Raspberry Pi OS Lite / X11 / Xfce

=> corrupted

Fresh stock Raspberry Pi OS Desktop / Wayland / rpd-labwc

=> corrupted

Our full application

=> corrupted

Standalone HTML without our application

=> corrupted

Default framebuffer 4x MSAA

=> corrupted

Default framebuffer 0x MSAA

=> corrupted

Rive internal 4x MSAA

=> corrupted

Rive internal MSAA forced to 0 and verified

=> corrupted

useOffscreenRenderer: true

=> corrupted

============================================================

WHAT WE BELIEVE WE HAVE EXCLUDED

============================================================

Based on these tests, the following components do not appear to be required to reproduce the issue:

- our Rust player

- our agent

- our template system

- iframe embedding

- our variable/data binding

- our Rive integration code

- our Firefox kiosk configuration

- our Raspberry Pi installation scripts

- Xfce

- X11

- Wayland as the sole cause

- Firefox as the sole cause

- Chromium as the sole cause

- Raspberry Pi 5 specifically

- Mesa 26.2.1 specifically

- Rive WebGL2 2.41.0 specifically

- simple 4x MSAA sample count

- useOffscreenRenderer

- monitor / HDMI output

============================================================

STRONGEST OBSERVATION

============================================================

The strongest result from our investigation is:

Rive WebGL2 + Raspberry Pi V3D hardware rendering

=> corrupted

Rive WebGL2 + Mesa llvmpipe software rendering

=> correct

Rive Canvas + Raspberry Pi V3D

=> correct

This appears to isolate the problem to the interaction between the Rive WebGL2 renderer and the Raspberry Pi V3D hardware rendering path.

============================================================

WHAT WE DO NOT KNOW

============================================================

We do not currently know whether the root cause is:

- a Rive WebGL2 renderer issue

- a Mesa/V3D driver issue

- an ANGLE/V3D interaction

- or an interaction between several of these components

We deliberately do NOT want to claim that this is definitely a shader precision or tessellation problem.

Our tests have not established that.

For example, it is possible that:

- Rive produces valid WebGL2 which the V3D path renders incorrectly

or:

- Rive relies on behavior that is fragile or undefined and happens to work with llvmpipe but not with V3D

or:

- the actual cause is somewhere else in the Rive WebGL2 fallback/rendering path

We would appreciate guidance from the Rive renderer/runtime team on how to isolate this further.

============================================================

SCREENSHOTS

============================================================

We will attach four small cropped screenshots.

They show identical areas from the same proprietary production .riv file.

1. webgl2-word-corrupt.png

A word rendered with:

@rive-app/webgl2 2.42.0

The triangular/geometric corruption is visible.

2. canvas-word-clean.png

The exact same word rendered with:

@rive-app/canvas 2.42.0

The rendering is visually correct.

3. webgl2-button-corrupt.png

A button rendered with:

@rive-app/webgl2 2.42.0

The geometric corruption is visible.

4. canvas-button-clean.png

The exact same button rendered with:

@rive-app/canvas 2.42.0

The rendering is visually correct.

The screenshots were deliberately cropped so that no customer-identifying logos, names, products, prices or other proprietary artwork are included.

============================================================

SOURCE .RIV

============================================================

Unfortunately we cannot publish the original .riv file.

It is a proprietary production file created for a customer and contains customer-specific artwork.

We can provide additional technical diagnostics if useful.

We are also willing to try to create a completely neutral reproduction .riv that demonstrates the same rendering issue without any proprietary assets.

============================================================

EXPECTED RESULT

============================================================

The Rive animation should render without geometric corruption when using the Raspberry Pi V3D hardware renderer.

============================================================

ACTUAL RESULT

============================================================

With @rive-app/webgl2, parts of text, buttons, numbers and vector artwork are rendered as malformed, displaced or incorrect triangular/geometric fragments.

The same content renders visually correctly with @rive-app/canvas.

The same WebGL2 content also renders correctly when the same Raspberry Pi uses Mesa llvmpipe software rendering instead of V3D.

If this belongs with the lower-level renderer/runtime team, please forward it accordingly.

We are happy to run additional targeted diagnostics if you tell us which WebGL2 state, shader, framebuffer or rendering-pass information would be most useful.