gelly-gmod / gelly

Library to integrate fluids into a game engine
GNU General Public License v3.0
18 stars 3 forks source link

94 - New renderer #95

Closed yogwoggf closed 1 month ago

yogwoggf commented 2 months ago

Ticket

Resolves #94

Changes

yogwoggf commented 2 months ago

Made a draft so that I can periodically look at the overall change

yogwoggf commented 1 month ago

It is ready!! I want to spawn some tickets from this PR before merging as obviously it's just not reviewable, and this is definitely a gross violation of the PR policies and conduct, but it had to be done. The old renderer was on its knees.

Current issues

Compute pipelines

Only the classic PS/VS pipeline is supported.

Depth filter is still slow

We moved it to a 4x4 (iirc) filter which is pretty fast, but it's still slow cause now we have back depth and must run the filter twice, we're doing 10 iterations which is 20 total iterations each frame. One iteration is about 65us, which means the total cost is 1.3ms. Sure, it's a lot better than before--but we just need to do better!

One thing I learned in DOOM 2016 is that those rendering engineers got a 1.46x speedup just by using wave level ops to optimize data access and use fast paths. We can 100% (and I mean 100%) take advantage of this in Gelly. But, we're on D3D11 which has no wave ops, they're only available on NVAPI and AGS.

Splatting has revealed itself as a bottleneck

Depending on the conditions, ellipsoid splatting can take up to 1.3ms-14ms. Why? Probably just because it's an expensive operation all around. Seriously, we need to solve a quadratic for every fragment covered by oriented ellipsoids which does mean that we can have a large number of pixels covered for close ups.

We're probably overloading the FMA pipelines on NVIDIA GPUs, not sure about AMD GPUs.

yogwoggf commented 1 month ago

Also, our shaders are horrible in terms of code quality, it'd do wonders to create our own bespoke platform (this is done all the time) for coupling shaders to pipelines. It might even go hand in hand with the new data driven renderer

yogwoggf commented 1 month ago

So far, so good. All the changes in this PR are polished and everything looks fine for release.