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

Regression: no WebGL support on Linux from v0.72.0+ #8043

Closed
AshleyScirra opened this issue Mar 20, 2023 · 13 comments
Closed

Regression: no WebGL support on Linux from v0.72.0+ #8043

AshleyScirra opened this issue Mar 20, 2023 · 13 comments
Assignees
Labels

Comments

@AshleyScirra
Copy link

AshleyScirra commented Mar 20, 2023

Summary

WebGL used to work in NW.js on Linux. The last version it works in is v0.71.1. The first version it stopped working in is v0.72.0. It still doesn't work in the latest v0.74.0.

The easiest way to reproduce this is to download one of the official Linux 64-bit releases, extract on the system, and run nw. Press F12 to open dev tools. Enter the following lines:

const canvas = document.createElement("canvas");
const gl = canvas.getContext("webgl2");
gl

The last line will show the value of gl in the console.

Current/Missing Behavior

canvas.getContext("webgl2") returns null in v0.72.0+

Expected/Proposed Behavior

canvas.getContext("webgl2") returns a WebGL2RenderingContext, as it does in v0.71.1 and before

Additional Info

Tested on:

  • Operating System: Ubuntu 22.04.2 LTS (64-bit)
  • NW.js Version: 0.72.0 - 0.74.0

This breaks all usages of WebGL in NW.js on Linux, including all games made in Construct (www.construct.net).

It's possible to get to chrome://gpu in NW.js - enter location = "chrome://gpu" in the console and it takes you to the Chromium GPU internals page. That appears to have a line indicating that GPU compositing is disabled, which may be related (and it also lists WebGL as "hardware accelerated but at reduced performance").

WebGL still seems to work fine on Windows, so this seems to be an issue specific to Linux.

Thanks for all your work on NW.js!

@rogerwang
Copy link
Member

rogerwang commented Mar 20, 2023 via email

@AshleyScirra
Copy link
Author

Yep, Chromium 111 is working fine with hardware-accelerated WebGL on the same system. Here's exports of chrome://gpu from both Chromium and NW.js 0.74:

Chromium111-Ubuntu-GPU.pdf
NWjs074-Ubuntu-GPU.pdf

@ayushmanchhabra
Copy link
Contributor

ayushmanchhabra commented Apr 21, 2023

https://github.com/nwutils/nw-api-sanity-check/actions/runs/4768650887/jobs/8478201622?pr=15#step:6:11
@AshleyScirra WebGL seems to be working on v0.75.0. Could you verify on your end?

@AshleyScirra
Copy link
Author

I'm afraid it's still not working for me with v0.75.0, although it works slightly differently now. I can get a WebGL 1 context, but it runs very slowly, and logs various GPU warning messages to the console. I still cannot get a WebGL 2 context. Here's what the chrome://gpu page says in NW.js v0.75.0: NWjs075-Ubuntu-GPU.pdf

@AshleyScirra
Copy link
Author

We are still getting reports of this, particularly because it appears to prevent any content working on the Steam Deck: Scirra/Construct-bugs#7034
As per my previous comment it still does not appear to be working correctly with NW.js 0.75 - any more news on this issue?

@rogerwang
Copy link
Member

Does this switch make any difference? --disable-features=CanvasOopRasterization

@AshleyScirra
Copy link
Author

I tried adding that to chromium-args in package.json with a test export using v0.76.0 but it didn't seem to make any difference I'm afraid. Still the same result as before:

I can get a WebGL 1 context, but it runs very slowly, and logs various GPU warning messages to the console.

@AshleyScirra
Copy link
Author

Any news on this? For our use case this means both us and all our customers can't use NW.js v0.72+ at all, and sooner or later there'll be some reason we have to update.

@rogerwang
Copy link
Member

It works for me here with Ubuntu 23.04 with a Intel GPU. Will probably need to find a system with Nvidia card to reproduce ...

@bluthen
Copy link
Contributor

bluthen commented Aug 22, 2023

I have NVIDIA card here on 22.04.2 LTS, ran nwjs 0.78.1 I had downloaded already and webgl works for me.

GeForce GTX 1060 6GB
chrome://gpu -- WebGL and WebGL2 Hardware accelerated

But I thought the Steamdeck has AMD RDNA 2 chipset right?

@rogerwang
Copy link
Member

Yep, Chromium 111 is working fine with hardware-accelerated WebGL on the same system. Here's exports of chrome://gpu from both Chromium and NW.js 0.74:

Chromium111-Ubuntu-GPU.pdf NWjs074-Ubuntu-GPU.pdf

In this log, NW is using the vulkan backend while Chromium is not. So try this with nw: --disable-features=Vulkan

@AshleyScirra
Copy link
Author

I finally got round to testing this again, and adding --disable-features=Vulkan to "chomium-args" in package.json does the trick - performance is much better, chrome://gpu reports hardware accelerated WebGL, and does not log any GPU warnings to the console. So I would guess for some reason NW.js has started using the Vulkan backend whilst Chromium still does not use the Vulkan backend, and that Vulkan support on some Linux system setups is kind of broken.

At least we have a workaround which is good! (Construct users: put --disable-features=Vulkan in the 'Command line options' field when exporting and it should work better.) However this still leaves the question: how come NW.js is switching to the Vulkan backend when Chromium does not? Perhaps Google knows the Vulkan backend doesn't work properly on Linux yet so is leaving it disabled, but that configuration is not applied for NW.js.

@rogerwang
Copy link
Member

rogerwang commented Sep 5, 2023

However this still leaves the question: how come NW.js is switching to the Vulkan backend when Chromium does not?

It was turned on via field trial. Now field trial is disabled via fcfd64d

Try the dev build here: https://dl.nwjs.io/live-build/nw79/20230824-202151/fcfd64da1/v0.79.2/

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

No branches or pull requests

4 participants