Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on iPad Air 2 #7963

Closed
xiamingwei-sudo opened this issue Jul 5, 2024 · 7 comments · Fixed by #8022
Closed

Crash on iPad Air 2 #7963

xiamingwei-sudo opened this issue Jul 5, 2024 · 7 comments · Fixed by #8022
Assignees
Labels
bug Something isn't working ios Issue/request for iOS only

Comments

@xiamingwei-sudo
Copy link

⚠️ Issues not using this template will be systematically closed.

Describe the bug
crash on ipad air2, and happens always.
Is there anyone have solutions?
thanks

Logs

          Crashed: FEngine::loop
0  libsystem_kernel.dylib         0x6bbc __pthread_kill + 8
1  libsystem_pthread.dylib        0xd844 pthread_kill + 208
2  libsystem_c.dylib              0x1f6ac abort + 124
3  SoundCore                      0x3e59964 utils::PostconditionPanic::PostconditionPanic(char const*, char const*, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>) + 136
4  SoundCore                      0x3d528bc filament::backend::DepthStateCreator::operator()(id<MTLDevice>, filament::backend::DepthStencilState const&) + 4361676988
5  SoundCore                      0x3d3c60c filament::backend::StateCache<filament::backend::MetalPipelineState, id<MTLRenderPipelineState> __strong, filament::backend::PipelineStateCreator, utils::hash::MurmurHashFn<filament::backend::MetalPipelineState>>::getOrCreateState(filament::backend::MetalPipelineState const&) + 4361586188
6  SoundCore                      0x3d461b4 filament::backend::ConcreteDispatcher<filament::backend::MetalDriver>::draw(filament::backend::Driver&, filament::backend::CommandBase*, long*) + 4361626036
7  SoundCore                      0x3d22708 std::__1::__function::__func<filament::backend::CommandStream::execute(void*)::$_0, std::__1::allocator<filament::backend::CommandStream::execute(void*)::$_0>, void ()>::operator()() + 4361479944
8  SoundCore                      0x3d476a4 filament::backend::MetalDriver::execute(std::__1::function<void ()> const&) + 4361631396
9  SoundCore                      0x3d22470 filament::backend::CommandStream::execute(void*) + 4361479280
10 SoundCore                      0x3ded048 filament::FEngine::loop() + 166240

Smartphone (please complete the following information):

  • Device: ipad air 2
  • Backend: Metal

Additional context
Add any other context about the problem here.

@pixelflinger pixelflinger added bug Something isn't working ios Issue/request for iOS only labels Jul 8, 2024
@bejado
Copy link
Member

bejado commented Jul 9, 2024

There should be a postcondition reason printed in the logs. Can you check again and see if there's additional information about the crash?

@xiamingwei-sudo
Copy link
Author

xiamingwei-sudo commented Jul 10, 2024

�thans you for response
When I use Xcode debug, I get the following crash message

my device is iPad mini 3
os: 12.5.5
Backend: Metal

this is my code, and crashed on rendererManager.setMaterialInstanceAt(renderer, index, newMaterialInstance);

- (void)updateMaterialInstance:(MaterialInstance *)materialInstance withName:(NSString *)name rgba:(math::float4)rgba prNamePrefix:(NSString *)prNamePrefix material:(filament::Material *)material renderer:(RenderableManager::Instance)renderer index:(int)index {
    if (![name hasPrefix:prNamePrefix]) {
        return;
    }
    NSLog(@"updateFilamatWithBuffer prNamePrefix:%@, name: %@", prNamePrefix, name);
    auto& rendererManager = _engine->getRenderableManager();
    auto newMaterialInstance = material->createInstance();
    rendererManager.setMaterialInstanceAt(renderer, index, newMaterialInstance);
    [self setMaterialParameters:newMaterialInstance withRGBA:rgba];
}

crash:

