zesterer / euc

A software rendering crate that lets you write shaders with Rust
Apache License 2.0
294 stars 18 forks source link

Compute shaders #25

Open jim-ec opened 1 year ago

jim-ec commented 1 year ago

This crate would be perfect for prototyping compute shaders!

I am trying to write a fluid simulation. While the initial CPU-based approach works great, it is just not performant enough. Therefore I want to port it to a compute shader implementation. The problem with compute shaders is the same as vertex/fragment shaders: It is nearly impossible to debug them! Therefore, it would be awesome if this crate would support a compute pipeline with work groups, storage buffers, work group memory, etc. This would allow me to author an algorithm which is suited for a GPU all without loosing debugging capabilities.

zesterer commented 1 year ago

The difficulty here is that euc supports any valid Rust code in the shader implementation so there's no real way to encourage users to 'write for the GPU', as it were.

(I also don't personally know enough about compute shaders specifically to come up with a good model for this, but I guess that's par-for-the-course)

jim-ec commented 1 year ago

That's actually even better, because it allows to adapt an algorithm for the GPU progressively. If I have time I can actually look into this myself, but I'll probably better wait for the refactoring branch to be merged anyway.

zesterer commented 1 year ago

The refactor branch is perhaps 99% there, and is basically fine to work from, I just need to find the time/energy to write a good line rasterizer.