Skip to content

feat: accurate frame elision and draw performance - #119

Merged
zao merged 3 commits into
PathOfBuildingCommunity:masterfrom
zao:feat/draw-performance
Sep 9, 2026
Merged

feat: accurate frame elision and draw performance#119
zao merged 3 commits into
PathOfBuildingCommunity:masterfrom
zao:feat/draw-performance

Conversation

@zao

@zao zao commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Frame elision was forever inhibited if an incomplete texture existed in the manager, regardless of if it was used in the frame.

This PR relaxes this restriction to only consider frame elision inhibited if an incomplete texture was used in a draw call.
It also speeds up and simplifies draw command hashing by moving to XXH3 from MurmurHash2.
This supersedes #109 and thus closes #108.

Inspired by rusty-path-of-building, it also simplifies the tinted texture shader by removing arbitrary GPU transformation of 2D geometry and removing the extant mask texture support that is not in active use.

It also removes the blend mode override as that was not used.

zao added 3 commits September 9, 2026 17:30
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.
By moving the hardcoded shader sources to standalone files that can be
included at build time, we can get a better editing experience with
language servers in external editors. This without having to ship loose
shader files with the runtime as they're embedded at build time with
CMakeRC.
The blend mode and mask index have been removed from the runtime and
Lua API, and the shader now perform a much cheaper mapping from virtual
to NDC coordinates; inspired by rusty-path-of-building.

The blend mode has been modifiable via calls from Lua since the
beginning but has in modern time not been set to anything but regular
alpha blending.

Draw calls have been able to pass a mask layer as an optional parameter,
intended for blending out regions of the color texture that the app did
not want to display, like only drawing the immediate areas around
line connectors with the new style of nested connector textures.

ANGLE shaders performed a full 4x4 matrix transformation of positions
with a model-view-projection matrix, making it capable of performing
arbitrary transforms of geometry. This was costly in terms of both
uniform buffers but also added shader complexity and ALU cost. It also
did not play nice with CPU draw call culling.
@zao
zao merged commit fe7851e into PathOfBuildingCommunity:master Sep 9, 2026
1 check passed
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.

Released async shader can permanently inhibit frame elision

1 participant