feat: accurate frame elision and draw performance - #119
Merged
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.