Fix text corruption in oversized labels (16-bit text index overflow)#19
Open
Schogol wants to merge 1 commit into
Open
Fix text corruption in oversized labels (16-bit text index overflow)#19Schogol wants to merge 1 commit into
Schogol wants to merge 1 commit into
Conversation
Text sprite batches used 16-bit index counts and 16-bit index values, so a single label overflowed once its geometry exceeded 65535 indices: 2 quads/glyph = 12 indices/glyph with Text Shadow, i.e. ~5461 visible glyphs. Past that, the index count wrapped (and beyond ~8191 glyphs the per-draw-call vertex index values wrapped too), corrupting the render of large popups such as contracts and acceleration-gate messages. Widen the sprite index path to 32-bit: - RenderTriangleVerts / EnsureBufferSpace / CopyIndicesWithOffset / GrowCaptureIndexBuffer index counts unsigned short -> unsigned int - Tr2FontMeasurer index values (m_indices, AdjustIndicesIfNeeded) to unsigned int, submitted via new 32-bit RenderTriangleVerts / CopyIndicesWithOffset overloads so the existing 16-bit path used by other sprite types is untouched The GPU index buffer is already 32-bit (stride 4), so no format change is needed. Relates to EDR-1989.
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.
Summary
Popup windows with a very large amount of text (e.g. contract confirmations with many items, "can't activate" acceleration-gate messages) render corrupt. The text sprite batch used 16-bit indices, which overflow once a single label exceeds 65,535 indices.
Should fix EDR-1989.
Root cause
EVE's font emits 2 quads per glyph = 12 indices/glyph with Text Shadow on, so a single label overflows the 16-bit index space at 65,535 / 12, i.e. about 5,461 visible glyphs. Two 16-bit bottlenecks:
RenderTriangleVerts/EnsureBufferSpace/CopyIndicesWithOffset/GrowCaptureIndexBuffertookunsigned short indexCount, truncating theunsigned intcount the font passes (the ~5,461-glyph limit).Tr2FontMeasurer::m_indiceswasunsigned short, so per-draw-call vertex indices wrap once a single-texture run exceeds 65,535 vertices (~8,191 glyphs with shadow).UI text goes through the capture/display-list path, which does not split batches, so the whole label hits these 16-bit boundaries in one submission.
Fix
Widen the text sprite index path to 32-bit:
unsigned short->unsigned intinRenderTriangleVerts(both overloads),EnsureBufferSpace,CopyIndicesWithOffset,GrowCaptureIndexBuffer.Tr2FontMeasurer(m_indices,AdjustIndicesIfNeeded) ->unsigned int, submitted via new 32-bitRenderTriangleVerts/CopyIndicesWithOffsetoverloads. The existing 16-bit overloads are kept for the other sprite types (frames, lines, brackets) that pass 16-bit index arrays, so their callers are untouched.The GPU index buffer is already 32-bit (
m_indexBuffer.Create(indexCount, 4)), so no GPU format change is needed; this only stops the CPU-side truncation before the data reaches the already-32-bit buffer.