Different method of emitting tile intersections #63
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.
This method doesn't rely on project and map_gaussians_to_intersects to be EXACTLY in sync lest really bad stuff happens, including memory corruption.
This definitely caused trouble in a previous version of Brush - it's unknown whether the current version does. It doesn't seem to for me but on the other hand it's one floating point inaccuracy away from memory corruption, which just isn't tenable.
This version doesn't rely on first generating intersections counts, and then generating the actual intersections. Instead it immedialty produces them (be it in an arbitrary order). These then get reshuffled to be in order of depth, and then sorte to be in tile order.
The tile offsets are then found using a standard prefix sum, instead of a scan which checks for the 'edges'. That might be slower for low intersection counts, but could be faster for more intense scenes.
Overall this does seem like a small performance regression, but that will be fixed later, I think some cleverer algorithms are possible here. Even just a faster prefix sum (coming in Cube soon hopefully) should fix most of the overhead.