I haven't focused much on optimization yet. And, it is quite important. A simple-ish game I'm working on goes down to as low as 9FPS under Vulkan. I ran perf to find the problems. These functions seem to be taking up the most time:
Vector::length
awi::render::vulkan::renderer::draw_shape
core::slice::sort_unstable
This seems to be related to a few algorithms I've come up with that need to get optimized.
Depth Sort - Opaque objects sorted front to back, alpha back to front. Should stop using Vector::length and rather the z value multiplied by rotation.
Batch Rendering of Shapes - Needs to be optimized to not re-bind the vertex buffer when the shape does not change
Matrix Transforms - Camera needs to be handled specially so not all shapes are updated one by one.
By fixing these algorithms I hope to run at least 60FPS on my laptop.
I haven't focused much on optimization yet. And, it is quite important. A simple-ish game I'm working on goes down to as low as 9FPS under Vulkan. I ran perf to find the problems. These functions seem to be taking up the most time:
This seems to be related to a few algorithms I've come up with that need to get optimized.
By fixing these algorithms I hope to run at least 60FPS on my laptop.