mrdoob / three.js

JavaScript 3D Library.
https://threejs.org/
MIT License
102.54k stars 35.37k forks source link

Geometry cube example crash in iOS 18.0 beta 7 in simulator #29352

Closed vogloblinsky closed 1 month ago

vogloblinsky commented 1 month ago

Description

Hi, Just trying to open : https://threejs.org/examples/#webgl_geometry_cube in a simulator of iOS 18.0 beta 7, in Safari just gives me these errors in the console, and no rendering in the browser. In a simulator with iOS 18.1 beta 2, it works fine.

[Error] THREE.WebGLProgram: Shader Error 1282 - VALIDATE_STATUS false

Material Name: 
Material Type: MeshBasicMaterial

Program Info Log: Internal error compiling shader with Metal backend.
<built-in>:1:2: fatal error: file '/Users/vincent/Library/Developer/CoreSimulator/Devices/06E68FE1-7888-4D4F-A0F0-21B3B698D587/data/Containers/Data/Application/80C250A4-A61A-4ED0-8797-94D078968E94/Library/Caches/com.apple.WebKit.GPU/3QLOW91JXVL0S/monolithic_metal.pcm' is not a valid precompiled module file
#include "metal_types"
 ^

-----

#include <metal_stdlib>

#define ANGLE_ALWAYS_INLINE __attribute__((always_inline))

ANGLE_ALWAYS_INLINE int ANGLE_int_clamp(int value, int minValue, int maxValue)
{
    return ((value < minValue) ?  minValue : ((value > maxValue) ? maxValue : value));
};

#if TRANSFORM_FEEDBACK_ENABLED
    #define __VERTEX_OUT(args) void
#else
    #define __VERTEX_OUT(args) args
#endif

#define ANGLE_tensor metal::array
#pragma clang diagnostic ignored "-Wunused-value"
#define ANGLE_SAMPLE_COMPARE_GRADIENT_INDEX   0
#define ANGLE_SAMPLE_COMPARE_LOD_INDEX        1
#define ANGLE_RASTERIZATION_DISCARD_INDEX     2
#define ANGLE_MULTISAMPLED_RENDERING_INDEX    3
#define ANGLE_DEPTH_WRITE_ENABLED_INDEX       4
#define ANGLE_EMULATE_ALPHA_TO_COVERAGE_INDEX 5
#define ANGLE_WRITE_HELPER_SAMPLE_MASK_INDEX  6

constant bool ANGLEUseSampleCompareGradient [[function_constant(ANGLE_SAMPLE_COMPARE_GRADIENT_INDEX)]];
constant bool ANGLEUseSampleCompareLod      [[function_constant(ANGLE_SAMPLE_COMPARE_LOD_INDEX)]];
constant bool ANGLERasterizerDisabled       [[function_constant(ANGLE_RASTERIZATION_DISCARD_INDEX)]];
constant bool ANGLEMultisampledRendering    [[function_constant(ANGLE_MULTISAMPLED_RENDERING_INDEX)]];
constant bool ANGLEDepthWriteEnabled        [[function_constant(ANGLE_DEPTH_WRITE_ENABLED_INDEX)]];
constant bool ANGLEEmulateAlphaToCoverage   [[function_constant(ANGLE_EMULATE_ALPHA_TO_COVERAGE_INDEX)]];
constant bool ANGLEWriteHelperSampleMask    [[function_constant(ANGLE_WRITE_HELPER_SAMPLE_MASK_INDEX)]];

#define ANGLE_ALPHA0

struct ANGLEDepthRangeParams
{
  float ANGLE_near;
  float ANGLE_far;
  float ANGLE_diff;
};

struct ANGLEUniformBlock
{
  metal::uint2 ANGLE_acbBufferOffsets;
  metal::float2 ANGLE_depthRange;
  uint32_t ANGLE_renderArea;
  uint32_t ANGLE_flipXY;
  uint32_t ANGLE_dither;
  uint32_t ANGLE_misc;
  metal::int4 ANGLE_xfbBufferOffsets;
  int ANGLE_xfbVerticesPerInstance;
  uint32_t ANGLE_coverageMask;
  metal::uint2 ANGLE_unused;
};

struct ANGLE_UserUniforms
{
  metal::float4x4 _umodelViewMatrix;
  metal::float4x4 _uprojectionMatrix;
  metal::float3x3 _umapTransform;
};

struct ANGLE_VertexOut
{
  metal::float2 _uvMapUv;
  metal::float4 gl_Position [[position]];
};

struct ANGLE_VertexIn
{
  metal::float3 _uposition[[attribute(0)]];
  metal::float2 _uuv[[attribute(2)]];
};

metal::float4 ANGLE_s164b(float ANGLE_s164c, float ANGLE_s164d, float ANGLE_s164e, float ANGLE_s164f)
{
  metal::float4 ANGLE__1 = metal::float4(ANGLE_s164c, ANGLE_s164d, ANGLE_s164e, ANGLE_s164f);
  return ANGLE__1;;
}

metal::float4 ANGLE_s1648(metal::float3 ANGLE_s1649, float ANGLE_s164a)
{
  metal::float4 ANGLE__2 = metal::float4(ANGLE_s1649.x, ANGLE_s1649.y, ANGLE_s1649.z, ANGLE_s164a);
  return ANGLE__2;;
}

