Skip to content

Commit 70670f8

Browse files
committed
[update] specification and add tutorial for the new demo.
1 parent 49b393d commit 70670f8

File tree

3 files changed

+431
-18
lines changed

3 files changed

+431
-18
lines changed

docs/specs/depth-stencil-msaa.md

Lines changed: 20 additions & 15 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-13T00:00:00Z"
7-
version: "0.1.4"
6+
last_updated: "2025-11-17T00:19:24Z"
7+
version: "0.2.0"
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: "21d0a5b511144db31f10ee07b2efb640ca990daf"
12+
repo_commit: "ceaf345777d871912b2f92ae629a34b8e6f8654a"
1313
owners: ["lambda-sh"]
1414
reviewers: ["engine", "rendering"]
1515
tags: ["spec", "rendering", "depth", "stencil", "msaa"]
@@ -20,14 +20,15 @@ tags: ["spec", "rendering", "depth", "stencil", "msaa"]
2020
Summary
2121
- Add configurable depth testing/writes and multi-sample anti-aliasing (MSAA)
2222
to the high-level rendering API via builders, without exposing `wgpu` types.
23-
- Provide strict validation at build time and predictable defaults to enable
24-
3D scenes and higher-quality rasterization in example and production code.
23+
- Provide validation and predictable defaults to enable 3D scenes and
24+
higher-quality rasterization in example and production code.
2525

2626
## Scope
2727

2828
- Goals
2929
- Expose depth/stencil and multi-sample configuration on `RenderPassBuilder`
30-
and `RenderPipelineBuilder` using `lambda-rs` types only.
30+
and `RenderPipelineBuilder` using engine/platform types; `wgpu` types are
31+
not exposed.
3132
- Validate device capabilities and configuration consistency at build time.
3233
- Define defaults for depth clear, compare operation, and sample count.
3334
- Map high-level configuration to `lambda-rs-platform` and `wgpu` internally.
@@ -49,14 +50,14 @@ Summary
4950
## Architecture Overview
5051

5152
- High-level builders in `lambda-rs` collect depth/stencil and multi-sample
52-
configuration using engine-defined types.
53+
configuration using engine/platform types.
5354
- `lambda-rs-platform` translates those types into backend-specific
5455
representations for `wgpu` creation of textures, passes, and pipelines.
5556

5657
```
5758
App Code
5859
└── lambda-rs (RenderPassBuilder / RenderPipelineBuilder)
59-
└── DepthStencil + MultiSample config (engine types)
60+
└── DepthStencil + MultiSample config (engine/platform types)
6061
└── lambda-rs-platform (mapping/validation)
6162
└── wgpu device/pipeline/pass
6263
```
@@ -83,26 +84,30 @@ App Code
8384
- `RenderPipelineBuilder::with_multi_sample(u32) -> Self`
8485
- Example (engine types only)
8586
```rust
86-
use lambda_rs::render::{Color, DepthFormat, CompareFunction, DepthStencil, MultiSample};
87+
use lambda::render::render_pass::RenderPassBuilder;
88+
use lambda::render::pipeline::{RenderPipelineBuilder, CompareFunction};
89+
use lambda::render::texture::DepthFormat;
8790

8891
let pass = RenderPassBuilder::new()
8992
.with_clear_color([0.0, 0.0, 0.0, 1.0])
9093
.with_depth_clear(1.0)
9194
.with_multi_sample(4)
92-
.build(&render_context)?;
95+
.build(&render_context);
9396

9497
let pipeline = RenderPipelineBuilder::new()
9598
.with_multi_sample(4)
9699
.with_depth_format(DepthFormat::Depth32Float)
97100
.with_depth_compare(CompareFunction::Less)
98-
.build(&mut render_context, &pass, &vertex_shader, Some(&fragment_shader))?;
101+
.build(&mut render_context, &pass, &vertex_shader, Some(&fragment_shader));
99102
```
100103
- Behavior
101104
- Defaults
102-
- If `with_depth_stencil` is not called, the pass MUST NOT create a depth
103-
attachment and depth testing is disabled.
104-
- `DepthStencil.clear_value` defaults to `1.0` (furthest depth).
105-
- `DepthStencil.compare` defaults to `CompareFunction::Less`.
105+
- If depth is not requested on the pass (`with_depth*`), the pass MUST NOT
106+
create a depth attachment and depth testing is disabled.
107+
- Depth clear defaults to `1.0` when depth is enabled on the pass and no
108+
explicit clear is provided.
109+
- Pipeline depth compare defaults to `CompareFunction::Less` when depth is
110+
enabled for a pipeline and no explicit compare is provided.
106111
- `MultiSample.sample_count` defaults to `1` (no multi-sampling).
107112
- Attachment creation
108113
- When depth is requested (`with_depth`/`with_depth_clear`), the pass MUST

docs/tutorials/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ title: "Tutorials Index"
33
document_id: "tutorials-index-2025-10-17"
44
status: "living"
55
created: "2025-10-17T00:20:00Z"
6-
last_updated: "2025-11-10T00:00:00Z"
7-
version: "0.2.0"
6+
last_updated: "2025-11-17T00:00:00Z"
7+
version: "0.3.0"
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: "727dbe9b7706e273c525a6ca92426a1aba61cdb6"
12+
repo_commit: "ceaf345777d871912b2f92ae629a34b8e6f8654a"
1313
owners: ["lambda-sh"]
1414
reviewers: ["engine", "rendering"]
1515
tags: ["index", "tutorials", "docs"]
@@ -20,9 +20,11 @@ This index lists tutorials that teach specific engine tasks through complete, in
2020
- Uniform Buffers: Build a Spinning Triangle — [uniform-buffers.md](uniform-buffers.md)
2121
- Textured Quad: Sample a 2D Texture — [textured-quad.md](textured-quad.md)
2222
- Textured Cube: 3D Push Constants + 2D Sampling — [textured-cube.md](textured-cube.md)
23+
- Reflective Room: Stencil Masked Reflections with MSAA — [reflective-room.md](reflective-room.md)
2324

2425
Browse all tutorials in this directory.
2526

2627
Changelog
28+
- 0.3.0 (2025-11-17): Add Reflective Room tutorial; update metadata and commit.
2729
- 0.2.0 (2025-11-10): Add links for textured quad and textured cube; update metadata and commit.
2830
- 0.1.0 (2025-10-17): Initial index with uniform buffers tutorial.

0 commit comments

Comments
 (0)