Davidster / ikari

Game engine project written in pure rust for learning about rust and game tech
MIT License
35 stars 3 forks source link

Performance issue #3

Closed CatCode79 closed 6 months ago

CatCode79 commented 1 year ago

We have already talked about it here: https://github.com/Davidster/wgpu-sandbox/pull/2 But I prefer to open an issue to better focus on the problem.

Shadows Implementation is suspect number 1, but even disabling on-game doesn't completely solve the slowness (on my notebook).

I'll try again with Nvidia Nsight, but just today the new version of Puffin was released and as soon as I find some time I try it, if everything works better we will have a cpu side profiling (at least we will know for sure if the engine is cpu-bound or gpu-bound

CatCode79 commented 1 year ago

Cool!

I read the discussion on the Discord channel, the gain in terms of performance is impressive. Perhaps a bvh structure in place of the octotree could do more, but with the result you've already achieved I'd say stabilize the octotree and keep it there until we know exactly if it's significantly optimizable. They are right to say that everything is very scene-dependent, probably for now it's enough for us to implement naive or simple solutions waiting to have a functioning game level, at which point we can think about which solution to use for that type of scene.

Yes, I too have little time in this period, I'll try to make some small changes here and there.

CatCode79 commented 1 year ago

I discovered, by reading this link, that:

Try and write all color channels in a render target because partial writes will disable compression. This is due to needing to read the partially written surface, decompress, and write it back out with your partial update.

This means that the 4 channels (instead of just 3) for the hdr texture are fine, so there will be no need to modify it anymore!

The whole page has some useful tips, probably they are also for other kind of hardware because in some cases they are things I've read about performance in general.

Davidster commented 1 year ago

Try and write all color channels in a render target because partial writes will disable compression

nice. which link was that?

CatCode79 commented 1 year ago

Ops! I forgot to add it: https://gpuopen.com/performance/

Davidster commented 1 year ago

I read the discussion on the Discord channel

haha, I was wondering if you were in the rust gamedev channel. Add me on discord, would be nice to be able to chat outside github from time to time :)

Davidster commented 1 year ago

Split your vertex data into multiple streams.

  • Allocating position data in its own stream can improve depth only passes.
  • If there is an attribute that is not being used in all passes, consider moving it to a new stream.

this one seems relevant to shadow mapping performance