151 questions
0
votes
0
answers
78
views
Where is wgpu::EmscriptenSurfaceSourceCanvasHTMLSelector located?
I'm following this C++ WebGPU tutorial (with associated Git repo here) in another language, and so must rewrite the build script accordingly.
The tutorial calls wgpu::glfw::CreateSurfaceForWindow ...
-3
votes
1
answer
73
views
How to set up WebGPU work groups with fully independent tasks?
I am new to using WebGPU. I'm using the rust wgpu crate with compute shaders to run a cryptographic task at high speed.
My shader is quite simple: Take a common input state, append a unique per-thread ...
0
votes
0
answers
32
views
Definition for webgpu shadow map array and cast shadows feature
I implemented all shadow workflow but never get real cast shadows ...
I found :
⚠️ Problem: WebGPU currently does not support binding arrays of textures/samplers directly like this. You need to use ...
1
vote
0
answers
67
views
Webgpu Importexternaltexture fails for 8k frame
I am trying to process an 8k video on a mobile phone with webGPU (say it is a 360 video and I only need to display part of it). Normally, webGPU is supposed to handle 8k textures https://www.w3.org/TR/...
0
votes
1
answer
64
views
Vertices normalized to WGSL clip space do not appear
I've been following the webgpufundamentals tutorial on translation using the rust implementation of wgpu and leptos. For some reason, when I am normalizing the vertices to produce the letter "F&...
0
votes
1
answer
124
views
PIXIJS v8: "Uniform type undefined is not supported" when passing float array uniform to a custom shader
I’m on PixiJS v8.1 (WebGL2) + TypeScript, trying to pass five RGB colors as a flat float[] into my fragment shader—but I keep getting:
Error: Uniform type undefined is not supported. Supported uniform ...
0
votes
1
answer
86
views
Why reading from a storage texture 2d array always returns the same value in webGPU?
What i'm trying to do is write to a storage texture in one render pass, and then read from this texture in a second pass, but value i get in the second pass is always the same, regardless of what i ...
1
vote
0
answers
89
views
What is the proper way to implement support for N shadowmaps in webGPU renderer?
I`m making a basic forward renderer in webGPU, that supports multiple types of light sources and shadowmapping. When I was figuring out the shadowmapping part, I bound shadowmaps to shadowpass, wrote ...
-1
votes
1
answer
122
views
Implement effect of 3d card tilting
I want to achieve the effect of card tilting. When the mouse pointer approaches one corner of the card, this corner of the card will tilt downward. The current problem is that the card is not ...
0
votes
0
answers
87
views
Using texture sample values in a critical section of WGSL fragment shader
I am getting errors when using a variable that is dependent on the value of a texture sample in the critical section of my fragment shader.
From what I understand, one should not sample textures in ...
1
vote
1
answer
164
views
WebGPU GPUPipelineError - Sampling depth texture always giving error regardless if the sampler is filtering
I have a project that I was working on for some time. I came back to it yesterday to find that the project didn't load anymore. I'm now getting the following error:
Uncaught (in promise) ...
0
votes
1
answer
593
views
"Property 'gpu' does not exist on type Navigator"
Fresh project.
I create the project with ng new,
then immediately upgrade to angular 19 with ng upgrade @angular/core@19 @angular/cli@19.
I then install WebGPU type bindings npm install --save-dev @...
0
votes
0
answers
42
views
Passing array of vecs from vertex shader to fragment shader in wgpu
I am trying to do Blinn-Phong lighting with multiple lights. For this, I need to calculate the tangent position of the lights to my vertex. But wgpu does not allow me to use an array of vecs in my ...
0
votes
0
answers
73
views
emscripten & Webgpu - certain calls made from C++ ends up with a mangled name in Javascript
I'm using emscripten 3.1.59.
When I make webgpu calls, some of the calls made from C++ layer, results in a garbage string value in JS layer.
As an example, a call to wgpuInstanceCreateSurface.
When I ...
2
votes
2
answers
279
views
Why is non-uniform dynamic indexing of descriptors/uniforms so hard to do?
Non-uniform dynamic indexing of descriptors is hard to do. I assume this is the case as it is (or was) only an "extension" in Vulkan, and many (or most) Android devices don't support Vulkan ...
1
vote
0
answers
152
views
WebGPU passing texture handle between C/C++ and browser
TL;DR
Can a texture created in C/C++ (e.g. in a node addon) can be shared with browser-side WebGPU via a handle?
Can a texture created browser-side can be shared with native WebGPU, via a handle?
...
0
votes
0
answers
92
views
Unity WebGPU black screen on Mac
I'm using Unity 6.1 WebGl, And i run the build inside the browser and everything worked fine, on both windows and mac. I switched to use the experimental WebGPU, works fine on windows and also on Mac ...
2
votes
1
answer
151
views
How to generate vertex normals from gltf positions attribute buffer?
I`m trying to implement vertex normal generation from vertex positions using the cross product method (in javaScript, from a gltf positions buffer), but most of resulting normals turn out to be (0, 0, ...
0
votes
0
answers
82
views
How to solve the transparency issue after setting depth in WebGPU?
I rendered two circles and wanted to bring the first circle to the front by increasing its z-index. However, after enabling depth testing, the background of the first circle became transparent.
This ...
1
vote
0
answers
102
views
Trying to profile WebGpu on Xcode, but Xcode crashes
I'm trying to follow the following set of instructions on how to profile a webgpu/webgl app on a Mac using Xcode: https://developer.playcanvas.com/user-manual/optimization/gpu-profiling/
I get a ...
0
votes
1
answer
73
views
How to fix the "Binding multisampled flag (1) doesn't match the layout's multisampled flag (0)" error in WebGPU?
I`m trying to add MSAA to a model with multiple textures (normal, metallicRoughness, baseColor, emission), but get the following error:
Binding multisampled flag (1) doesn't match the layout's ...
0
votes
1
answer
246
views
binding storage buffer in rust wgpu
I'm learning rust wgpu. Till now, I am able to send uniform data to shader. Now I want to send storage buffer to shader. But I'm getting following error:
[ERROR wgpu::backend::wgpu_core] Handling wgpu ...
0
votes
0
answers
118
views
Do WebGL/WebGPU shaders use log2(x) when implementing log(x)?
I came across this quote on the Outerra blog:
using log2 instead of log: in shaders, log function is implemented using the log2 instruction, so
it's better to use log2 directly, avoiding an extra ...
0
votes
1
answer
108
views
Divide 8-byte stored in 2 uint32 by a uint32 it on a machine with 32-bit operation
I want to divide uint64 by a uint32 in WebGPU, which currently only handles uint32 operations. So I am trying to simulate this by storing my long into two uint32 buffers high and low. and now I want ...
0
votes
1
answer
428
views
Using override constants in WebGPU
In the WebGPU spec, both GPUVertexState and GPUFragmentState implement GPUProgrammableStage. The latter contains the constants field where one specifies the values of pipeline-overrideable constants.
...
0
votes
0
answers
167
views
Three.js duplicate shadow issue (bug?) - Shadow appears below and above object (WebGPU build 167)
Note: I'm using the WebGPU build 167 of three.js for this question and JSFiddle.
See screenshot and JSFiddle. I have a simple sphere between two "floors", with a DirectionalLight pointing ...
2
votes
0
answers
150
views
How to check if a resource has finished uploading to the GPU
I'm developing an app with a big 3D world where meshes/textures are uploaded and immediately drawn when you move to a new area. The simplified code for rendering a frame looks like this (I'm using ...
0
votes
2
answers
283
views
How can multiple WGSL sources be combined such that line numbers are properly reported?
I have organized my project so that some shared functionality is kept in separate .wgsl files. I can load them and dynamically compose them into a single string myself, but then the line reporting for ...
0
votes
1
answer
121
views
How to layout vertex data for efficient usage in a compute shader
I want to write a small toy path tracer and I wondered what is the most performant/efficient way to layout the vertex data, I want positions, normals and tex coordinates, is it better to reduce memory ...
1
vote
0
answers
177
views
WebGPU: How long, exactly, must a bind group live?
What is the necessary lifetime of a bind group in WebGPU? I have not been able to find clear documentation on this. I'm using the C/C++ bindings for wgpu.
Is it allowed to release a bind group ...
0
votes
1
answer
897
views
WebGPU multiple render passes for 1 canvas
I'm a beginner in WebGPU and want to process an image with multiple processing stages in separate shader modules:
Desaturation
Edge detection
Compression
Step 4 then computes the compressed texture ...
0
votes
1
answer
100
views
WebGPU prefix-sum: issue with bind-group ping-pong
I'm implementing a simple Hillis and Steele prefix-sum algorithm in WebGPU.
It deliberately doesn't do anything fancy. I'm working with small arrays so that I can dispatch as many work-groups as there ...
2
votes
1
answer
683
views
How to correctly simulate `atomicAdd` on `u64` by using two `u32` buffers?
I'm trying to do atomic operations on u64. But since it's not supported, the number is stored in TWO u32 buffers
The issue is that I'm not sure how to do atomicAdd correctly to simulate the effect it ...
0
votes
2
answers
577
views
a valid external instance reference no longer exists
After drawing a line, after a while, the browser produces a warning: a valid external instance reference no longer exists. I wonder if it was because of my setVertexBuffer in requestAnimationFrame, or ...
0
votes
1
answer
295
views
Device.createBuffer( usage:GPUBufferUsage.VERTEX ) in every frame , minutes later , browser get wrong
I try to code a simple paint example with webgpu , so , in every mousemove , arrayData.length is changing. I keep an array storage all points(vec2 array) , I create new GPUBuffer with this points ...
3
votes
0
answers
205
views
Can I use a GPUBuffer which is the output of a compute shader as a Three.js or Babylon.js vertex position buffer?
I am experimenting whith webgpu. I found out that transferring data between cpu and gpu can be quite slow.
My goal is to simulate particle physics on the gpu using webgpu's compute shaders, then use ...
1
vote
1
answer
3k
views
Why is WebGPU performance so bad in my benchmark compared to WebGL?
Here's the code of my benchmark, tested it on Latest Chrome Canary on Win11 (with vsync disabled and fps unlocked).
WebGPU has around 1/3 the FPS of WebGL bench, I can't figure out why is that.
Code:
...
1
vote
1
answer
345
views
Is this WebGPU compute shader badly designed?
I am having unexpected results while comparing a WebGPU compute shader with it's cpu equivalent.
This is a CPU version of a function that does Verlet Integration for simulating particles.
...
-1
votes
1
answer
258
views
Downloading WebGPU buffer with await mapAsync is 5000 times slower in Firefox Nightly
I want to download a WebGPU buffer to host memory in order to do some computation on the CPU. Unfortunately, I have measured that WebGPU is 5000 slower than expected in Firefox Nightly (128.0a1) on ...
0
votes
1
answer
165
views
How to churn different inputs using only single premade WGSL pipeline?
I have coded a WGSL compute shader that outputs the result given an input as argument.
Now I need to run this shader many times using different inputs. All of the compute shader steps should be the ...
0
votes
1
answer
80
views
Spread not works for Array(16) _wgpuMatrix.mat4.invert return NUll filled array
For matrix transformation i use wgpu-matrix library.
I already have implemented raycast (hit object trigger) in other project. I wanna implement it also in my new project matrix-engine-wgpu.
In this ...
0
votes
2
answers
519
views
WebGPU: Changing the output format to non-float types, possible?
For rendering to <canvas>, it seems that navigator.getPreferredCanvasFormat() is the only way to get a valid format.
As per the docs, it will always return either rgba8unorm or bgra8unorm, both ...
0
votes
0
answers
30
views
Lighting/Shadows 2 faces of cube always fail intro black color
I have two faces alwas black, even if i remove shadow from shader they still not clear visible.
I use base project from webGPU examples .
If i update light location/position 2 faces ( image dice ...
1
vote
0
answers
361
views
C WebGPU Error: invalid load op for render pass color attachment: 0
I am trying to use WebGPU with C with the implementation from wgpu-native and GLFW to create window. I follow the tutorial from here. The tutorial is a bit old and there's changes in the API. One of ...
2
votes
1
answer
265
views
Why the 2Sum algorithm in WGSL doesn't work?
I've been trying to create a version in WGSL of 2Sum for increasing floating point precision, but it doesn't work. I wonder if there is any kind of optimization in WGSL that prevents the correct ...
1
vote
1
answer
1k
views
How to read GPU buffers on CPU (WebGPU, Javascript)
As the title suggests I need help reading buffers used on GPU on the CPU.
I am trying to accomplish mouse-picking for the objects drawn on screen.
To do this, I have created a Float32Array with the ...
1
vote
0
answers
213
views
Converting Cannojs 3D world vectors to model-view matrix
I use glmatrix 3.4.0 .
With position i dont have any problem.
Event glmatrix last version have some support for QUAT i cant make correct way of converting from QUAT to AxisAngle or rotate mat4 ...
I ...
0
votes
1
answer
63
views
How to add/mix texture.image to shadowMapping demo
I use https://webgpu.github.io/webgpu-samples/
I wanna integrate simple texture to the https://webgpu.github.io/webgpu-samples/?sample=shadowMapping example.
loadTex (this.texture0)
async loadTex0(...
1
vote
1
answer
678
views
Tensorflow.js Error: Backend name ‘webgpu’ not found in registry when not served on localhost
I am working on getting a local server set up that can serve pages that will have access to tensorflow.js and the webGPU backend.
I have run into an issue where if I serve my files on localhost (127.0....
0
votes
1
answer
815
views
webGPU I cant draw two object in same scene
I 'am begginer here. I took wgpu-matrix from Greggman like best glmatrix alternative for webgpu (conform for me on usage level).
Code in self taken from https://webgpu.github.io/webgpu-samples/...