( powerPreference: GPUPowerPreference = "high-performance", )
| 117 | } |
| 118 | |
| 119 | async function requestWebGPUAdapter( |
| 120 | powerPreference: GPUPowerPreference = "high-performance", |
| 121 | ): Promise<GPUAdapter | null> { |
| 122 | let preferredAdapter: GPUAdapter | null = null; |
| 123 | try { |
| 124 | preferredAdapter = await navigator.gpu.requestAdapter({ |
| 125 | powerPreference, |
| 126 | }); |
| 127 | } catch {} |
| 128 | return preferredAdapter ?? navigator.gpu.requestAdapter(); |
| 129 | } |
| 130 | |
| 131 | export async function isWebGPUSupported( |
| 132 | powerPreference: GPUPowerPreference = "high-performance", |
no outgoing calls
no test coverage detected