rive-ios icon indicating copy to clipboard operation
rive-ios copied to clipboard

Animation Hitches / Main Thread Blocking.

Open SleepiestAdam opened this issue 1 year ago • 6 comments

Description

When using multiple rive views in a scroll view the main thread is often getting blocked causing an animation hitch while it waits on "next drawable"

Expected behavior

Ideally it shouldn't block the main thread / should ideally render each frame off the main thread and if the rive / metal view itself can't keep up it shouldn't slow down the rest of the UI while making the main thread wait. Less concerned about the rive view itself running at a lower frame rate than the rest of the UI should performance limitations require this - but scroll views etc shouldn't be getting blocked while waiting.

Image

Device & Versions (please complete the following information)

iOS 18.3, iPhone 16 Pro. Rive 6.6.0

Stack Trace During Hang

semaphore_timedwait_trap _dispatch_sema4_timedwait _dispatch_semaphore_wait_slow CAMetalLayerPrivateNextDrawableLocked(CAMetalLayer*, CAMetalDrawable**, unsigned long*) -[CAMetalLayer nextDrawable] -[MTKView currentDrawable] -[RiveRendererView drawInRect:withCompletion:] -[RiveRendererView drawRect:] -[MTKView draw] CA::Layer::layout_and_display_if_needed(CA::Transaction*) CA::Context::commit_transaction(CA::Transaction*, double, double*) CA::Transaction::commit() CA::Transaction::flush_as_runloop_observer(bool) _UIApplicationFlushCATransaction __setupUpdateSequence_block_invoke_2 UIUpdateSequenceRun schedulerStepScheduledMainSection runloopSourceCallback CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION __CFRunLoopDoSource0 __CFRunLoopDoSources0 __CFRunLoopRun CFRunLoopRunSpecific GSEventRunModal -[UIApplication run] UIApplicationMain closure #1 in KitRendererCommon(:) runApp<A>(:) static App.main() static SleepiestApp.$main() __debug_main_executable_dylib_entry_point start

SleepiestAdam avatar Feb 14 '25 18:02 SleepiestAdam