Hi there,
I'm developing a visionOS app that is using the anchor points and mesh from SceneReconstructionProvider anchor updates. I load an ImmersiveSpace using a RealityView and apply a ShaderGraphMaterial (from a Shader Graph in Reality Composer Pro) to the mesh and use calls to setParameter to dynamically update the material on very rapid frequency. The mesh is locked (no more updates) before the calls to setParameter. This process works for a few minutes but then eventually I get the following error in the console:
assertion failure: Index out of range (operator[]:line 789) index = 13662, max = 1
With the following stack trace:
Thread 1 Queue : com.apple.main-thread (serial) #0 0x00000002880f90d0 in __abort_with_payload () #1 0x000000028812a6dc in abort_with_payload_wrapper_internal () #2 0x000000028812a710 in abort_with_payload () #3 0x0000000288003f40 in _os_crash_msg () #4 0x00000001dc9ff624 in re::ecs2::ComponentBucketsBase::addComponent () #5 0x00000001dc9ffadc in re::ecs2::ComponentBucketsBase::moveComponent () #6 0x00000001dc8b0278 in re::ecs2::MaterialParameterBlockArrayComponentStateImpl::processPreparingComponents () #7 0x00000001dc8b05e4 in re::ecs2::MaterialParameterBlockArraySystem::update () #8 0x00000001dd008744 in re::Scheduler::executePhase () #9 0x00000001dc032ec4 in re::Engine::executePhase () #10 0x0000000248121898 in RCPSharedSimulationExecuteUpdate () #11 0x00000002264e488c in __59-[MRUISharedSimulation _doJoinWithConnectionContext:error:]_block_invoke.44 () #12 0x0000000268c5fe9c in _UIUpdateSequenceRunNext () #13 0x00000002696ea540 in schedulerStepScheduledMainSectionContinue () #14 0x000000026af8d284 in UC::DriverCore::continueProcessing () #15 0x00000001a1bd4e6c in CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION () #16 0x00000001a1bd4db0 in __CFRunLoopDoSource0 () #17 0x00000001a1bd44f0 in __CFRunLoopDoSources0 () #18 0x00000001a1bd3640 in __CFRunLoopRun () #19 0x00000001a1bce284 in _CFRunLoopRunSpecificWithOptions () #20 0x00000001eff12d2c in GSEventRunModal () #21 0x00000002697de878 in -[UIApplication _run] () #22 0x00000002697e33c0 in UIApplicationMain () #23 0x00000001b56651e4 in closure #1 (Swift.UnsafeMutablePointer<Swift.Optional<Swift.UnsafeMutablePointer<Swift.Int8>>>) -> Swift.Never in SwiftUI.KitRendererCommon(Swift.AnyObject.Type) -> Swift.Never () #24 0x00000001b5664f08 in SwiftUI.runApp<τ_0_0 where τ_0_0: SwiftUI.App>(τ_0_0) -> Swift.Never () #25 0x00000001b53ad570 in static SwiftUI.App.main() -> () () #26 0x0000000101bc7b9c in static MetalRendererApp.$main() () #27 0x0000000101bc7bdc in main () #28 0x0000000197fd0284 in start ()
Any advice on how to solve this or prevent the error?
Thanks!
Hello,
re: "calls to setParameter to dynamically update the material on very rapid frequency. The mesh is locked (no more updates) before the calls to setParameter." this seems like it could be race condition or other update issue (drawable starvation?) related to the very rapid update frequency.
Try reducing the update frequency to see if that resolves the issue.
Also, send us a bug report with a sample project that causes the crash so we can investigate further.