Skip to content

Commit d97935b

Browse files
committed
fix(engine): scope WebGPU flag to hardware mode
1 parent b37236e commit d97935b

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

packages/engine/src/services/browserManager.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ describe("buildChromeArgs browser GPU mode", () => {
2020
it("uses SwiftShader software GL by default for reproducible local renders", () => {
2121
const args = buildChromeArgs(base);
2222
expect(args).toContain("--enable-features=CanvasDrawElement");
23+
expect(args).not.toContain("--enable-unsafe-webgpu");
2324
expect(args).toContain("--use-gl=angle");
2425
expect(args).toContain("--use-angle=swiftshader");
2526
expect(args).toContain("--enable-unsafe-swiftshader");
@@ -28,6 +29,7 @@ describe("buildChromeArgs browser GPU mode", () => {
2829

2930
it("uses Metal-backed ANGLE for hardware browser GPU mode on macOS", () => {
3031
const args = buildChromeArgs({ ...base, platform: "darwin" }, { browserGpuMode: "hardware" });
32+
expect(args).toContain("--enable-unsafe-webgpu");
3133
expect(args).toContain("--use-gl=angle");
3234
expect(args).toContain("--use-angle=metal");
3335
expect(args).toContain("--enable-gpu-rasterization");

packages/engine/src/services/browserManager.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,6 @@ export function buildChromeArgs(
504504
"--disable-setuid-sandbox",
505505
"--disable-dev-shm-usage",
506506
CANVAS_DRAW_ELEMENT_FEATURE_FLAG,
507-
WEBGPU_FLAG,
508507
"--enable-webgl",
509508
"--ignore-gpu-blocklist",
510509
...getBrowserGpuArgs(browserGpuMode, platform),
@@ -538,6 +537,10 @@ export function buildChromeArgs(
538537
"--disable-features=AudioServiceOutOfProcess,IsolateOrigins,site-per-process,Translate,BackForwardCache,IntensiveWakeUpThrottling",
539538
];
540539

540+
if (browserGpuMode !== "software") {
541+
chromeArgs.push(WEBGPU_FLAG);
542+
}
543+
541544
// BeginFrame flags — only when using chrome-headless-shell on Linux
542545
if (options.captureMode !== "screenshot") {
543546
chromeArgs.push(

0 commit comments

Comments
 (0)