2024-07-10 13:11:27.489492+0800 SoundCore[402:15649] [BLEPeripheral:137-notifyCharacteristicChange(_:)]🐛 notifyCharacteristicChange: <CBCharacteristic: 0x128dbe8f0, UUID = 8888, properties = 0x92, value = <09ff0000 010e070a 0028>, notifying = YES>, value: Optional(10 bytes)
Warning: sample comparison not supported by this GPU
2024-07-10 13:11:30.547020+0800 SoundCore[402:15649] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C18.1:2][0x13bf3d0a0] get output frames failed, state 8196
2024-07-10 13:11:30.548916+0800 SoundCore[402:15649] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C18.1:2][0x13bf3d0a0] get output frames failed, state 8196
2024-07-10 13:11:30.551812+0800 SoundCore[402:15649] TIC Read Status [18:0x0]: 1:57
2024-07-10 13:11:30.552141+0800 SoundCore[402:15649] TIC Read Status [18:0x0]: 1:57
2024-07-10 13:11:31.045106+0800 SoundCore[402:15709] Compiler failed to build request
Could not statically determine the target of a texture
Panic
in operator():97
reason: Could not create Metal pipeline state.
#0	SoundCore                              0x1039a7a7c _ZN5utils6TPanicINS_18PostconditionPanicEEC2EPKcS4_iNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE + 100
#1	SoundCore                              0x1039a77dc _ZN5utils18PostconditionPanicCI1NS_6TPanicIS0_EEEPKcS3_iNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEE + 12
#2	SoundCore                              0x1039a77bc _ZN5utils6TPanicINS_18PostconditionPanicEE5panicEPKcS4_iS4_z + 116
#3	SoundCore                              0x10387fddc _ZN8filament7backend17DepthStateCreatorclEPU19objcproto9MTLDevice11objc_objectRKNS0_17DepthStencilStateE + 0
#4	SoundCore                              0x103869b2c _ZN8filament7backend10StateCacheINS0_18MetalPipelineStateEU8__strongPU33objcproto22MTLRenderPipelineState11objc_objectNS0_20PipelineStateCreatorEN5utils4hash12MurmurHashFnIS2_EEE16getOrCreateStateERKS2_ + 364
#5	SoundCore                              0x1038736d4 _ZN8filament7backend18ConcreteDispatcherINS0_11MetalDriverEE4drawERNS0_6DriverEPNS0_11CommandBaseEPl + 1164
#6	SoundCore                              0x10384fbac _ZNSt3__110__function6__funcIZN8filament7backend13CommandStream7executeEPvE3$_0NS_9allocatorIS6_EEFvvEEclEv + 52
#7	SoundCore                              0x103874bc4 _ZN8filament7backend11MetalDriver7executeERKNSt3__18functionIFvvEEE + 44
#8	SoundCore                              0x10384f914 _ZN8filament7backend13CommandStream7executeEPv + 96
#9	SoundCore                              0x103925f40 _ZN8filament7FEngine4loopEv + 448
#10	SoundCore                              0x103929790 _ZNSt3__114__thread_proxyB7v160006INS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEMN8filament7FEngineEFivEPS8_EEEEEPvSD_ + 64
#11	libsystem_pthread.dylib                0x1fe2302c0 <redacted> + 128
#12	libsystem_pthread.dylib                0x1fe230220 _pthread_start + 44

@xiamingwei-sudo
Copy link
Author

There should be a postcondition reason printed in the logs. Can you check again and see if there's additional information about the crash?

I repeated the question, please see the log I replied above, thanks !!

@bejado
Copy link
Member

bejado commented Jul 17, 2024

We previously worked around an error like this, I wonder why this is no longer working:

// On Metal devices with an A8X chipset, this light_iblSpecular texture sample must be pulled
// outside the frameUniforms.iblSH check. This is to avoid a Metal pipeline compilation error
// with the message: "Could not statically determine the target of a texture".
// The reason for this is unknown, and is possibly a bug that exhibits only on these devices.

@xiamingwei-sudo are you able to investigate what the GPU's device.name is? Maybe this check isn't sufficient:

mContext->bugs.a8xStaticTextureTargetError =
[mContext->device.name containsString:@"Apple A8X GPU"];

@xiamingwei-sudo
Copy link
Author

xiamingwei-sudo commented Jul 18, 2024

We previously worked around an error like this, I wonder why this is no longer working:

// On Metal devices with an A8X chipset, this light_iblSpecular texture sample must be pulled
// outside the frameUniforms.iblSH check. This is to avoid a Metal pipeline compilation error
// with the message: "Could not statically determine the target of a texture".
// The reason for this is unknown, and is possibly a bug that exhibits only on these devices.

@xiamingwei-sudo are you able to investigate what the GPU's device.name is? Maybe this check isn't sufficient:

mContext->bugs.a8xStaticTextureTargetError =
[mContext->device.name containsString:@"Apple A8X GPU"];

thanks for you respons, and my ipad GPU info :

FEngine (64 bits) created at 0x120a1d800 (threading is enabled)
FEngine resolved backend: Metal
Selected physical device 'Apple A7 GPU'
Backend feature level: 2
FEngine feature level: 1

so how can i fix this issue? can you give me some suggestion ?

@bejado
Copy link
Member

bejado commented Jul 18, 2024

Perhaps we also need to extend that fix to Apple A7 GPUs. @xiamingwei-sudo can you change that check inside MetalDriver.mm to this and then recompile Filament?

    mContext->bugs.a8xStaticTextureTargetError =
            [mContext->device.name containsString:@"Apple A8X GPU"] ||
            [mContext->device.name containsString:@"Apple A7 GPU"];

@xiamingwei-sudo
Copy link
Author

xiamingwei-sudo commented Jul 19, 2024

Perhaps we also need to extend that fix to Apple A7 GPUs. @xiamingwei-sudo can you change that check inside MetalDriver.mm to this and then recompile Filament?

    mContext->bugs.a8xStaticTextureTargetError =
            [mContext->device.name containsString:@"Apple A8X GPU"] ||
            [mContext->device.name containsString:@"Apple A7 GPU"];

Thank you very much for your reply, no more crashes after adding Apple A7 GPUs and recompiling Filament,
but we also got crash on Ipad Air2/ Ipad mini 4 & iphone 6 & 6 plus , i think that is the same problem,
Thanks again for your response!!
and look forward to seeing the issue fixed in the release Version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ios Issue/request for iOS only
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
@pixelflinger @bejado @xiamingwei-sudo and others