iOS: shader compliler crash

Hello!

I run into, what seem to be compiler issue. The shader source given to Metal is: https://shader-playground.timjones.io/1bcf3ffbb313878ccd594ddbb27b746e

This shader is generated by spirv-cross, from GLSL source, so for readability here is original source: https://github.com/Try/OpenGothic/blob/master/shader/hiz/hiz_mip.comp
(shader variant uses SSBO counter, not atomic-image)

Here is relevant path of application log:

2024-04-21 16:27:13.621218+0200 Gothic2Notr[23992:2003969] Compiler failed with XPC_ERROR_CONNECTION_INTERRUPTED
2024-04-21 16:27:13.656559+0200 Gothic2Notr[23992:2003969] Compiler failed with XPC_ERROR_CONNECTION_INTERRUPTED
2024-04-21 16:27:13.701323+0200 Gothic2Notr[23992:2003969] Compiler failed with XPC_ERROR_CONNECTION_INTERRUPTED
2024-04-21 16:27:13.701477+0200 Gothic2Notr[23992:2003969] MTLCompiler: Compilation failed with XPC_ERROR_CONNECTION_INTERRUPTED on 3 try
2024-04-21 16:27:13.701817+0200 Gothic2Notr[23992:2003969] Compiler failed with XPC_ERROR_CONNECTION_INTERRUPTED

iOS version: 15.8.2 MTL::CompileOptions::languageVersion: 2.4 (also tested other version - same result)

Offended part of shader:

void store(int mip, ivec2 uv, float z) {
  // NOTE: replacing this function to NOP, avoid the crash
  // NOTE2: this switch-case is crude emulation of bindless storage-image
  switch(mip) {
    case 1:
      imageStore(mip1, uv, vec4(z));
      break;
    case 2:
      imageStore(mip2, uv, vec4(z));
      break;
    case 3:
      imageStore(mip3, uv, vec4(z));
      break;
    case 4:
      imageStore(mip4, uv, vec4(z));
      break;
    case 5:
      imageStore(mip5, uv, vec4(z));
      break;
    case 6:
      imageStore(mip6, uv, vec4(z));
      break;
    case 7:
      imageStore(mip7, uv, vec4(z));
      break;
    case 8:
      imageStore(mip8, uv, vec4(z));
      break;
    }
  }

Some extra info:

  • The shader is simplified single-pass mip-map generator.
  • The same shader is know to work on mac M1 laptop without any issues

Please have a look and looking forward for driver-fix. Thanks!