Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TS] Fix waterlogged glass panes and other TS-related follow-up work #2352

Merged
merged 17 commits into from May 20, 2024

Conversation

douira
Copy link
Contributor

@douira douira commented Feb 21, 2024

Cherry-picked edition of #2350

Fixes the sorting of waterlogged glass panes by changing the intersection detection that's run when it can't partition things. It now produces a list of "primary intersectors", quads that intersect with a large fraction of the quads in the current partition, and then puts those in a fixed-order partition tree node that always renders them after the other quads. This means that quads that intersect with lots of things will get rendered after everything else within that set of unpartitionable quads. It doesn't get into infinite recursion by not doing this if there's no non-primary intersector.

Before and after:
Screenshot 2024-02-20 at 01 09 09
Screenshot 2024-02-20 at 01 10 46

…ing distance sorting through

the detection of primary intersectors when geometry is intersecting and then sorting them in a fixed order
@jellysquid3 jellysquid3 added this to the Sodium 0.6 milestone Feb 22, 2024
…iately instead of keeping them to avoid memory usage

buffer caching would be a better solution but that's complicated and doesn't currently work correctly
@douira
Copy link
Contributor Author

douira commented Mar 2, 2024

I've amended this by refactoring I did to buffer and sort result handling. This more cleanly separates the buffers and the translucent sorting data that generates those buffers. It might also solve previously undiscovered concurrency issues. It now always frees buffers when they've been uploaded without keeping them around for the next time. This previously caused high memory usage. Instead, the OS will now have to deal with re-supplying us with buffers efficiently.

A custom buffer caching and eviction system might be better at this because we can keep buffers around for a certain time before freeing them. (It's not guaranteed that it's actually better at this than the OS is) I have code for this at https://github.com/douira/sodium-fabric/tree/gfni-cache-eviction but it sometimes leaks buffers or crashes since there's unresolved bugs and unimplemented features that are necessary to maintain the caching structure.

@douira douira changed the title [TS] Fix waterlogged glass panes [TS] Fix waterlogged glass panes and other TS-related follow-up work Mar 4, 2024
@MeeniMc
Copy link
Contributor

MeeniMc commented Mar 12, 2024

just tried it (no other mods) and it works as intended

@douira
Copy link
Contributor Author

douira commented Apr 1, 2024

I didn't anticipate needing to add another commit to this but we found a bug last week so it got added.

also removed the warning message about unpartitionable geometry as it seems to not be a relevant problem
@IMS212 IMS212 self-assigned this Apr 22, 2024
… not recalculated when the normal is quantized.

also fixed aligned quads not receiving the more accurate center based on the average of the unique vertexes.
@jellysquid3
Copy link
Member

Code looks fine to me, and no regressions were observed in testing.

@jellysquid3 jellysquid3 merged commit fa97f06 into CaffeineMC:dev May 20, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants