| title | Cargo Features Overview | ||||
|---|---|---|---|---|---|
| document_id | features-2025-11-17 | ||||
| status | living | ||||
| created | 2025-11-17T23:59:00Z | ||||
| last_updated | 2026-01-25T00:00:00Z | ||||
| version | 0.1.6 | ||||
| engine_workspace_version | 2023.1.30 | ||||
| wgpu_version | 26.0.1 | ||||
| shader_backend_default | naga | ||||
| winit_version | 0.29.10 | ||||
| repo_commit | 229960fd426cf605c7513002b36e3942f14a3140 | ||||
| owners |
|
||||
| reviewers |
|
||||
| tags |
|
This document enumerates the primary Cargo features exposed by the workspace relevant to rendering and validation behavior. It defines defaults, relationships, and expected behavior in debug and release builds.
- Workspace defaults prefer
wgpuon supported platforms andnagafor shader compilation. - Debug builds enable all validations unconditionally via
debug_assertions. - Release builds enable only cheap safety checks by default; validation logs and per-draw checks MUST be enabled explicitly via features.
lambda-rswith-wgpu(default): enables thewgpuplatform backend vialambda-rs-platform.- Platform specializations:
with-wgpu-vulkan,with-wgpu-metal,with-wgpu-dx12,with-wgpu-gl.
lambda-rs-platformshader-backend-naga(default): usesnagafor shader handling.
Umbrella features (crate: lambda-rs)
render-validation: enables common builder/pipeline validation logs (MSAA counts, depth clear advisories, stencil format upgrades, render-target compatibility) by composing granular validation features. This umbrella includesrender-validation-msaa,render-validation-depth,render-validation-stencil,render-validation-pass-compat, andrender-validation-render-targets.render-validation-strict: includesrender-validationand enables per-draw SetPipeline-time compatibility checks by composing additional granular encoder features. This umbrella additionally enablesrender-validation-encoder.render-validation-all: superset ofrender-validation-strictand enables device-probing advisories and instancing validation. This umbrella includes all granular render-validation flags, includingrender-validation-instancing.
Granular features (crate: lambda-rs)
render-validation-msaa: validates/logs MSAA sample counts; logs pass/pipeline sample mismatches. Behavior:- Builder APIs clamp invalid MSAA counts to
1. - Pipelines align
sample_countto the passsample_count.
- Builder APIs clamp invalid MSAA counts to
render-validation-depth: logs when clamping depth clear to[0.0, 1.0]; adds depth usage advisories when a pass has depth but the pipeline does not.render-validation-stencil: logs when enabling stencil requires upgrading the depth format toDepth24PlusStencil8; warns about stencil usage mismatches.render-validation-pass-compat: SetPipeline-time errors when color targets or depth/stencil expectations do not match the active pass.render-validation-device: device/format probing advisories (if available via the platform layer).render-validation-encoder: additional per-draw/encoder-time checks; highest runtime cost.render-validation-instancing: instance-range and per-instance buffer binding validation forRenderCommand::DrawandRenderCommand::DrawIndexed. Behavior:- Validates that
instances.start <= instances.endand treatsstart == endas a no-op (draw is skipped). - Ensures that all vertex buffer slots marked as per-instance on the active pipeline have been bound in the current render pass.
- Adds per-draw checks proportional to the number of instanced draws and per-instance slots; SHOULD be enabled only when diagnosing instancing issues.
- Validates that
render-validation-render-targets: validates compatibility between offscreenRenderTargets,RenderPassdescriptions, andRenderPipelines. Behavior:- Verifies that pass and pipeline color formats and sample counts match the selected render target.
- Emits configuration logs when a pass targets an offscreen surface with significantly different size from the presentation surface or when a target lacks the attachments implied by pass configuration.
- Expected runtime cost is low to moderate; checks run at builder time and at the start of each pass, not per draw.
Always-on safeguards (debug and release)
- Clamp depth clear values to
[0.0, 1.0]. - Align pipeline
sample_countto the active passsample_count. - Clamp invalid MSAA sample counts to
1.
Behavior by build type
- Debug (
debug_assertions): all validations active regardless of features. - Release: validations are active only when the corresponding feature is enabled; safeguards above remain active.
Usage examples
- Enable common validations in release:
cargo build -p lambda-rs --features render-validation
- Enable strict compatibility checks in release:
cargo run -p lambda-rs --features render-validation-strict
- Enable all validations, including device advisories and instancing validation, in release:
cargo test -p lambda-rs --features render-validation-all
- Enable only MSAA validation in release:
cargo test -p lambda-rs --features render-validation-msaa
- 0.1.6 (2026-01-25): Remove the deprecated legacy shader backend documentation.
- 0.1.5 (2025-12-22): Align
lambda-rsCargo feature umbrella composition with the documented render-validation feature set, includingrender-validation-pass-compatandrender-validation-render-targets. - 0.1.4 (2025-11-25): Document
render-validation-render-targets, record its inclusion in therender-validationumbrella feature, and update metadata. - 0.1.3 (2025-11-25): Rename the instancing validation feature to
render-validation-instancing, clarify umbrella composition, and update metadata. - 0.1.2 (2025-11-25): Clarify umbrella versus granular validation features, record that
render-validation-allincludesrender-instancing-validation, and update metadata. - 0.1.1 (2025-11-25): Document
render-instancing-validationbehavior and update metadata. - 0.1.0 (2025-11-17): Initial document introducing validation features and behavior by build type.