Skip to content

Renderer: draws assembled in place (appendVertices, drawRange, continueFrame) - #140

Merged
boubou666 merged 1 commit into
masterfrom
shinobido/draw-in-place
Nov 24, 2026
Merged

boubou666 merged 1 commit into
masterfrom
shinobido/draw-in-place

Conversation

@boubou666

Copy link
Copy Markdown
Contributor

A port that makes its draws' vertices itself (Shinobido's GS translator: about 30,000 primitives a frame) built them in its own batches, and draw() copied every one into the frame being built at the flip (3-6 MB a frame at Shinobido's castle load).

Now it can make them straight into that frame:

  • appendVertices(count) gives room at the frame's end (the pointer good until the next append); builtVertices() how many it holds.
  • drawRange(material, matrix, first, count, texture) adds a batch over vertices already there; two batches may share a range (a two-pass draw).
  • continueFrame(screen) starts the frame like beginFrame but keeps the vertices appended since the last frame ended.

draw() is now append + drawRange (a refused batch keeps none of its vertices), so existing ports are unchanged.

Test: tests/render/draw_in_place_tests.cpp (the same frame digest as draw()'s copies, shared ranges, a range past the vertices refused, beginFrame dropping what was appended); native_colour_levels still passes.

In Shinobido: the vertex checksums and a gameplay capture are the same; the copy's 2-4.5% of the game thread goes.

🤖 Generated with Claude Code

…ueFrame)

A port that makes its draws' vertices itself (Shinobido's GS translator: 30,000
primitives a frame) built them in its own batches and draw() copied every one into the
frame being built at the flip. Now it can make them straight into that frame:
appendVertices gives room at its end, drawRange adds a batch over vertices already there
(two batches may share a range, as a two-pass draw's do), and continueFrame starts the
frame like beginFrame but keeps the vertices appended since the last one ended. draw() is
append + drawRange (a refused batch keeps none of its vertices).

tests/render/draw_in_place_tests.cpp: the same frame digest as draw()'s copies, shared
ranges, a range past the vertices refused, beginFrame dropping what was appended.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@boubou666
boubou666 merged commit 419fc58 into master Nov 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants