Skip to content

fix: accurate frame elision and draw performance - #110

Draft
zao wants to merge 1 commit into
PathOfBuildingCommunity:masterfrom
zao:fix/render-faster-better-stronger
Draft

fix: accurate frame elision and draw performance#110
zao wants to merge 1 commit into
PathOfBuildingCommunity:masterfrom
zao:fix/render-faster-better-stronger

Conversation

@zao

@zao zao commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

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.

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.
@LocalIdentity
LocalIdentity marked this pull request as ready for review August 4, 2026 13:07
@LocalIdentity
LocalIdentity marked this pull request as draft August 4, 2026 13:07
@zao

zao commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

I should credit @hkf57 in #108 for making me look at render performance and correctness.
This PR moves the elision check from looking at all textures in PumpShaders to instead track incomplete texture use during layer processing; that way we can draw a working set without being being affected by any pending or incomplete texture uploads.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant