Skip to content

Crash in metal shader compiler #9518

@kpeeters

Description

@kpeeters

Describe the bug
With 1.68.1 on iOS, I am getting an error somewhere in the shader compilation:

program_source:105:1: error: type 'const constant ShadowUniforms *' is not valid for attribute 'id'
constant ShadowUniforms* shadowUniforms [[id(2)]];
^                                         ~~~~~
program_source:130:50: error: type 'const constant spvDescriptorSetBuffer0 &' is not valid for attribute 'buffer'
vertex main0_out main0(main0_in in [[stage_in]], constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(21)]], constant spvDescriptorSetBuffer2& spvDescriptorSet2 [[buffer(23)]], constant uint* spvDynamicOffsets [[buffer(25)]], uint gl_InstanceIndex [[instance_id]])

*** First throw call stack:
(
	0   CoreFoundation                      0x000000018b167ae0 __exceptionPreprocess + 176
	1   libobjc.A.dylib                     0x000000018ac2ab90 objc_exception_throw + 88
	2   CoreFoundation                      0x000000018b18c154 _CFBundleGetValueForInfoKey + 0
	3   alq4                                0x000000010609df7c _ZNK8filament7backend19MetalShaderCompiler19MetalFunctionBundle8validateEv + 168
	4   alq4                                0x0000000106090ab8 _ZN8filament7backend18ConcreteDispatcherINS0_11MetalDriverEE4drawERNS0_6DriverEPNS0_11CommandBaseEPl + 332
	5   alq4                                0x000000010632fa78 _ZNSt3__110__function6__funcIZN8filament7backend13CommandStream7executeEPvE3$_0NS_9allocatorIS6_EEFvvEEclEv + 48
	6   alq4                                0x00000001060929a0 _ZN8filament7backend11MetalDriver7executeERKNSt3__18functionIFvvEEE + 44
	7   alq4                                0x00000001060659b0 _ZN8filament7backend13CommandStream7executeEPv + 100
	8   alq4                                0x000000010632c390 _ZN8filament7FEngine4loopEv + 388
	9   alq4                                0x000000010603ea24 _ZNSt3__114__thread_proxyB8nn200100INS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEMN8filament7FEngineEFivEPS8_EEEEEPvSD_ + 64
	10  libsystem_pthread.dylib             0x000000010231508c _pthread_start + 136
	11  libsystem_pthread.dylib             0x000000010231ef10 thread_start + 8
)

This used to work fine around version 1.66.2 and slightly after that.

To Reproduce
This is inside a large project, will investigate with smaller samples next, just thought to flag this in case it rings a bell.

Expected behavior
No crash.

Logs
See above.

Desktop (please complete the following information):

  • OS: iOS, building for running on "My Mac"
  • GPU: Apple M1
  • Backend: Metal

Metadata

Metadata

Assignees

Labels

gpu specificThis bug occurs only with a single GPU vendor.iosIssue/request for iOS only

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions