ShardBrowser icon indicating copy to clipboard operation
ShardBrowser copied to clipboard

GPU probe runs on about:blank (not a secure context): navigator.gpu is undefined, host-gl-caps.json records webgpu [] and every preset shows GPU mismatch

Open angeloathayde opened this issue 2 months ago • 1 comments

Environment: ShardX Launcher 2.0.2, Windows 11, RTX 5090 (D3D12), engine Chromium 152 build 3.

What happens

Right after upgrading to 2.0.2 every preset in the Fingerprint Library shows GPU mismatch. %APPDATA%\shardx-launcher\host-gl-caps.json was written at first launch with:

"webgpu": []

and compat() reads Some([]) as "this machine has no WebGPU adapter", so every feature a preset declares is missing_webgpu (19–23 per preset) → all 37 flagged. The machine does have WebGPU: a profile started by the launcher reports 20 adapter features (nvidia/turing after the spoof; the host set is bgra8unorm-storage, clip-distances, core-features-and-limits, depth-clip-control, depth32float-stencil8, dual-source-blending, float32-blendable, float32-filterable, indirect-first-instance, primitive-index, rg11b10ufloat-renderable, shader-f16, subgroup-size-control, subgroups, texture-component-swizzle, texture-compression-bc, texture-compression-bc-sliced-3d, texture-formats-tier1, texture-formats-tier2, timestamp-query).

Cause

gpu_caps::probe starts the engine on about:blank and evaluates navigator.gpu ? await navigator.gpu.requestAdapter() : null. A top-level about:blank opened from the command line has an opaque origin: isSecureContext === false, and WebGPU is [SecureContext], so navigator.gpu is undefined and the probe records webgpu: []. Reproduced with the same flags (--remote-debugging-port, scratch --user-data-dir, --window-position=-32000,-32000, about:blank) and Runtime.evaluate:

{"href":"about:blank","secure":false,"hasGpu":false,"renderer":"ANGLE (...) Direct3D11 ...","webgl2Ext":32}

WebGL is unaffected (no secure-context requirement), which is why webgl1/webgl2 in the cache are correct and only the WebGPU half is wrong.

Effect beyond the badge

cached() treats Some([]) as a valid answer and never re-probes for the same engine version, so the wrong list is permanent until the next Chromium bump; there is no re-probe control in the UI.

Suggestion

Probe from a secure context — e.g. serve a blank page from the launcher's own local API (http://127.0.0.1:<port>/… is potentially trustworthy) or navigate to a file:// page — and/or treat navigator.gpu === undefined as "unknown" (None) rather than "no adapter" (Some([])), plus a "Re-check GPU" action in Settings.

Local workaround that confirmed the diagnosis: writing the 20 real features into host-gl-caps.json turns 27/37 presets green; the remaining 10 (win-gtx1650ti, win-rtx2060, win-rtx2070, win-rtx2070super, win-rtx4050, win-rtx4060, win-rtx4060ti, win-rtx4070ti, win-rtx4080, win-rtx4090) are the ones over-claiming ASTC/ETC2 (#62).

angeloathayde avatar Sep 12 '26 22:09 angeloathayde

in v2.0.3

ProxyShard avatar Sep 13 '26 12:09 ProxyShard