HackerTrans
TopNewTrendsCommentsPastAskShowJobs

Twinklebear

no profile record

Submissions

Building, Shipping and Debugging a C++ WebAssembly App

willusher.io
2 points·by Twinklebear·2 anni fa·0 comments

From 0 to glTF with WebGPU: Basic Materials and Textures

willusher.io
52 points·by Twinklebear·2 anni fa·12 comments

GPU compute in the browser at the speed of native: WebGPU marching cubes

willusher.io
168 points·by Twinklebear·2 anni fa·53 comments

No installation required: how WebAssembly is changing scientific computing

nature.com
14 points·by Twinklebear·2 anni fa·1 comments

comments

Twinklebear
·anno scorso·discuss
Pretty general question, but what has your approach been for coupling ThreeJS + React w/ a Rust/Wasm kernel for mesh generation? E.g. do you have Wasm own the memory and you give ThreeJS views of the memory to upload to GPU?
Twinklebear
·2 anni fa·discuss
I’ve been able to profile using PIX following this guide: https://toji.dev/webgpu-profiling/pix . The WebGPU inspector extension is fantastic as well
Twinklebear
·2 anni fa·discuss
Sure I'd be happy to check it out, my email's in my profile (or Github/website).

There are some tradeoffs w/ WebAssembly as well (not sharing the same memory as JS/TS is the biggest one) and debugging can be a bit tough as well though now there's a good VSCode plugin for it [0]. Another part of the reason I also moved back to C++ -> Wasm was for the performance improvement from Wasm vs. JS/TS, but the cross compilation to native/web was the main motivator.

[0] https://marketplace.visualstudio.com/items?itemName=ms-vscod...
Twinklebear
·2 anni fa·discuss
Author of the WebGL volume rendering tutorial [0] you mentioned in the readme here, great work!

Working in WebGL/JS is nice since you can deploy it everywhere, but it can be really hard for graphics programming as you've found because there are very few tools for doing real GPU/graphics debugging for WebGL. The only one I know of is [1], and I've had limited success with it.

WebGPU is a great next step, it provides a modern GPU API (so if you want to learn Metal, DX12, Vulkan, they're more familiar), and modern GPU functionality like storage buffers and compute shaders, not to mention lower overhead and better performance. The WebGPU inspector [2] also looks to provide a GPU profiler/debugger for web that aims to be on par with native options. I just tried it out on a small project I have and it looks really useful. Another benefit of WebGPU is that it maps more clearly to Metal/DX12/Vulkan, so you can use native tools to profile it through Chrome [3].

I think it would be worth learning C++ and a native graphics API, you'll get access to the much more powerful graphics debugging & profiling features provided by native tools (PIX, RenderDoc, Nvidia Nsight, Xcode, etc.) and functionality beyond what even WebGPU exposes.

Personally, I have come "full circle": I started with C++ and OpenGL, then DX12/Vulkan/Metal, then started doing more WebGL/WebGPU and JS/TS to "run everywhere", and now I'm back writing C++ but using WebGL/WebGPU and compiling to WebAssembly to still run everywhere (and native for tools).

With WebGPU, you could program in C++ (or Rust) and compile to both native (for access to debuggers and tools), and Wasm (for wide deployment on the web). This is one of the aspects of WebGPU that is most exciting to me. There's a great tutorial on developing WebGPU w/ C++ [4], and a one on using it from JS/TS [5].

[0] https://www.willusher.io/webgl/2019/01/13/volume-rendering-w...

[1] https://spector.babylonjs.com/

[2] https://github.com/brendan-duncan/webgpu_inspector

[3] https://toji.dev/webgpu-profiling/pix

[4] https://eliemichel.github.io/LearnWebGPU/

[5] https://webgpufundamentals.org/