feat: expose GPU Canvas (3D) on iOS and Android - #381
Open
mfazekas wants to merge 3 commits into
Open
Conversation
Both are the first releases that ship GPU Canvas (rive-ios 6.25.0, rive-android 11.12.0). rive-android 11.10+ also surfaces an upstream bug: reading a nonexistent boolean property aborts debuggable apps with "JNI DETECTED ERROR: unexpected jboolean value" because rive-runtime's listViewModelPropertyValue handler still sends a value message with an uninitialized union member after reporting the not-found error. As a mitigation, boolean reads on instances with known ViewModel metadata are validated against the property list before touching the native getter. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… + Android) Adds RiveRuntime.setGPUCanvasEnabled()/isGPUCanvasEnabled(). The setting is process-wide and fixed once the shared render worker exists, like setAndroidRenderBackend; both now live in RiveWorkerConfig per source set. iOS maps to Worker(configuration: .init(enableGPUCanvas:)); Android maps to rive-android's experimental deferred renderer, reached through a Java shim because CommandQueue.createDeferred is Kotlin-internal. No-op on the legacy runtime. Adds the ore.riv GPU Canvas demo page and docs. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Walks the path via ViewModelInstance.create(Reference(parent)) and getViewModelName() so nested and view-obtained instances are covered by the rive-app/rive-android#470 guard too, and caches the result per path. Adds nested-miss cases to the harness test. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Exposes Rive's GPU Canvas renderer (required for 3D content) on both platforms of the new runtime as
RiveRuntime.setGPUCanvasEnabled(true)/RiveRuntime.isGPUCanvasEnabled(), and bumps the pinned SDKs to rive-ios 6.26.0 and rive-android 11.12.0, the first releases that ship it. The setting is process-wide and follows the same contract assetAndroidRenderBackend: call it before the first Rive file loads; once the shared worker exists a later call logs a warning and is ignored. Both settings now live inRiveWorkerConfig(per source set), replacingRiveRenderBackendConfig.iOS maps to
Worker(configuration: .init(enableGPUCanvas:)). Android maps to rive-android's experimental deferred renderer. ItsCommandQueue.createDeferredis Kotlin-internal (only the ComposerememberDeferredRiveWorker()is public), soDeferredRiveWorker.javacalls the mangled JVM entry point; Java is not bound by Kotlin visibility. Worth asking upstream to make it public.The bump also surfaced an upstream bug that predates GPU Canvas: on rive-android 11.10+ a
getValueAsync()on a nonexistent boolean path aborts debuggable apps (JNI DETECTED ERROR: unexpected jboolean value). rive-runtime'slistViewModelPropertyValuehandler reports "property not found" but still sends a value message with the uninitialized union member, and the JNI bridge forwards that byte as ajboolean; 11.9.1 has the same code and only passes by luck of stack contents. Bisected 11.9.1 pass / 11.10.0+ abort, deterministic. Reported as rive-app/rive-android#470. As a mitigationHybridViewModelInstance.hasBooleanPropertyresolves the path against ViewModel metadata before the native read: for nested paths it references the parent instance, asks it for its ViewModel name (getViewModelName(), public since 11.12) and checks that ViewModel's property list, so nested and view-obtained instances are covered too; results are cached per path. The harness test now includes nested misses.Example:
demos/GPUCanvasDemo.tsxrendersore.riv(rive-android's GPU Canvas sample, MIT) and must be the first Rive page opened after a cold start. With the flag the three cubes render on both platforms; without it they are black and iOS logsGPUCanvas:beginRenderPass() requires the deferred recorder. No harness test since the flag cannot be toggled per process.Verified: iOS harness 29/29 suites (209 tests) on 6.26.0; Android harness 29/29 suites (209 tests) on 11.12.0 with the guard (4 suites crashed before it); Android legacy source set compiles. Docs in
docs/runtime-backends.md.🤖 Generated with Claude Code