-
Notifications
You must be signed in to change notification settings - Fork 811
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
[TS] Fix waterlogged glass panes and other TS-related follow-up work #2352
Conversation
…ing distance sorting through the detection of primary intersectors when geometry is intersecting and then sorting them in a fixed order
…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
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. |
just tried it (no other mods) and it works as intended |
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
… 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.
…small amount of geometry is intersecting
Code looks fine to me, and no regressions were observed in testing. |
…llow-up work (CaffeineMC#2352) * rename some things for clarity * fix waterlogged glass panes (once again, but more this time) by avoiding distance sorting through the detection of primary intersectors when geometry is intersecting and then sorting them in a fixed order * use Mth.clamp for clarity * refactor buffer and sort result handling, buffers are now freed immediately 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 * reduce number of unique triggers by around 5 percent without impacting sorting or building performance * importantly sort a little farther away, sort tasks are fast * use defer zero frames for important sort tasks by default * fix build * clarify authorship of BitArray * fix bug with radix sort for SNR heuristic in BSP partition generating wrong indexes * skip heuristic if there's no quads * refactor primary intersector detection to handle large cases better, also removed the warning message about unpartitionable geometry as it seems to not be a relevant problem * fix topo sorting in some situations where the dot product was wrongly 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. * tune primary intersector detection to handle situations where only a small amount of geometry is intersecting
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: