autokap 1.3.7 → 1.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +30 -8
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -810,23 +810,45 @@ export class Browser {
|
|
|
810
810
|
const instance = new Browser(options);
|
|
811
811
|
const deviceScaleFactor = normalizeDeviceScaleFactor(options.deviceScaleFactor);
|
|
812
812
|
// Enable GPU compositor on non-Linux platforms so Chrome can render
|
|
813
|
-
// 2880×1800 without saturating the CPU. Linux
|
|
814
|
-
//
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
//
|
|
813
|
+
// 2880×1800 without saturating the CPU. Linux cloud runners get
|
|
814
|
+
// SwiftShader (multi-threaded software ANGLE) instead of `--disable-gpu`
|
|
815
|
+
// because the default CPU rasterizer caps CDP screenshots at ~165 ms each
|
|
816
|
+
// → 6 fps clips on heavy React pages. SwiftShader's JIT'd SIMD raster
|
|
817
|
+
// paths use Fly's 8 vCPUs properly (measured: ~5× faster compositor).
|
|
818
|
+
// Non-cloud Linux (GitHub Actions free runners, 2 vCPU) stays on the
|
|
819
|
+
// legacy CPU path — SwiftShader has thread-pool overhead that hurts on
|
|
820
|
+
// tight CI machines.
|
|
821
|
+
const isCloudRunner = process.env.AUTOKAP_CLOUD_RUNNER === '1';
|
|
822
|
+
const isLinuxCloud = process.platform === 'linux' && isCloudRunner;
|
|
823
|
+
const baseArgs = isLinuxCloud || process.platform !== 'linux'
|
|
824
|
+
? CHROMIUM_ARGS.filter(arg => arg !== '--disable-gpu' && arg !== '--disable-gpu-sandbox')
|
|
825
|
+
: CHROMIUM_ARGS;
|
|
826
|
+
// Pin ANGLE to the platform's fast graphics backend. Chrome's default
|
|
819
827
|
// backend is OpenGL on macOS, which is far slower than Metal for the
|
|
820
828
|
// compositor (measured 4 FPS vs 32 FPS at 2880×1800 on a heavy React UI).
|
|
821
|
-
// Same story on Windows where D3D11 is the native fast path.
|
|
829
|
+
// Same story on Windows where D3D11 is the native fast path. On Linux
|
|
830
|
+
// cloud, SwiftShader is the multi-threaded software backend.
|
|
822
831
|
const angleArg = process.platform === 'darwin' ? '--use-angle=metal'
|
|
823
832
|
: process.platform === 'win32' ? '--use-angle=d3d11'
|
|
824
|
-
:
|
|
833
|
+
: isLinuxCloud ? '--use-angle=swiftshader'
|
|
834
|
+
: null;
|
|
835
|
+
// Cloud-Linux extras: route GL through ANGLE, opt in to SwiftShader
|
|
836
|
+
// explicitly (Chromium 124+ requires `--enable-unsafe-swiftshader` since
|
|
837
|
+
// SwiftShader was tagged unsafe for general WebGL — for our headless
|
|
838
|
+
// captures the security caveat is irrelevant), and bypass the GPU
|
|
839
|
+
// blocklist that otherwise refuses any GPU path on unrecognized headless
|
|
840
|
+
// hardware.
|
|
841
|
+
const linuxCloudGpuArgs = isLinuxCloud ? [
|
|
842
|
+
'--use-gl=angle',
|
|
843
|
+
'--enable-unsafe-swiftshader',
|
|
844
|
+
'--ignore-gpu-blocklist',
|
|
845
|
+
] : [];
|
|
825
846
|
const clipArgs = [
|
|
826
847
|
...baseArgs,
|
|
827
848
|
`--force-device-scale-factor=${deviceScaleFactor}`,
|
|
828
849
|
`--window-size=${Math.round(options.viewport.width)},${Math.round(options.viewport.height)}`,
|
|
829
850
|
...(angleArg ? [angleArg] : []),
|
|
851
|
+
...linuxCloudGpuArgs,
|
|
830
852
|
];
|
|
831
853
|
// Dedicated browser process for clip capture. Not pooled because clip
|
|
832
854
|
// capture installs context-level init scripts (cursor overlay).
|