Repository navigation
bugfix(render2d): Flush batched 2D draws before they overflow the dynamic buffers - #3487
tintinhamans wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughThe change adds vertex and index capacity checks to the 2D renderer in Generals and GeneralsMD. Rendering stops when current buffer counts exceed the limits. W3DDisplay uses a capacity check to decide whether to continue batching or start a new batch. Changes2D renderer capacity checks
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to No actionable buffer-overflow risk was established in the changed rendering paths; the PR appears mergeable after normal checks. Pre-merge checks |
|
|
Render2DClass::RenderpassesIndices.Count()toDynamicIBAccessClass, which takes anunsigned short. 65538 indices become 2, the index buffer is locked for 2, and the copy loop writes all 65538.Before batching,
W3DDisplaycalledRenderafter every draw call, so the renderer never held more than one. Nowsetup2DRenderStateonly flushes when the texture, mode or grayscale changes, so identical draws accumulate for the whole batch.Drawable::drawAmmohits this: it draws one pip image per round in the clip, andClipSizeis a plainINI::parseInt. A weapon withShowsAmmoPipsand a clip of 10923 is 65538 indices, and selecting or hovering the unit writes up to 128 KB past the buffer.Render2DClassnow hasMAX_VERTEX_COUNT,MAX_INDEX_COUNTandCan_Add.setup2DRenderStatealso flushes once half that capacity is used, andRenderskips geometry that does not fit instead of copying it.drawRiverWaterhas the same narrowing with the point count of a river polygon and will be handled in follow-up.