Skip to content

Commit 4c3c4e8

Browse files
committed
[add] features documentation for all features and update specification to include feature flags added for depth, stencil, and msaa validation.
1 parent 709054f commit 4c3c4e8

File tree

2 files changed

+102
-7
lines changed

2 files changed

+102
-7
lines changed

docs/features.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
title: "Cargo Features Overview"
3+
document_id: "features-2025-11-17"
4+
status: "living"
5+
created: "2025-11-17T23:59:00Z"
6+
last_updated: "2025-11-17T23:59:00Z"
7+
version: "0.1.0"
8+
engine_workspace_version: "2023.1.30"
9+
wgpu_version: "26.0.1"
10+
shader_backend_default: "naga"
11+
winit_version: "0.29.10"
12+
repo_commit: "70670f8ad6bb7ac14a62e7d5847bf21cfe13f665"
13+
owners: ["lambda-sh"]
14+
reviewers: ["engine", "rendering"]
15+
tags: ["guide", "features", "validation", "cargo"]
16+
---
17+
18+
## Overview
19+
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.
20+
21+
## Table of Contents
22+
- [Overview](#overview)
23+
- [Defaults](#defaults)
24+
- [Rendering Backends](#rendering-backends)
25+
- [Shader Backends](#shader-backends)
26+
- [Render Validation](#render-validation)
27+
- [Changelog](#changelog)
28+
29+
## Defaults
30+
- Workspace defaults prefer `wgpu` on supported platforms and `naga` for shader compilation.
31+
- Debug builds enable all validations unconditionally via `debug_assertions`.
32+
- Release builds enable only cheap safety checks by default; validation logs and per-draw checks MUST be enabled explicitly via features.
33+
34+
## Rendering Backends
35+
- `lambda-rs`
36+
- `with-wgpu` (default): enables the `wgpu` platform backend via `lambda-rs-platform`.
37+
- Platform specializations: `with-wgpu-vulkan`, `with-wgpu-metal`, `with-wgpu-dx12`, `with-wgpu-gl`.
38+
39+
## Shader Backends
40+
- `lambda-rs-platform`
41+
- `shader-backend-naga` (default): uses `naga` for shader handling.
42+
- `shader-backend-shaderc`: uses `shaderc`; optional `shader-backend-shaderc-build-from-source`.
43+
44+
## Render Validation
45+
46+
Umbrella features (crate: `lambda-rs`)
47+
- `render-validation`: enables common builder/pipeline validation logs (MSAA counts, depth clear advisories, stencil format upgrades).
48+
- `render-validation-strict`: includes `render-validation` and enables per-draw SetPipeline-time compatibility checks.
49+
- `render-validation-all`: superset of `render-validation-strict` and enables device-probing advisories.
50+
51+
Granular features (crate: `lambda-rs`)
52+
- `render-validation-msaa`: validates/logs MSAA sample counts; logs pass/pipeline sample mismatches. Behavior:
53+
- Builder APIs clamp invalid MSAA counts to `1`.
54+
- Pipelines align `sample_count` to the pass `sample_count`.
55+
- `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.
56+
- `render-validation-stencil`: logs when enabling stencil requires upgrading the depth format to `Depth24PlusStencil8`; warns about stencil usage mismatches.
57+
- `render-validation-pass-compat`: SetPipeline-time errors when color targets or depth/stencil expectations do not match the active pass.
58+
- `render-validation-device`: device/format probing advisories (if available via the platform layer).
59+
- `render-validation-encoder`: additional per-draw/encoder-time checks; highest runtime cost.
60+
61+
Always-on safeguards (debug and release)
62+
- Clamp depth clear values to `[0.0, 1.0]`.
63+
- Align pipeline `sample_count` to the active pass `sample_count`.
64+
- Clamp invalid MSAA sample counts to `1`.
65+
66+
Behavior by build type
67+
- Debug (`debug_assertions`): all validations active regardless of features.
68+
- Release: validations are active only when the corresponding feature is enabled; safeguards above remain active.
69+
70+
Usage examples
71+
- Enable common validations in release:
72+
- `cargo build -p lambda-rs --features render-validation`
73+
- Enable strict compatibility checks in release:
74+
- `cargo run -p lambda-rs --features render-validation-strict`
75+
- Enable only MSAA validation in release:
76+
- `cargo test -p lambda-rs --features render-validation-msaa`
77+
78+
## Changelog
79+
- 0.1.0 (2025-11-17): Initial document introducing validation features and behavior by build type.

docs/specs/depth-stencil-msaa.md

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ title: "Depth/Stencil and Multi-Sample Rendering"
33
document_id: "depth-stencil-msaa-2025-11-11"
44
status: "draft"
55
created: "2025-11-11T00:00:00Z"
6-
last_updated: "2025-11-17T00:19:24Z"
7-
version: "0.2.0"
6+
last_updated: "2025-11-17T23:59:59Z"
7+
version: "0.3.1"
88
engine_workspace_version: "2023.1.30"
99
wgpu_version: "26.0.1"
1010
shader_backend_default: "naga"
1111
winit_version: "0.29.10"
12-
repo_commit: "ceaf345777d871912b2f92ae629a34b8e6f8654a"
12+
repo_commit: "709054fcc1fa678ac5f0611877b759bad93decd0"
1313
owners: ["lambda-sh"]
1414
reviewers: ["engine", "rendering"]
1515
tags: ["spec", "rendering", "depth", "stencil", "msaa"]
@@ -146,6 +146,21 @@ App Code
146146
relies on caller-provided sane values and `wgpu` validation. A strict check
147147
MAY be added in a follow-up.
148148

149+
### Validation Feature Flags
150+
151+
- Debug builds: all validations are enabled unconditionally (`debug_assertions`).
152+
- Release builds: only cheap safety checks remain always-on; logging and
153+
per-draw checks are controlled by Cargo features on `lambda-rs`.
154+
- Feature flags
155+
- `render-validation-msaa`: validate/log MSAA counts; pass/pipeline mismatch logs.
156+
- `render-validation-depth`: clamp/log depth clear; depth usage advisories.
157+
- `render-validation-stencil`: stencil usage/format upgrade advisories.
158+
159+
Always-on safeguards (release and debug)
160+
- Clamp depth clear to `[0.0, 1.0]`.
161+
- Align pipeline `sample_count` to the pass `sample_count`.
162+
- Clamp invalid MSAA sample counts to `1`.
163+
149164
## Constraints and Rules
150165

151166
- Multi-sample `sample_count` MUST be one of the device-supported counts. It is
@@ -184,9 +199,9 @@ App Code
184199
MSAA
185200
- [x] Commands: set stencil reference; existing draw/bind/viewport remain
186201
- Validation and Errors
187-
- [ ] Sample counts limited to {1,2,4,8}; invalidlog + clamp to 1
188-
- [ ] Pass/pipeline sample mismatchalign to pass + log
189-
- [ ] Depth clear in [0.0, 1.0] (SHOULD validate); device support (SHOULD)
202+
- [x] Sample counts limited to {1,2,4,8}; invalidclamp to 1 (log via features)
203+
- [x] Pass/pipeline sample mismatchalign to pass (log via features)
204+
- [x] Depth clear clamped to [0.0, 1.0] (log via features); device support (SHOULD)
190205
- Performance
191206
- [ ] 4x MSAA guidance; memory trade-offs for `Depth32Float` vs `Depth24Plus`
192207
- [ ] Recommend disabling depth writes for overlays/transparency
@@ -219,7 +234,8 @@ path that demonstrates the implementation.
219234
defaults (no depth, no multi-sampling) unless explicitly configured.
220235

221236
## Changelog
222-
237+
- 2025-11-17 (v0.3.1) — Remove umbrella validation flags from this spec; list
238+
only feature flags related to MSAA, depth, and stencil; metadata updated.
223239
- 2025-11-11 (v0.1.1) — Add MSAA validation in builders; align pipeline and
224240
pass sample counts; document logging-based fallback semantics.
225241
- 2025-11-11 (v0.1.0) — Initial draft.

0 commit comments

Comments
 (0)