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

Add WebGPU support #2023

Open
32 of 41 tasks
Tracked by #357
hugoam opened this issue Feb 4, 2020 · 11 comments
Open
32 of 41 tasks
Tracked by #357

Add WebGPU support #2023

hugoam opened this issue Feb 4, 2020 · 11 comments
Assignees

Comments

@hugoam
Copy link
Contributor

hugoam commented Feb 4, 2020

I'm implementing the WebGPU backend over here: https://github.com/hugoam/bgfx
I thought I'd open this issue to keep track of where I'm at, in a similar way you did for Vulkan
Here are the examples I've got working so far (so far the web builds at each link work in Chrome canary on Windows or OSX):

@bkaradzic
Copy link
Owner

20-nanovg
error - Buffer subdata size must be a multiple of 4 bytes

This sounds exactly like Metal requirement. See Metal renderer for fix:

bgfx/src/renderer_mtl.mm

Lines 2563 to 2564 in e7b8606

uint32_t start = _offset & 4;
uint32_t end = bx::strideAlign(_offset + _size, 4);

@slimshader
Copy link

Hi, I am not able to run any of the demos due to (Chrome and Firefox):
image

@kainino0x
Copy link

kainino0x commented Mar 8, 2023

The WebGPU API has changed in the past few years and most likely bgfx needs a lot of updates as I don't think it's been worked on in a long time. Additionally Chrome and Firefox haven't quite finished reaching parity yet. If you're developing please use the latest Chrome Canary / Firefox Nightly.

This particular issue says navigator.gpu must not be available. WebGPU hasn't shipped yet. Make sure you're enabling WebGPU either with a chrome Origin Trial or chrome://flags/#enable-unsafe-webgpu [EDIT: fixed] or firefox about:config (dom.webgpu.enabled and maybe gfx.webrender.all).
Also note webgpu requires a secure context (https or localhost).

@bkaradzic
Copy link
Owner

Yep, it's just experimental. We'll look into it once browsers get WebGPU by default, without turning on "developer" features.

@slimshader
Copy link

I am actuallu using latest browser versions and enabled developer mode for webgpu on chrome. Are you sauing it should work?

@kainino0x
Copy link

Apologies I pasted the wrong flag name. It's not enable-webgpu-developer-features, it's enable-unsafe-webgpu.
chrome://flags/#enable-unsafe-webgpu

Fixed above

@slimshader
Copy link

Apologies I pasted the wrong flag name. It's not enable-webgpu-developer-features, it's enable-unsafe-webgpu. chrome://flags/#enable-unsafe-webgpu

Fixed above

no problem and thank you for fast response, it indeed helped with my issue but generated a lot of new errors so I guess the time isn’t right just yet for webgpu

@kainino0x
Copy link

WebGPU is ready, but bgfx needs lots of work :)

@bkaradzic
Copy link
Owner

WebGPU is ready, but bgfx needs lots of work :)

As of 3/8/2023 not available in any browser by default:
https://caniuse.com/?search=webgpu

Anyhow WebGPU is experimental in bgfx. Work on it will resume once all relevant desktop browsers (Chrome, Firefox, Safari) enable it by default. Until then there won't be any work on it. WebGL is fully functional...

@kainino0x
Copy link

Right. Chrome is aiming to release in 113 or 114 (early may or june in stable). The implementation is very well ready for development, so now is a good time if anyone out there happens to want to bring bgfx up to date to have it working around the time Chrome ships.

But of course it shouldn't have urgent priority for bgfx developers, since WebGL is working. Probably more of an idea for an external contributor if any want to pick it up :)

@bkaradzic
Copy link
Owner

@kainino0x As development of WebGPU took a while, we won't rush either just because one browser supports it. Once it's in Safari, and Firefox, without any developer flags we'll consider it again. One of things we need to figure out before port is tooling how to translate shaders from bgfx shaderc into WGSL (Tint or Naga).

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

No branches or pull requests

4 participants