Repository navigation
feat: Enable GPU Canvas for Rive dashboards on Android - #267
Conversation
Use a deferred Rive worker so dashboards that draw with GPU Canvas (WGSL shaders over a script-drawn canvas) render instead of falling back to their native copy. Bump rive-android 11.14.1 to 11.14.3, which includes the fix for GPU Canvas rendering black on Android (11.14.2).
|
Device test on a OnePlus 12R (Android). I built this branch locally with JDK 17 and Android SDK 36 ( What I did: loaded a contest dashboard that uses GPU Canvas (a script-drawn canvas finished by a WGSL shader) through Settings > Developer > Load Rive File, with the Demo data source, then tapped Drive. What I saw:
Not tested yet: iOS (unchanged in this PR), a real car connection, other dashboards for regressions, and frame times. |
|
Thanks @Prag-designs this is cool! My only concern is the potential for crash. Can we make it so that the new Rive context only activates if we toggle it in developer settings? |
The deferred Rive worker is now behind a Developer settings switch, "GPU Canvas for Rive (experimental)", off by default. With the switch off, RiveDashView uses the standard worker exactly as before. With it on, Rive dashboards render on the deferred worker so GPU Canvas (WGSL) content shows. The setting is read when the dashboard opens.
|
Thanks @wpmed92, done in 28576cd. The deferred worker is now opt-in: Settings > Developer has a new switch, "GPU Canvas for Rive (experimental)", off by default.
I went with the developer switch rather than a manifest flag to keep the change small and easy to remove. If you'd prefer the manifest route later (a dash app declares that it uses GPU Canvas and the app picks the worker from that), I'm happy to do a follow-up. Tested on a OnePlus 12R (Android 16) with a debug build of this branch installed next to the Play Store app, Demo data source:
|
|
Thanks @Prag-designs great work! |


Summary
rememberDeferredRiveWorker(), the GPU Canvas capable worker, so dashboards that draw with GPU Canvas (a script-drawn canvas finished by a WGSL shader) render that layer instead of only showing their native fallback.rive-androidfrom 11.14.1 to 11.14.3. 11.14.2 fixes GPU Canvas content rendering black on Android (rive-android#474).@ExperimentalDeferredRendering, which Rive requires for this entry point.Why
Rive files that use GPU Canvas need a deferred worker to draw. With the plain worker they run, but the GPU layer does not render and only the native copy of the dashboard shows. This is the one switch dashboard authors cannot flip from inside the
.riv.Notes for review
rememberDeferredRiveWorker()has noOrNullvariant. If the worker cannot be created it throwsRiveInitializationExceptioninstead of callingonError. Compose does not allowtry/catcharound composables, so I did not wrap it. Happy to change this if you prefer another fallback.RiveViewModelAPI. GPU Canvas on iOS isWorker(enableGPUCanvas: true)in rive-ios's newer concurrency API, which is a bigger port. Happy to do that as a separate PR.Validation