Skip to content

rendering: reuse retained geometry resources - #69

Open
tritao wants to merge 2 commits into
stack/render-performance-instrumentationfrom
stack/render-geometry-resource-reuse
Open

rendering: reuse retained geometry resources#69
tritao wants to merge 2 commits into
stack/render-performance-instrumentationfrom
stack/render-geometry-resource-reuse

Conversation

@tritao

@tritao tritao commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Builds on #68.

Purpose

Reusing an unchanged frame helps only while that exact draw list survives. A
rebuild could still repack identical geometry and make the OpenGL backend
recreate or revalidate resources for every repeated occurrence.

This PR gives geometry stable draw-list resource identity. Commands refer to
shared geometry resources, allowing repeated shapes and rebuilt frames to
reuse the same packed data and backend allocation when their source is still
valid.

What changed

  • Add draw-list-owned geometry resources and stable command handles.
  • Route backend geometry caching through those handles.
  • Let retained picking and subelement ranges follow the shared geometry
    resource rather than duplicate command-local ownership.
  • Add direct triangular SoFaceSet emission to avoid unnecessary generic
    primitive reconstruction.
  • Reuse stable, non-textured overall-material face-set sources conservatively
    across occurrences and rebuilt frames.

Safety and scope

Resource reuse is based on explicit source identity and revision. Cases whose
effective geometry cannot yet be proven stable continue through the existing
capture path. Broader textured and per-vertex-material source reuse remains
outside this layer.

Validation

  • Forced-rebuild workloads compare resource reuse with the preceding layer.
  • Retained IR tests cover resource ownership and command references.
  • Vertex colors, picking identity, and subelement ranges remain correct when
    geometry resources are shared.

@tritao

tritao commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

Added stable scene-texture and explicit texture-coordinate source identity. On the accelerated Intel OpenGL runner, the 50k core forced rebuild improved from 1106.8 ms to 319.3 ms; backend resource preparation improved from 645.2 ms to 76.2 ms. Procedural texture-coordinate functions remain conservatively excluded. Full rebuild and all 37 tests pass.

@tritao

tritao commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

Added conservative PER_VERTEX color-source reuse with content-based color and opacity revision tracking. The 50k core forced rebuild improved from 319.3 ms to 233.0 ms; backend resource preparation improved from 76.2 ms to 4.3 ms. Packed-color and underspecified diffuse arrays remain excluded. Full rebuild and all 37 tests pass.

@tritao

tritao commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

Added retained construction attribution in c8ce046.

50k feature-rich forced rebuild (5 samples, local hardware):

Phase Core median Compatibility median
Total draw-list construction 147.03 ms 147.91 ms
Primitive generation 11.99 ms 12.03 ms
Geometry packing 0.004 ms 0.004 ms
Command emission/state capture/path retention 55.12 ms 55.35 ms
Residual traversal/state/orchestration 79.92 ms 80.53 ms
Backend resource preparation 4.30 ms 4.23 ms
Backend command execution 81.21 ms 78.44 ms
Total CPU render 238.66 ms 236.93 ms

This confirms geometry generation/packing is no longer the rebuild bottleneck. The next candidates are command/state capture and the residual traversal/state/orchestration cost. JSON schema is now version 6. Full local suite: 37/37 passed.

@tritao
tritao force-pushed the stack/render-geometry-resource-reuse branch from c8ce046 to 410096e Compare August 22, 2026 01:29
@tritao
tritao force-pushed the stack/render-geometry-resource-reuse branch from 410096e to 7d82a12 Compare August 22, 2026 13:47
@tritao
tritao force-pushed the stack/render-geometry-resource-reuse branch 2 times, most recently from c1a3aa6 to b0ba590 Compare August 22, 2026 18:51
@tritao
tritao force-pushed the stack/render-geometry-resource-reuse branch 2 times, most recently from 856b125 to 13983dc Compare August 22, 2026 19:48
@tritao
tritao force-pushed the stack/render-geometry-resource-reuse branch from 13983dc to 1d6eaee Compare August 23, 2026 01:44
@tritao
tritao marked this pull request as ready for review August 23, 2026 01:46
@tritao
tritao force-pushed the stack/render-geometry-resource-reuse branch 2 times, most recently from bbd9c33 to 6055e82 Compare August 23, 2026 03:09
@tritao
tritao force-pushed the stack/render-geometry-resource-reuse branch from 6055e82 to f8c385f Compare August 23, 2026 03:19
@tritao
tritao force-pushed the stack/render-geometry-resource-reuse branch from f8c385f to a1aecd7 Compare August 23, 2026 09:33
@tritao
tritao force-pushed the stack/render-geometry-resource-reuse branch from a1aecd7 to 473c62f Compare August 23, 2026 10:09
@tritao
tritao force-pushed the stack/render-geometry-resource-reuse branch 2 times, most recently from ce1f2a8 to caa4f33 Compare August 23, 2026 12:38
@tritao
tritao force-pushed the stack/render-geometry-resource-reuse branch from caa4f33 to 641eeb6 Compare August 23, 2026 13:14
@tritao
tritao force-pushed the stack/render-geometry-resource-reuse branch from 641eeb6 to 2bacfd8 Compare August 23, 2026 21:21
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.

1 participant