@@ -50,7 +50,7 @@ interface Viewport {
5050 hasTouch ?: boolean ;
5151}
5252
53- const nodeMajorVersion = parseInt ( process . versions . node . split ( "." ) [ 0 ] ?? '' ) ;
53+ const nodeMajorVersion = parseInt ( process . versions . node . split ( "." ) [ 0 ] ?? "" ) ;
5454
5555// Setup the lambda environment
5656if ( isRunningInAwsLambda ( nodeMajorVersion ) ) {
@@ -203,11 +203,14 @@ class Chromium {
203203 ] ;
204204
205205 // https://chromium.googlesource.com/chromium/src/+/main/docs/gpu/swiftshader.md
206- // Blocked by https://github.com/Sparticuz/chromium/issues/247
207- //this.graphics
208- // ? graphicsFlags.push("--use-gl=angle", "--use-angle=swiftshader")
209- // : graphicsFlags.push("--disable-webgl");
210- graphicsFlags . push ( "--use-gl=angle" , "--use-angle=swiftshader" ) ;
206+ this . graphics
207+ ? graphicsFlags . push (
208+ // As the unsafe WebGL fallback, SwANGLE (ANGLE + SwiftShader Vulkan)
209+ "--use-gl=angle" ,
210+ "--use-angle=swiftshader" ,
211+ "--enable-unsafe-swiftshader"
212+ )
213+ : graphicsFlags . push ( "--disable-webgl" ) ;
211214
212215 const insecureFlags = [
213216 "--allow-running-insecure-content" , // https://source.chromium.org/search?q=lang:cpp+symbol:kAllowRunningInsecureContent&ss=chromium
@@ -293,11 +296,8 @@ class Chromium {
293296 const promises = [
294297 LambdaFS . inflate ( `${ input } /chromium.br` ) ,
295298 LambdaFS . inflate ( `${ input } /fonts.tar.br` ) ,
299+ LambdaFS . inflate ( `${ input } /swiftshader.tar.br` ) ,
296300 ] ;
297- if ( this . graphics ) {
298- // Only inflate graphics stack if needed
299- promises . push ( LambdaFS . inflate ( `${ input } /swiftshader.tar.br` ) ) ;
300- }
301301 if ( isRunningInAwsLambda ( nodeMajorVersion ) ) {
302302 // If running in AWS Lambda, extract more required files
303303 promises . push ( LambdaFS . inflate ( `${ input } /al2.tar.br` ) ) ;
@@ -346,7 +346,6 @@ class Chromium {
346346 * Sets whether the graphics stack is enabled or disabled.
347347 * @param true means the stack is enabled. WebGL will work.
348348 * @param false means that the stack is disabled. WebGL will not work.
349- * `false` will also skip the extract of the graphics driver, saving about a second during initial extract
350349 * @default true
351350 */
352351 public static set setGraphicsMode ( value : boolean ) {
@@ -355,11 +354,7 @@ class Chromium {
355354 `Graphics mode must be a boolean, you entered '${ value } '`
356355 ) ;
357356 }
358-
359- // Disabling 'disabling the gpu'
360- // Blocked by https://github.com/Sparticuz/chromium/issues/247
361- // this.graphicsMode = value;
362- this . graphicsMode = true ;
357+ this . graphicsMode = value ;
363358 }
364359}
365360
0 commit comments