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.
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
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