Repository navigation
perf: shrink the GPU vertex buffer to 1M vertices - #24
Merged
Merged
Conversation
The large buffer could result in stalls longer than the length of a frame when it gets reallocated. (cherry picked from commit 51ceb1d) Ported from upstream PR 187 (bolrog/d2dx).
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.
Port of upstream PR 187 (bolrog/d2dx, by Jarcho), tracker item 2. Upstream's reasoning: the oversized buffer can cause stalls longer than a frame when it is reallocated; the PR said it "hopefully" helps upstream issue 125 (regular stutter, Windows 7, 1.14d).
RenderContext's dynamic D3D11 vertex buffer goes from 4M to 1M vertices (64 MiB to 16 MiB at 16 bytes per vertex).D2DX_MAX_VERTICES_PER_FRAME), so the GPU buffer now equals the largest possible frame.BulkWriteVerticeswraps withD3D11_MAP_WRITE_DISCARDwhen a write doesn't fit and clamps to capacity, so the smaller size adds no overflow path. (Separately, the CPU array is only guarded by Debug asserts, which is pre-existing and unchanged.)Cherry-picked with
-x, Jarcho kept as author, change identical to the upstream PR. Please merge with a merge commit or rebase, not squash, to keep the authorship. Linux tests: 24 passed (they don't compileRenderContext); Windows CI is the build check.🤖 Generated with Claude Code