Questions tagged [webgpu]

API that exposes GPU capabilities to web browsers. Use this tag with questions on programming against WebGPU.

Links:

76 questions
8
votes
1 answer

How to try webGPU in Firefox Nightly now in fall of 2022?

I learned about the new webGPU standard becoming a real thing few weeks ago and of course I want to try to play with that. I read in multiple sources that Firefox Nightly has partial support if you enable it in about:config. I tried it, however none…
Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
8
votes
1 answer

Cannot read property 'requestDevice' of null

im trying to render web GPU shader object in WebGpu and it returning this error Uncaught (in promise) TypeError: Cannot read property 'requestDevice' of null at cube.html:28 this is my code to the requestDevice (async () => { const [adapter,…
Buddhika Prasadh
  • 356
  • 1
  • 5
  • 16
6
votes
3 answers

WebGPU can't be enabled on Chrome v113

env Chrome: v113 OS: Ubuntu 23.04 Display: Nvidia RTX 3060 mobile error message WebGPU has been disabled via blocklist or the command line. Disabled Features: webgpu full text from chrome://gpu Graphics Feature Status Canvas: Hardware…
Jim Jin
  • 1,249
  • 1
  • 15
  • 28
6
votes
1 answer

Is it possible to index dynamically into a WebGPU storage buffer?

I'm trying write a WGSL shader that reads an octree that is stored in a storage buffer. The problem is, the compiler doesn't like the dynamic index I'm calculating to access leaves in the storage buffer. wgpu produces the following validation…
iLoch
  • 741
  • 3
  • 11
  • 32
5
votes
1 answer

What does storageBarrier in WebGPU actually do?

So I'm exploring WebGPU and figured it would be an interesting exercise to implement a basic neural network in it. Having little understanding of both GPU shader programming and neural networks and my only reference for WebGPU(w3.org/TR/webgpu and…
user81993
  • 6,167
  • 6
  • 32
  • 64
5
votes
0 answers

wgpu-native performance vs Vulkan

I've been reading about wgpu-rs and that it uses Vulkan, Dx12, Metal etc if used to build native desktop applications. Given this could one expect comparable performance between wgpu-rs and using vulkan directly? I'm an amateur in the graphics…
4
votes
1 answer

Cellular automata on GPU with WGSL

I am writing a physic simulation which is like a cellular automata. Each steps dependents on the previous one, but more precisely, each cell needs the state of itself and its direct neighbors to compute its new state. I am using two buffers,…
uben
  • 1,221
  • 2
  • 11
  • 20
3
votes
1 answer

Set color for the whole mesh but not every vertex

I want to optimize size of vertex buffer. Currently my layout for VBO is: x y | r g b a It's consumed by shader like this: struct VertexInput { @location(0) position: vec2, @location(1) color: vec4, } And I'm storing mesh in buffer…
FoxPro
  • 2,054
  • 4
  • 11
  • 34
3
votes
3 answers

A way to load .wglsl files in Typescript files using esbuild?

I'm using esbuild as a tool to bundle my Typescript code but i can't find a way to configure a loader for ".wgsl" files. Mi app.ts file : import shader from './shader.wgsl'; //webgpu logic My shader.d.ts : declare module '*.wgsl'{ const value:…
Zentyk
  • 67
  • 8
3
votes
1 answer

"Destroyed texture [Texture] used in a submit." when using a video texture in chrome/webgpu

I'm trying to use an external_texture in WebGpu, but am running into an error. localhost/:1 Destroyed texture [Texture] used in a submit. at ValidateCanUseInSubmitNow (../../third_party/dawn/src/dawn_native/Texture.cpp:605) at ValidateSubmit…
Axiverse
  • 1,589
  • 3
  • 14
  • 30
2
votes
1 answer

write_buffer doesn't write to buffer instead outputting zeros WGPU

Hello I have recently began learning compute shaders with wgpu and I'm having little difficulties figuring out how to correctly write data into a buffer. I have created a small buffer mapped to the cpu with this code. let array_buffer =…
LAYTOR
  • 381
  • 4
  • 12
2
votes
1 answer

Compute Shaders in Google chrome and Apple M1

I have a working physics simulator written in wgpu/rust that works when I am running from the command line. However, when I try to run on the chrome v114 (supported according to what I saw online), I get the following error saying the max number of…
Pap113
  • 37
  • 1
  • 7
2
votes
1 answer

Texture format (TextureFormat::BGRA8Unorm) does not support storage textures even with feature "bgra8unorm-storage"

I'm trying to write a ray tracer with webgpu based on the cornell box sample. I've tested for the bgra8unorm-storage feature and I have it but am still encountering errors trying to store to the current texture. I can run the cornell box example.…
Axiverse
  • 1,589
  • 3
  • 14
  • 30
2
votes
1 answer

What's the difference between a GPUAdapter and GPUDevice in the WebGPU api?

The WebGPU api has both an GPUAdapter and a GPUDevice. You access the device via the adapter like so: const adapter = await navigator.gpu.requestAdapter(); const device = await adapter.requestDevice(); But why are there two interfaces for this…
Jespertheend
  • 1,814
  • 19
  • 27
2
votes
1 answer

How to create a 2d clipping mask in webgpu?

I've been investigating a webgpu way to create a clipping mask. Here is what I tried: const pipeline1 = device.createRenderPipeline({ vertex: { module: basicShaderModule, entryPoint: 'vertex_main', buffers: [{ attributes: [{ …
plantain
  • 43
  • 1
  • 8
1
2 3 4 5 6