fix: accurate frame elision and draw performance - #110
Conversation
We always resolve the command buffer hash before drawing any layers so there is no need for mid-draw bail logic. Replaced MurmurHash64A with xxHash's way faster XXH3 for command buffer hashing. Only consider textures used for layer geometry when determining frame completeness for elision. Command buffer command structs are now packed on 1-byte alignment and the command key has shrunk from int to u8. Getting rid of padding isn't crucial as subsequent identical frames should both touch the padding bytes in similar ways, but it's nice.
|
I should credit @hkf57 in #108 for making me look at render performance and correctness. It also addresses uninitialised padding via tight struct packing; noting that accesses were already unaligned due to allocating commands immediately adjacent to each other. I also considered incremental hashing as the commands were being produced to amortise the cost but it's tricky to tell when a command is fully written with the current borrowed pointers, so a one-shot hash in EndFrame before rendering starts is quick enough. We already blocked on the async hash computation so I removed all the scaffolding for querying it between layers and instead decide immediately; saving GPU clearing/drawing effort. |
We always resolve the command buffer hash before drawing any layers so there is no need for mid-draw bail logic.
Replaced MurmurHash64A with xxHash's way faster XXH3 for command buffer hashing.
Only consider textures used for layer geometry when determining frame completeness for elision.
Command buffer command structs are now packed on 1-byte alignment and the command key has shrunk from int to u8. Getting rid of padding isn't crucial as subsequent identical frames should both touch the padding bytes in similar ways, but it's nice.