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

webgpu support #36

Open
herkhinah opened this issue Feb 16, 2024 · 19 comments
Open

webgpu support #36

herkhinah opened this issue Feb 16, 2024 · 19 comments

Comments

@herkhinah
Copy link

Firefox nightly supposedly has webgpu support but I can't get it running. Firefox complains Validation error without device target: No suitable adapter found. In about:config WebGPU is enabled and the blocklist is disabled and about:support says it can also find my integrated graphics card. Do I have to configure some environment variables so firefox can find some missing libraries?

@colemickens
Copy link
Member

we have historically had issues with firefox-bin variants and hardware acceleration, but it is working for me:

screenshot-1708101156

It doesn't seem like I have anything webgl overriden in my about:config either.

@MatthewCroughan
Copy link

Setting LD_LIBRARY_PATH=/run/opengl-driver/lib on NixOS fixed this for me.

@colemickens
Copy link
Member

I will try to keep this tab open to look at it, but I'm getting swamped from multiple angles in my life right now and don't know when I'll really be able to give this attention.

For what it's worth, I am glad to be aware of this. I'm surprised that Firefox Nightly works as well as it does, seemingly without the same type of wrapper present in nixpkgs wrapped-firefox builds. I was sure that we have had to fix this same opengl/libglvnd wrap issue for this build in the past.

There's a Nix Mozilla Matrix room too, might be worth bringing this up there if someone else wants to investigate more.

@colemickens
Copy link
Member

colemickens commented Apr 28, 2024

This works for me, by just running firefox-nightly: https://toji.github.io/webgpu-test/

When I look at firefox-nightly, it's a shell script that pulls libglvnd in LD_LIBRARY_PATH which should enable gpu driver loading via /run/opengl-driver.

@MatthewCroughan
Copy link

@colemickens yeah, for what it's worth I didn't notice any slowdowns, but also never performed any tests prior to wrapping with LD_LIBRARY_PATH. However, it did make the log lines go away. But maybe the log lines don't mean much in the first place. Who knows!

@Niedzwiedzw
Copy link

Niedzwiedzw commented Sep 12, 2024

hello, I have that problem. I need to get wgpu on firefox running and I'm getting the same error. I'm on AMD gpu, could that be related? LD_LIBRARY_PATH=/run/opengl-driver/lib firefox-nightly doesn't solve it either sadly

@Niedzwiedzw
Copy link

from my about:support / Graphics:

WebGPU Default Adapter    {
  "navigator.gpu.requestAdapter({})": null
}
WebGPU Fallback Adapter    {
  "navigator.gpu.requestAdapter({\"forceFallbackAdapter\":true})": null
}
GPU #1
Active    Yes
Description    AMD Radeon RX 7900 XT (radeonsi, navi31, LLVM 18.1.8, DRM 3.54, 6.6.50)
Vendor ID    0x1002
Device ID    0x744c
Driver Vendor    mesa/radeonsi
Driver Version    24.3.0.0
RAM    0

@colemickens
Copy link
Member

I'm afraid I still don't have enough to go on. I'm using AMD as well:

WebGPU Default Adapter:

{
  "navigator.gpu.requestAdapter({})": {
    "isFallbackAdapter": false,
    "requestAdapterInfo()": {
      "architecture": "",
      "description": "",
      "device": "",
      "vendor": "",
      "wgpuBackend": "Vulkan",
      "wgpuDevice": 5761,
      "wgpuDeviceType": "IntegratedGpu",
      "wgpuDriver": "radv",
      "wgpuDriverInfo": "Mesa 24.2.2",
      "wgpuName": "AMD Radeon 680M (RADV REMBRANDT)",
      "wgpuVendor": 4098
    },
    "features": [
      "bgra8unorm-storage",
      "depth-clip-control",
      "depth32float-stencil8",
      "float32-filterable",
      "indirect-first-instance",
      "rg11b10ufloat-renderable",
      "texture-compression-bc",
      "timestamp-query"
    ],
    "limits": {
      "maxBindGroups": 8,
      "maxBindGroupsPlusVertexBuffers": 24,
      "maxBindingsPerBindGroup": 1000,
      "maxBufferSize": 1073741824,
      "maxColorAttachmentBytesPerSample": 32,
      "maxColorAttachments": 8,
      "maxComputeInvocationsPerWorkgroup": 1024,
      "maxComputeWorkgroupSizeX": 1024,
      "maxComputeWorkgroupSizeY": 1024,
      "maxComputeWorkgroupSizeZ": 1024,
      "maxComputeWorkgroupStorageSize": 65536,
      "maxComputeWorkgroupsPerDimension": 65535,
      "maxDynamicStorageBuffersPerPipelineLayout": 8,
      "maxDynamicUniformBuffersPerPipelineLayout": 16,
      "maxInterStageShaderComponents": 128,
      "maxInterStageShaderVariables": 16,
      "maxSampledTexturesPerShaderStage": 64,
      "maxSamplersPerShaderStage": 64,
      "maxStorageBufferBindingSize": 1073741824,
      "maxStorageBuffersPerShaderStage": 64,
      "maxStorageTexturesPerShaderStage": 64,
      "maxTextureArrayLayers": 2048,
      "maxTextureDimension1D": 16384,
      "maxTextureDimension2D": 16384,
      "maxTextureDimension3D": 2048,
      "maxUniformBufferBindingSize": 1073741824,
      "maxUniformBuffersPerShaderStage": 64,
      "maxVertexAttributes": 32,
      "maxVertexBufferArrayStride": 2048,
      "maxVertexBuffers": 16,
      "minStorageBufferOffsetAlignment": 32,
      "minUniformBufferOffsetAlignment": 32
    }
  }
}

