Hi all,
I stumbled upon a severe performance problem on Safari and Mac Chrome with the Metal ANGLE backend enabled. My app runs 60 FPS without Metal, but depending on the case, something like a few seconds per frame with Metal. Happens on both Intel and M1/M2 Macs. However, I'm unable to track down the culprit and would appreciate some tips on how to proceed.
All examples here are very sluggish with Metal:
https://genomespy.app/
Because many of them are quite complex, I made an as-simple-as-possible example for debugging:
https://karilavikka.fi/slow-on-metal/
According to Chrome's performance recorder, there's barely any GPU utilization on my Intel MacBook Pro (2018) with the OpenGL backend, but around 50% is utilized with Metal. I recorded the WebGL calls of a single frame using spector.js and I think there's nothing special going on:
bindFramebuffer: FRAMEBUFFER, null
viewport: 0, 0, 2694, 1892
disable: SCISSOR_TEST
clearColor: 0, 0, 0, 0
clear: COLOR_BUFFER_BIT
useProgram: WebGLProgram - ID: 0
bindBufferRange: UNIFORM_BUFFER, 1, WebGLBuffer - ID: 6, 0, 28
bufferData: UNIFORM_BUFFER, [--(28)--], DYNAMIC_DRAW
bindVertexArray: WebGLVertexArrayObject - ID: 0
viewport: 124, 84, 2550, 1788
scissor: 124, 84, 2550, 1788
enable: SCISSOR_TEST
bindBufferRange: UNIFORM_BUFFER, 0, WebGLBuffer - ID: 7, 0, 36
bufferData: UNIFORM_BUFFER, [--(36)--], DYNAMIC_DRAW
drawArrays: TRIANGLE_STRIP, 0, 117198
Here's the spector.js capture with full WebGL state, etc.:
https://karilavikka.fi/slow-on-metal/capture.json
I could submit a bug report (where?), but first I'd like to figure out where the bug is – in my app, ANGLE, or elsewhere.
Thanks!
- Kari