Clamp branching factor#611
Draft
stefanatwork wants to merge 2 commits into
Draft
Conversation
Clamp BVHBuilderMorton settings to MAX_BRANCHING_FACTOR when an oversized maxBranchingFactor is provided via RTCBuildArguments.\n\nAdd an integration test that exercises rtcBuildBVH with RTC_BUILD_QUALITY_LOW and maxBranchingFactor=64 to verify the Morton build path returns a valid root. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
johguenther
approved these changes
Jul 10, 2026
johguenther
left a comment
Contributor
There was a problem hiding this comment.
LGTM, just some questions/comments
- the regression test does nowhere check whether
childrenare <=8 (MAX_BRANCHING_FACTOR), so basically without the fix, the builder would crash (stack overflow)? But what ifmaxBranchingFactoris set to 9 without the fix / clamp, it may not crash (just slightly above the limit), just be corrupt? - needs un-draft and should be squashed
johguenther
reviewed
Jul 10, 2026
| ENDFOREACH() | ||
| ENDFOREACH() | ||
|
|
||
| ADD_SUBDIRECTORY(regression) |
johguenther
requested changes
Jul 10, 2026
johguenther
left a comment
Contributor
There was a problem hiding this comment.
actually, embree_regression_morton_builder_clamp already crashes (without modifications)
johguenther
reviewed
Jul 10, 2026
| { | ||
| if (branchingFactor > MAX_BRANCHING_FACTOR) | ||
| branchingFactor = MAX_BRANCHING_FACTOR; | ||
| minLeafSize = min(minLeafSize,maxLeafSize); |
Contributor
There was a problem hiding this comment.
this is actually bad: parameters shadow members, better rename all parameters (e.g., append _
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.
Limiting the branching factor of the standalone BVH builder.