Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGL support #30

Closed
michaeltmiller opened this issue Apr 3, 2019 · 9 comments
Closed

WebGL support #30

michaeltmiller opened this issue Apr 3, 2019 · 9 comments
Labels
enhancement New feature or request

Comments

@michaeltmiller
Copy link

I'm attempting to use this binary to create PDFs from pages that include WebGL canvas elements created by Mapbox. Basically I'm wondering if this should this work out of the box with the default flags, or different set of flags and/or a custom built binary will be necessary(to enable something like swiftshader).

With version 1.14.0 and the default args exposed by this package, and visiting somewhere like:
https://docs.mapbox.com/mapbox-gl-js/example/simple-map/
or
http://mapbox.github.io/mapbox-gl-supported/diagnostics.html
and attempting to generate a PDF results in blank spots in the PDF.

If this is something you think should be supported, then I can provide a more fleshed out reproducer.

@alixaxel
Copy link
Owner

alixaxel commented Apr 5, 2019

@michaeltmiller I don't see why that shouldn't be supported, so I'd be happy to look into it if you could provide some steps to replicate. Also, is this something that affects puppeteer as well or just this package? If the former, it might be better to open an issue with puppeteer repo instead.

@michaeltmiller
Copy link
Author

michaeltmiller commented Apr 8, 2019

This issue can probably be closed as I've found a workaround.

Copying the swiftshader binaries (libEGL.so & libGLESv2.so) into /tmp/swiftshader as described here , removing --disable-gpu, and adding --enable-webgl to the args array exposed by this package results in webgl canvas rendering as desired.

@alixaxel
Copy link
Owner

alixaxel commented Apr 8, 2019

Thanks for the feedback @michaeltmiller, I compressed these SOs with Brotli and they amount to 981K:

383K libEGL.so
99K  libEGL.so.br
3.4M libGLESv2.so
882K libGLESv2.so.br

Do you think it would be worthwhile shipping these and adding a helper method to enable WebGL support?

@alixaxel
Copy link
Owner

alixaxel commented Apr 8, 2019

Related: puppeteer/puppeteer#1260

@alixaxel alixaxel added the enhancement New feature or request label Apr 8, 2019
@michaeltmiller
Copy link
Author

Absolutely! That would simply our use case moving forward. Looking around the web it seems like it's a problem others are running into as well, so adding support with minimal configuration sounds like a pretty big win to me. Especially if the added overhead is that small for users that don't require it.
Thanks @alixaxel

@TimotheeJeannin
Copy link

It would be nice to have support for WebGL !

@alixaxel
Copy link
Owner

alixaxel commented May 1, 2019

@michaeltmiller @TimotheeJeannin Out of the box support for WebGL been released on 1.15.0.

Let me know if you face any issues.

@TimotheeJeannin
Copy link

Working on my side. :) Thank you!

@hjhimanshu01
Copy link

hjhimanshu01 commented Jul 28, 2021

@alixaxel I'm trying to create a PDF with v10.1.0 on lambda with preserveDrawingBuffer in the mapbox map, though still, the map is empty, not sure why here are my chrome args

[
  '--autoplay-policy=user-gesture-required',
  '--disable-background-networking',
  '--disable-background-timer-throttling',
  '--disable-backgrounding-occluded-windows',
  '--disable-breakpad',
  '--disable-client-side-phishing-detection',
  '--disable-component-update',
  '--disable-default-apps',
  '--disable-dev-shm-usage',
  '--disable-domain-reliability',
  '--disable-extensions',
  '--disable-features=AudioServiceOutOfProcess,IsolateOrigins,site-per-process',
  '--disable-hang-monitor',
  '--disable-ipc-flooding-protection',
  '--disable-offer-store-unmasked-wallet-cards',
  '--disable-popup-blocking',
  '--disable-print-preview',
  '--disable-prompt-on-repost',
  '--disable-renderer-backgrounding',
  '--disable-setuid-sandbox',
  '--disable-speech-api',
  '--disable-sync',
  '--disable-web-security',
  '--disk-cache-size=33554432',
  '--hide-scrollbars',
  '--ignore-gpu-blocklist',
  '--metrics-recording-only',
  '--mute-audio',
  '--no-default-browser-check',
  '--no-first-run',
  '--no-pings',
  '--no-sandbox',
  '--no-zygote',
  '--password-store=basic',
  '--use-gl=swiftshader',
  '--use-mock-keychain',
  '--window-size=1920,1080',
  '--start-maximized'
]

Basically the default args, any steps that might be useful for debugging what's going wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants