-
Notifications
You must be signed in to change notification settings - Fork 2
chore(lambda-rs): Increase code coverage for rendering #177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…hardware one present (I.E. mesa in our CI).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR increases lambda-rs render-module coverage by adding many targeted unit/integration tests (including adapter-backed GPU tests), centralizing GPU test setup, and refactoring RenderContext to support offscreen-only rendering paths. It also updates CI/workflows to enforce adapter availability for coverage runs and ignores generated coverage artifacts.
Changes:
- Add extensive render tests across builders, enum/platform mappings, validation paths, and GPU-backed encode/submit flows.
- Introduce centralized GPU test helpers with primary + fallback adapter selection and optional enforcement via
LAMBDA_REQUIRE_GPU_ADAPTER. - Refactor
RenderContextto allowsurface: Option<WindowSurface>and support headless/offscreen rendering flows; update CI env accordingly.
Reviewed changes
Copilot reviewed 23 out of 24 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/lambda-rs/src/render/window.rs | Adds WindowBuilder default/override tests and a best-effort window creation smoke test (non-macOS). |
| crates/lambda-rs/src/render/viewport.rs | Adds tests for coordinate clamping and helper tuple conversions. |
| crates/lambda-rs/src/render/vertex.rs | Adds rustdoc to an existing vertex builder test. |
| crates/lambda-rs/src/render/validation.rs | Adds tests for alignment and render validation helpers (dynamic offsets, instance ranges/bindings). |
| crates/lambda-rs/src/render/texture.rs | Adds mapping/flag tests plus GPU-backed texture build validation and 3D path coverage. |
| crates/lambda-rs/src/render/targets/surface.rs | Adds tests for present mode conversions, surface error mapping, and display formatting. |
| crates/lambda-rs/src/render/targets/offscreen.rs | Switches tests to centralized GPU helper and adds additional offscreen target behavior tests. |
| crates/lambda-rs/src/render/surface.rs | Adds tests for present mode conversions, error mappings, and SurfaceConfig field mapping. |
| crates/lambda-rs/src/render/shader.rs | Adds tests for inline and file-based shader compilation paths. |
| crates/lambda-rs/src/render/render_pass.rs | Adds tests for depth clear clamping, MSAA sanitization, and builder toggles. |
| crates/lambda-rs/src/render/pipeline.rs | Adds enum mapping tests and GPU-backed pipeline construction/alignment tests. |
| crates/lambda-rs/src/render/mod.rs | Refactors RenderContext to make surface optional and adds substantial GPU-backed encode/render tests. |
| crates/lambda-rs/src/render/mesh.rs | Adds additional MeshBuilder tests including OBJ loader parsing. |
| crates/lambda-rs/src/render/instance.rs | Adds tests for builder options and platform mapping of instance flags/backends. |
| crates/lambda-rs/src/render/gpu.rs | Adds force_fallback, adapter-required env gating, centralized test GPU creation helpers, and mapping/display tests. |
| crates/lambda-rs/src/render/encoder.rs | Adds test-only render pass encoder helper and GPU-backed encoder/validation tests. |
| crates/lambda-rs/src/render/command.rs | Adds/updates test doc for index format mapping. |
| crates/lambda-rs/src/render/color_attachments.rs | Adds tests for attachment builder behavior incl. MSAA missing-view panic path. |
| crates/lambda-rs/src/render/buffer.rs | Adds multiple unit tests plus GPU-backed buffer write/wrapper tests. |
| crates/lambda-rs/src/render/bind.rs | Adds comprehensive bind layout/group tests and updates texture binding docstring. |
| .gitignore | Ignores generated coverage/ artifacts. |
| .github/workflows/release.yml | Enforces adapter-backed tests via LAMBDA_REQUIRE_GPU_ADAPTER=1 in Vulkan CI. |
| .github/workflows/coverage.yml | Enforces adapter-backed tests via LAMBDA_REQUIRE_GPU_ADAPTER=1 for coverage job. |
| .github/workflows/compile_lambda_rs.yml | Enforces adapter-backed tests via LAMBDA_REQUIRE_GPU_ADAPTER=1 in Vulkan CI matrix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…date how mesa is installed and configured in our pipelines
…lla/increase-rendering-test-coverage
…ithub.com/lambda-sh/lambda into vmrcella/increase-rendering-test-coverage
Summary
Increase
lambda-rsrender module test coverage byadding adapter-backed GPU tests, a feature-gated window/surface smoke runner for
coverage, and a small render refactor to support offscreen-only rendering paths.
Related Issues
Changes
crates/lambda-rs/src/render/**to exercisepipeline/pass/bind-group/buffer/encoder/targets/texture/validation paths.
attempt primary adapter first, then wgpu fallback/virtual adapter; optionally
enforce adapter presence via
LAMBDA_REQUIRE_GPU_ADAPTER=1.lavapipe) by setting
LAMBDA_REQUIRE_GPU_ADAPTER=1..gitignore.indices/links, and remove outdated template guidance.
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:
cargo +nightly fmt cargo test -p lambda-rs --lib --testsCoverage workflow used for adapter-backed + window/surface coverage:
Manual verification steps (if applicable):
coverage/lambda_rs_cov.json.Screenshots/Recordings
N/A (no UI changes).
Platform Testing
Additional Notes
(lavapipe) and now enforces adapter-backed render tests via
LAMBDA_REQUIRE_GPU_ADAPTER=1.