From 2805c139647e52012c26f4fac2be557505ec71d4 Mon Sep 17 00:00:00 2001 From: Marcos Scheeren Date: Wed, 27 Nov 2024 02:00:52 -0300 Subject: [PATCH 1/2] Added powerPreference argument to detectGPUDevice() while keeping old behaviour as default. --- web/src/webgpu.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/webgpu.ts b/web/src/webgpu.ts index 5b2d7c9f30a0..c64e03de626b 100644 --- a/web/src/webgpu.ts +++ b/web/src/webgpu.ts @@ -33,7 +33,7 @@ export interface GPUDeviceDetectOutput { /** * DetectGPU device in the environment. */ -export async function detectGPUDevice(): Promise { +export async function detectGPUDevice(powerPreference: "low-power" | "high-performance" = "high-performance"): Promise { if (typeof navigator !== "undefined" && navigator.gpu !== undefined) { const adapter = await navigator.gpu.requestAdapter({ "powerPreference": "high-performance" }); if (adapter == null) { From 9b7b3d0306b721678d1fe51d10b16c955f415250 Mon Sep 17 00:00:00 2001 From: Marcos Scheeren Date: Wed, 27 Nov 2024 02:07:29 -0300 Subject: [PATCH 2/2] Added powerPreference argument to detectGPUDevice() while keeping old behaviour as default. --- web/src/webgpu.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/webgpu.ts b/web/src/webgpu.ts index c64e03de626b..27d68d887c32 100644 --- a/web/src/webgpu.ts +++ b/web/src/webgpu.ts @@ -35,7 +35,7 @@ export interface GPUDeviceDetectOutput { */ export async function detectGPUDevice(powerPreference: "low-power" | "high-performance" = "high-performance"): Promise { if (typeof navigator !== "undefined" && navigator.gpu !== undefined) { - const adapter = await navigator.gpu.requestAdapter({ "powerPreference": "high-performance" }); + const adapter = await navigator.gpu.requestAdapter({ powerPreference }); if (adapter == null) { throw Error( "Unable to find a compatible GPU. This issue might be because your computer doesn't have a GPU, or your system settings are not configured properly. " +