AMD Radeon 680M (radeonsi, rembrandt, LLVM 18.1.8, DRM 3.57, 6.10.9)

@Niedzwiedzw
Copy link

yeah so it seems to be the marker for whether it's gonna work or not. question is what's the logic behind it :D I've tried looking into firefox source code to figure out how is that adapter determined but couldn't find anything

@Artturin
Copy link
Member

I repro

WebGPU Default Adapter	{
  "navigator.gpu.requestAdapter({})": null
}
WebGPU Fallback Adapter	{
  "navigator.gpu.requestAdapter({\"forceFallbackAdapter\":true})": null
}
GPU #1
Active	Yes
Description	AMD Radeon RX Vega (radeonsi, vega10, LLVM 18.1.8, DRM 3.57, 6.10.8)
Vendor ID	0x1002
Device ID	0x687f
Driver Vendor	mesa/radeonsi
Driver Version	24.2.1.0

vega64

@Niedzwiedzw
Copy link

I'm fighting hard for this, because while it works on chromium, it is very jaggy and randomly crashes - also it crashes after page refresh. I remember from my arch installation this was working flawlessly on firefox-nightly, I could resize the screen and refresh however many times I wanted. any ideas what details of our setup we could compare? I've only started using nixos less than 2 weeks ago

@colemickens
Copy link
Member

Are y'all using nixos-unstable? I am pretty out of my depth here. I don't think I do anything remotely special to make this work on my system.

Just to sanity check: 132.0a1 20240914211959

If I show only modified preferences and search "gpu", I get no hits, so I can't think of any "config" differences worth mentioning.

@Niedzwiedzw
Copy link

ok so I just had a breakthrough. it works but idk why, maybe someone here can help

  1. i pull this repo https://github.com/gfx-rs/wgpu
  2. run nix-shell ./shell.nix
  3. from within that shell I run firefox-nightly

then everything magically works. maybe someone smarter with nix could help me port this to my main configuration somehow

https://github.com/gfx-rs/wgpu/blob/trunk/shell.nix

@Artturin
Copy link
Member

Artturin commented Oct 14, 2024

ok so I just had a breakthrough. it works but idk why, maybe someone here can help

1. i pull this repo [gfx-rs/wgpu](https://github.com/gfx-rs/wgpu)

2. run `nix-shell ./shell.nix`

3. from within that shell I run `firefox-nightly`

then everything magically works. maybe someone smarter with nix could help me port this to my main configuration somehow

gfx-rs/wgpu@trunk/shell.nix

Do a process of elimination on the shell by removing parts of it until it doesn't work anymore. First remove half of it then half of half and so on

@Artturin
Copy link
Member

Artturin commented Oct 16, 2024

vulkan-loader is the fix

NixOS/nixpkgs#349116

image

@colemickens
Copy link
Member

I assume this should be fixed in the wrapper in nixpkgs?

@Artturin
Copy link
Member

I assume this should be fixed in the wrapper in nixpkgs?

I linked the pr

@Niedzwiedzw
Copy link

sorry but it didn't fix it, I still need to run nix-shell ~/Programming/wgpu/shell.nix --command firefox-nightly for it to work

❯ firefox-nightly --version
Mozilla Firefox 132.0a1

@Artturin
Copy link
Member

Artturin commented Nov 6, 2024

sorry but it didn't fix it, I still need to run nix-shell ~/Programming/wgpu/shell.nix --command firefox-nightly for it to work

❯ firefox-nightly --version
Mozilla Firefox 132.0a1

Try the other vulkan packages, maybe I had an impurity.

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

No branches or pull requests

5 participants