Remove padding early to reduce memory#6
Open
duckdoom5 wants to merge 3 commits into
Open
Conversation
You can remove the padding early to fit the culled faces into a u32, reducing the required memory even more. Note: Did not try to compile, sorry if it doesn't
The face mask padded values are unused (Note the x and z are always + 1 in the lower loop)
We only need that to be a uint64 to include the two extra bits in each col
|
Appreciate the thinking and application. After I added this to my modified version it needed tweaking pretty significantly a few overflows and other issues but all in all great performance boost! If anyone would like the rust version ping me. |
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.
You can remove the padding early to fit the culled faces into a
u32, reducing the required memory even more.We can also update the
colFaceMasksarray to useCHUNK_SIZE, since the padded values are never used.We can even do the same for
axisCols. We only need them to have au64row value to store the two additional bits.I also updated the voxel neighbours checking loop to remove the corner bits from being processed twice. Excuse the amount of code, I personally have it as a function with callback in c++, but I don't know how to do it in Rust.
Note: Did not try to compile nor test the rust version, sorry if it doesn't. (I can help fix it, if so.) I'm using c++, and have verified it works there!