Repository navigation
bugfix(w3d): Skip rivers that overflow the dynamic index buffer - #3489
tintinhamans wants to merge 1 commit into
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 1 minute. View limit details
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughThe river water draw path now computes the index count before allocating the dynamic index buffer. It returns without drawing when the count exceeds 65,535. Rivers within the limit retain the existing rendering path. ChangesRiver water rendering
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~5 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to Oversized rivers are skipped before the index buffer is allocated, preventing the reported count-wrap path. No merge-blocking issue is evident from the supplied change context. Pre-merge checks |
|
|
05fe7ce to
600358d
Compare
| if (m_disableRiver) return; | ||
|
|
||
| // TheSuperHackers @bugfix arcticdolphin 12/10/2026 Skip rivers that do not fit the 16 bit dynamic buffers. | ||
| const Int indexCount = (rectangleCount+1)*2*3; |
There was a problem hiding this comment.
🟡 Medium Water/W3DWater.cpp:2743
Rivers with 21,846 points are skipped even though they generate only 65,532 indices, which fit in the 16-bit buffer. indexCount includes an extra quad, evaluates to 65,538, and triggers the early return; calculate it from the rectangleCount * 6 indices the loop writes.
| const Int indexCount = (rectangleCount+1)*2*3; | |
| const Int indexCount = rectangleCount*2*3; |
🤖 Copy this AI Prompt to have your agent fix this:
In file @Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp around line 2743:
Rivers with 21,846 points are skipped even though they generate only 65,532 indices, which fit in the 16-bit buffer. `indexCount` includes an extra quad, evaluates to 65,538, and triggers the early return; calculate it from the `rectangleCount * 6` indices the loop writes.
There was a problem hiding this comment.
The check mirrors the count requested from DynamicIBAccessClass, which is what wraps.
There was a problem hiding this comment.
The request should match the loop’s rectangleCount * 6 writes. At 21,846 points that is 65,532, which fits; the current extra six causes an unnecessary skip. Counts above that still return before the unsigned short constructor can wrap.
There was a problem hiding this comment.
Matching the loop gains two points and makes a 3 point river lock zero indices.
There was a problem hiding this comment.
You're right—the direct replacement would zero-lock a 3-point river. The count needs to retain a six-index minimum while using rectangleCount * 6 for nonzero rectangles.
drawRiverWaterasksDynamicIBAccessClassfor three indices per river point, and the count is anunsigned short. 21846 points wrap to 2, and the loop still writes 65532 indices.The point count comes straight from the map file, so one river polygon is enough to write up to 128 KB past the index buffer.
Rivers that do not fit in 16 bits are now skipped. The largest river in the 537 retail and custom maps I tested has 374 points.