Uh oh!
There was an error while loading. Please reload this page.
perf(lambda-rs): Cache missing per-instance vertex buffer slots - #191
Conversation
✅ Coverage Report📊 View Full HTML Report (download artifact) Overall Coverage
Changed Files in This PR
PR Files Coverage: 87.89% (770/876 lines) Generated by cargo-llvm-cov · Latest main coverage Last updated: 2026-03-08 22:17:02 UTC · Commit: |
There was a problem hiding this comment.
Pull request overview
This PR optimizes instanced draw validation in lambda-rs by caching which per-instance vertex buffer slots are missing at set_pipeline time and updating that cache incrementally on set_vertex_buffer, avoiding per-draw rescans.
Changes:
- Cache missing per-instance vertex buffer slots during
RenderPassEncoder::set_pipelineand update the cache inset_vertex_buffer. - Replace per-draw full scans with a cached missing-slot check in
draw/draw_indexed, and centralize the missing-binding error message. - Add tests and rustdoc covering cached instancing validation behavior, including “bind-after-pipeline” and “prebound slot” cases.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/lambda-rs/src/render/validation.rs | Centralizes the missing per-instance binding error message and documents the full-scan helper vs cached paths; adds a small formatter test. |
| crates/lambda-rs/src/render/encoder.rs | Implements cached missing-slot tracking in the render pass encoder and adds targeted tests for incremental cache updates and prebound behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary
Cache missing per-instance vertex buffer slots in the render encoder so
instancing validation no longer rescans every pipeline slot on every draw.
This reduces validation overhead in instanced render passes from
O(D * S)toO(S + B + D), whereDis draw calls,Sis per-instance slots, andBisvertex buffer binds.
Related Issues
Changes
RenderPassEncoder::set_pipelineis called.RenderPassEncoder::set_vertex_buffer.drawanddraw_indexed.Type of Change
Affected Crates
lambda-rslambda-rs-platformlambda-rs-argslambda-rs-loggingChecklist
cargo +nightly fmt --all)cargo clippy --workspace --all-targets -- -D warnings)cargo test --workspace)Testing
Commands run:
Manual verification steps (if applicable):
required per-instance slot is bound.
set_pipelineallows thedraw to proceed.
set_pipelineis respected bythe cached validation state.
Screenshots/Recordings
Not applicable.
Platform Testing
Additional Notes