metal::float3 ANGLE_s1645(metal::float2 ANGLE_s1646, int ANGLE_s1647)
{
  float ANGLE__3 = float(ANGLE_s1647);
  metal::float3 ANGLE__4 = metal::float3(ANGLE_s1646.x, ANGLE_s1646.y, ANGLE__3);
  return ANGLE__4;;
}

void ANGLE__0_main(thread ANGLE_VertexOut & ANGLE_vertexOut, thread ANGLE_VertexIn & ANGLE_vertexIn, constant ANGLE_UserUniforms & ANGLE_userUniforms)
{
  ANGLE_vertexOut.gl_Position = metal::float4(0.0f, 0.0f, 0.0f, 0.0f);
  ANGLE_vertexOut._uvMapUv = metal::float2(0.0f, 0.0f);
  metal::float3 ANGLE__5 = ANGLE_s1645(ANGLE_vertexIn._uuv, 1);
  metal::float3 ANGLE__6 = (ANGLE_userUniforms._umapTransform * ANGLE__5);
  ANGLE_vertexOut._uvMapUv = ANGLE__6.xy;
  metal::float3 _utransformed = ANGLE_vertexIn._uposition;
  metal::float4 _umvPosition = ANGLE_s1648(_utransformed, 1.0f);
  _umvPosition = (ANGLE_userUniforms._umodelViewMatrix * _umvPosition);
  ANGLE_vertexOut.gl_Position = (ANGLE_userUniforms._uprojectionMatrix * _umvPosition);
}

vertex __VERTEX_OUT(ANGLE_VertexOut)  main0(ANGLE_VertexIn ANGLE_vertexIn [[stage_in]], constant ANGLE_UserUniforms & ANGLE_userUniforms [[buffer(19)]], constant ANGLEUniformBlock & ANGLE_angleUniforms [[buffer(17)]], uint32_t ANGLE_instanceIdMod [[instance_id]], uint32_t ANGLE_baseInstance [[base_instance]], uint32_t ANGLE_vertexIDMetal [[vertex_id]]  )
{
  ANGLE_VertexOut ANGLE_vertexOut;
  {
    ANGLE__0_main(ANGLE_vertexOut, ANGLE_vertexIn, ANGLE_userUniforms);

    float ANGLE__11;
    if (ANGLE_angleUniforms.ANGLE_depthRange.y < ANGLE_angleUniforms.ANGLE_depthRange.x)
    {
      ANGLE__11 = -1.0f;
    }
    else
    {
      ANGLE__11 = 1.0f;
    }
    ANGLE_vertexOut.gl_Position.z = (ANGLE_vertexOut.gl_Position.z * ANGLE__11);
    uint32_t ANGLE__13 = (ANGLE_angleUniforms.ANGLE_misc >> 20u);
    uint32_t ANGLE__14 = (ANGLE__13 & 1u);
    bool ANGLE__15 = bool(ANGLE__14);
    if (ANGLE__15)
    {
      float ANGLE__16 = (ANGLE_vertexOut.gl_Position.z + ANGLE_vertexOut.gl_Position.w);
      ANGLE_vertexOut.gl_Position.z = (ANGLE__16 * 0.5f);
    } else {}
    metal::float4 ANGLE__18 = metal::unpack_snorm4x8_to_float(ANGLE_angleUniforms.ANGLE_flipXY);
    ANGLE_vertexOut.gl_Position.y = (ANGLE_vertexOut.gl_Position.y * ANGLE__18.w);
    if (ANGLERasterizerDisabled)
    {
      ANGLE_vertexOut.gl_Position = ANGLE_s164b(-3.0f, -3.0f, -3.0f, 1.0f);
    } else {}
  }
  #if TRANSFORM_FEEDBACK_ENABLED
  return;
  #else
  return ANGLE_vertexOut;
  #endif

}

-----

    onFirstUse (three.module.js:20195)
    (anonymous function) (three.module.js:20268)
    setProgram (three.module.js:30544)
    (anonymous function) (three.module.js:29340)
    renderObject (three.module.js:30211)
    renderObjects (three.module.js:30180)
    renderScene (three.module.js:30029)
    (anonymous function) (three.module.js:29847)
    animate (webgl_geometry_cube.html:70)
    onAnimationFrame (three.module.js:29682)
    onAnimationFrame (three.module.js:13485)
[Error] WebGL: INVALID_OPERATION: useProgram: program not valid
    useProgram
    useProgram (three.module.js:23086)
    setProgram (three.module.js:30547)
    (anonymous function) (three.module.js:29340)
    renderObject (three.module.js:30211)
    renderObjects (three.module.js:30180)
    renderScene (three.module.js:30029)
    (anonymous function) (three.module.js:29847)
    animate (webgl_geometry_cube.html:70)
    onAnimationFrame (three.module.js:29682)
    onAnimationFrame (three.module.js:13485)
WebGL: INVALID_OPERATION: Vertex shader input type does not match the type of the bound vertex attribute.

Reproduction steps

  1. start a simulator with iOS 18.0 beta 7
  2. open https://threejs.org/examples/#webgl_geometry_cube in Safari

Code

// code goes here

Live example

Screenshots

No response

Version

r168

Device

Mobile

Browser

Safari

OS

iOS

mrdoob commented 1 month ago

Please report this to Apple instead.