detect-gpu icon indicating copy to clipboard operation
detect-gpu copied to clipboard

Add support for Apple silicon gpus on desktop Safari

Open mcoliver opened this issue 4 months ago • 2 comments

Current version fallsback for all apple silicon gpus.

{
  "gpu": "apple gpu (Apple GPU)",
  "isMobile": false,
  "tier": 1,
  "type": "FALLBACK"
}

This change will support up to m4 chips

{
  "fps": 120,
  "gpu": "apple m4 max",
  "isMobile": false,
  "tier": 3,
  "type": "BENCHMARK"
}

Also includes a new html page that outputs all the available WebGL info WebGL Information:

{
  "vendor": "WebKit",
  "renderer": "WebKit WebGL",
  "webglVersion": "WebGL 1.0",
  "unmaskedVendor": "Apple Inc.",
  "unmaskedRenderer": "Apple GPU",
  "capabilities": {
    "maxTextureSize": 16384,
    "maxVertexUniformVectors": 1024,
    "maxFragmentUniformVectors": 1024,
    "maxVaryingVectors": 30,
    "maxRenderbufferSize": 16384
  }
}

mcoliver avatar Jul 31 '25 15:07 mcoliver

Fixes a lot of issues including #111 #99 #98 #88

mcoliver avatar Jul 31 '25 15:07 mcoliver

Thanks for the pull request. I tried getAppleGPUFromCapabilities on some Apple silicon desktops:M1 Max (Macbook Pro), M2 (Mac Mini), M4 (Mac Mini). It gave the same score for all of them: 19.875.. Causing them all to be detected as m3 pro/ m4 max. Note that I had to remove the chipsets.length === desktopChipsets.length check, since otherwise getAppleGPUFromCapabilities wasn't used at all. All tested using Safari 18.5.

They all report:

max3DTextureSize: 0
maxArrayTextureLayers: 0
maxColorAttachments: 4
maxCombinedTextureImageUnits: 32
maxDrawBuffers: 4
maxFragmentUniformVectors: 1024
maxRenderbufferSize: 16384
maxTextureSize: 16384
maxVaryingVectors: 30
maxVertexTextureImageUnits: 16
maxVertexUniformVectors: 1024

puckey avatar Sep 17 '25 09:09 puckey