You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(lambda-rs): Update pipelines to disable blending by default (#183)
## Summary
Pipelines previously hardcoded `ALPHA_BLENDING` for all color targets,
adding unnecessary blending overhead for the common case (fully opaque
geometry). This PR changes the default to **no blending**
(opaque/replace) and adds an explicit opt-in API for transparency.
## Related Issues
- Resolves#102
## Changes
- Default `RenderPipelineBuilder` color target blending to `None`
(replace/opaque) instead of always enabling `ALPHA_BLENDING`.
- Add `BlendMode` enum + `RenderPipelineBuilder::with_blend(BlendMode)`
to opt into:
- `None` (default)
- `AlphaBlending`
- `PremultipliedAlpha`
- `Additive`
- `Custom(wgpu::BlendState)` (platform-level advanced use)
- Thread blend configuration through the engine-level builder so end
users can opt in without touching `wgpu`.
- Update the reflective-room demo + tutorial to opt into alpha blending
for the translucent floor pass.
- Update docs with guidance that pipelines are opaque by default and
blending must be enabled explicitly for transparency.
- Add unit tests verifying the default blend mode is `None` and that
presets map to the expected `wgpu` blend states.
## Type of Change
- [ ] Bug fix (non-breaking change that fixes an issue)
- [x] Feature (non-breaking change that adds functionality)
- [x] Breaking change (fix or feature that would cause existing
functionality to change)
- [x] Documentation (updates to docs, specs, tutorials, or comments)
- [ ] Refactor (code change that neither fixes a bug nor adds a feature)
- [x] Performance (change that improves performance)
- [x] Test (adding or updating tests)
- [ ] Build/CI (changes to build process or CI configuration)
## Affected Crates
- [x] `lambda-rs`
- [x] `lambda-rs-platform`
- [ ] `lambda-rs-args`
- [ ] `lambda-rs-logging`
- [x] Other: `demos`, `docs`
## Checklist
- [ ] Code follows the repository style guidelines (`cargo +nightly fmt
--all`)
- [ ] Code passes clippy (`cargo clippy --workspace --all-targets -- -D
warnings`)
- [ ] Tests pass (`cargo test --workspace`)
- [x] New code includes appropriate documentation
- [x] Public API changes are documented
- [x] Breaking changes are noted in this PR description
## Testing
**Commands run:**
```bash
cargo test -p lambda-rs-platform
cargo test -p lambda-rs
cargo fmt
```
**Manual verification steps (if applicable):**
1. (Optional) Run `demos/render` reflective-room and confirm the floor
tint remains translucent by enabling
`.with_blend(BlendMode::AlphaBlending)`.
## Screenshots/Recordings
N/A
## Platform Testing
- [x] macOS
- [ ] Windows
- [ ] Linux
## Additional Notes
**Migration:** any pipeline that relied on implicit alpha blending must
now opt in:
```rust
use lambda::render::pipeline::BlendMode;
let pipeline = RenderPipelineBuilder::new()
// ...
.with_blend(BlendMode::AlphaBlending);
```
This improves default performance for opaque geometry, especially on
tile-based GPUs where blending can increase bandwidth/cost.
0 commit comments