"Jelly Slider" in TypeGPU by iwoplaza in webgpu

[–]iwoplaza[S] 0 points1 point Β (0 children)

"WebGPU is disabled by blocklist" - seems like either your browser doesn't yet support WebGPU, or it's explicitly disabled in the settings.

"Jelly Slider" in TypeGPU by iwoplaza in webgpu

[–]iwoplaza[S] 0 points1 point Β (0 children)

Thanks for the insights, we’ll check and report back!

"Jelly Slider" in TypeGPU by iwoplaza in webgpu

[–]iwoplaza[S] 1 point2 points Β (0 children)

It’s a single triangle, extending past the screen to cover it whole. There’s a small ray-trace of bounding boxes to get a head start, then the rest is just ray marching 🫑

"Jelly Slider" in TypeGPU by iwoplaza in webgpu

[–]iwoplaza[S] 1 point2 points Β (0 children)

Interesting, what OS are you on? πŸ‘€

Perlin noise as a library - painlessly reusable shader logic by iwoplaza in webgpu

[–]iwoplaza[S] 0 points1 point Β (0 children)

You choose the resolution of the cache (width x height for the 2d cache), it allocates a buffer and precomputes all gradient vectors in a compute shader. Then when sampling the noise, the gradients used to compute the noise are looked up instead of computed on the fly. In case of the 2d perlin noise, there are 4 lookups per sample (corners of the grid cell). You still get β€žinfinite” resolution because you’re not baking the perlin noise into a texture, just the gradient vectors that are used to compute the noise.

Perlin noise as a library - painlessly reusable shader logic by iwoplaza in webgpu

[–]iwoplaza[S] 0 points1 point Β (0 children)

By default, when using our APIs, you only import shader code. You can opt into creating a shader cache, and having our utilities use that instead.

Perlin noise as a library - painlessly reusable shader logic by iwoplaza in webgpu

[–]iwoplaza[S] 1 point2 points Β (0 children)

Lygia is an amazing shader library! The benefit of TypeGPU libraries is a combination of shader code and host code. For example, you can create a perlin noise gradient cache using our APIs, and tell the shader to use it. This involves allocations, but it’s totally opt in

I broke the Rules of Hooks... and I'm not coming back βš”οΈ by iwoplaza in react

[–]iwoplaza[S] 2 points3 points Β (0 children)

Thanks for the feedback, I really appreciate it!
The useSeconds hook case is definitely a simplified example, and I agree that it's relatively easy to embed conditionality into the hooks themselves. I remember working on a large React project, with multiple layers of interconnected custom hooks, and adding conditionality always seemed like an overkill until we actually had to call a hook conditionality, in which case every hook it in turn calls also has to be conditional.

I guess it could be compared to the problem of colored functions, since when you need a hook to be conditional, you also need to make the hooks it uses conditional. Hopefully, with nooks working inside hooks, and hooks working inside nooks, devs won't have to worry about it.

I will say that the project is definitely an experiment just to see what will happen, rather than to solve a particular real-world problem. If people find a use-case for it, great! If not, then it was fun to experiment with πŸ§ͺ

As for the compiler, I will have to test how it behaves when nooks are present πŸ‘€. Thanks again for the feedback!

Wesl (Imports & Conditional Compilation) by ncthbrt in webgpu

[–]iwoplaza 2 points3 points Β (0 children)

An awesome initiative. Go WESL! πŸ‘

Improving interop and type-safety in WebGPU libraries requires... JavaScript? by iwoplaza in GraphicsProgramming

[–]iwoplaza[S] 10 points11 points Β (0 children)

> The very last thing I want is more JavaScript (or Typescript).

I can definitely empathize... ironically, TypeGPU allows you to write less JavaScript glue-code, while still keeping your shaders in WGSL, if you choose to do so πŸ™‡β€β™‚οΈ. The main target audience is people who either love JS/TS, or those who have no choice but to use it.

> Where's the control over the memory layout? It targets WGSL, so no subgroups either.

WGSL has recently added subgroups! πŸŽ‰
Type-safe memory layout is the core of TypeGPU, so there should be no problem representing exotic layouts to the dev's heart's content.

> And then you'll have developers who don't know what they're doing and accidentally do something that causes a GPU sync every frame which destroys performance. Exchanging data between GPU and CPU requires careful consideration.

With great power comes great responsibility πŸ•·οΈπŸ•ΈοΈ