Skip to content

fix(shaders): avoid unused swizzle helper on older Adreno - #115

Open
mrrobot97 wants to merge 1 commit into
rive-app:mainfrom
mrrobot97:codex/fix-android-adreno-path-shaders
Open

fix(shaders): avoid unused swizzle helper on older Adreno#115
mrrobot97 wants to merge 1 commit into
rive-app:mainfrom
mrrobot97:codex/fix-android-adreno-path-shaders

Conversation

@mrrobot97

@mrrobot97 mrrobot97 commented Jul 23, 2026

Copy link
Copy Markdown

Summary

  • Emit swizzle_image_buffer_idx only for storage-buffer PLS and
    clockwise-atomic shader variants.
  • Keep the unsigned-shift helper out of unrelated path shaders.
  • Preserve its WebGPU storage-buffer use and the shader shape of the
    pre-existing clockwise-atomic path.

Problem

After the storage-buffer PLS work in 365421d6,
swizzle_image_buffer_idx became part of every path shader, even when it
was unused. On an Android 8.1 device with an Adreno 616, the older GLSL
compiler silently miscompiles those non-atomic path shaders: vector paths
disappear while image meshes continue to render. This affects the Rive GPU
renderer; the Android Canvas renderer remains complete because it does not
use these GLSL path shaders.

I bisected the regression:

  • runtime-v0.1.118: renders correctly
  • runtime-v0.1.119: first broken release
  • first bad commit: 365421d6177757772a911f176241af8ea6d5e64e

The helper is required by PLS_IMPL_STORAGE_BUFFER. Clockwise-atomic
variants also contained the previous swizzle helper before that commit.
Guarding it to those two configurations restores the previous shader
contents for all other path variants.

Reproduction

A small .riv file can expose the problem when its artboard contains
several visible filled or stroked vector paths. Mixing those paths with an
image mesh makes the failure especially easy to identify: on the affected
device's Rive renderer, the image mesh continues to render while some or all
vector paths disappear. A state machine is not required; a static artboard
is sufficient as long as the shapes are visible.

Test environment and observed behavior:

  • device: Android 8.1 / Adreno 616
  • verified affected package: Rive Android 11.7.2
  • RendererType.Rive reproduces the missing-path result
  • RendererType.Canvas renders the same artboard completely

Validation

  • A/B tested runtime-v0.1.119 on the affected device: the unguarded
    Rive renderer fails, while this guard restores all vector paths and
    matches the Canvas control.
  • A/B tested the same guard on runtime-v0.1.169 / Rive Android 11.7.2.
  • Regenerated and minified the full shader set from the current main.

Automated coverage for the visual failure is not practical because it is
a silent miscompile in the proprietary device driver.

Some older Adreno GLSL compilers silently miscompile non-atomic path shaders when they contain the unused unsigned shifts in swizzle_image_buffer_idx.

Restrict the helper to storage-buffer PLS and clockwise-atomic variants. This preserves its WebGPU use and the previous atomic shader behavior while keeping it out of unrelated path shaders.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants