Skip to content

Conversation

@vmarcella
Copy link
Member

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

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)
  • Feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (updates to docs, specs, tutorials, or comments)
  • Refactor (code change that neither fixes a bug nor adds a feature)
  • Performance (change that improves performance)
  • Test (adding or updating tests)
  • Build/CI (changes to build process or CI configuration)

Affected Crates

  • lambda-rs
  • lambda-rs-platform
  • lambda-rs-args
  • lambda-rs-logging
  • 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)
  • New code includes appropriate documentation
  • Public API changes are documented
  • Breaking changes are noted in this PR description

Testing

Commands run:

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

  • macOS
  • Windows
  • Linux

Additional Notes

Migration: any pipeline that relied on implicit alpha blending must now opt in:

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.

@vmarcella vmarcella requested a review from Copilot February 11, 2026 23:49
@vmarcella vmarcella added enhancement New feature or request lambda-rs Issues pertaining to the core framework lambda-rs-platform Issues pertaining to the dependency & platform wrappers labels Feb 11, 2026
@vmarcella vmarcella changed the title [update] blending to be opt-in and default the pipeline color target … feat(lambda-rs): Update pipelines to disable blending by default Feb 11, 2026
@github-actions
Copy link

github-actions bot commented Feb 11, 2026

✅ Coverage Report

📊 View Full HTML Report (download artifact)

Overall Coverage

Metric Value
Total Line Coverage 76.34%
Lines Covered 10330 / 13531

Changed Files in This PR

File Coverage Lines
crates/lambda-rs-platform/src/wgpu/pipeline.rs 83.65% 394/471
crates/lambda-rs/src/render/pipeline.rs 90.86% 497/547

PR Files Coverage: 87.52% (891/1018 lines)


Generated by cargo-llvm-cov · Latest main coverage

Last updated: 2026-02-12 00:20:52 UTC · Commit: 3bc0187

Copy link

Copilot AI left a 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 changes the default render pipeline behavior to be opaque (no blending) for better performance, and adds an explicit opt-in blending API so transparency is enabled only when needed.

Changes:

  • Introduces BlendMode + with_blend(...) on both engine-level and platform-level RenderPipelineBuilder, defaulting to None (opaque/replace).
  • Threads the blend configuration through the engine builder into the platform wgpu pipeline creation (replacing the prior hardcoded ALPHA_BLENDING).
  • Updates the reflective-room demo/tutorial and rendering docs to explicitly enable alpha blending where translucency is intended, and adds unit tests in the platform layer.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
docs/tutorials/rendering/techniques/reflective-room.md Updates tutorial code to explicitly opt into alpha blending for the translucent floor pass.
docs/rendering.md Documents the new default (opaque) and shows how to opt into blending.
demos/render/src/bin/reflective_room.rs Updates demo pipeline setup to explicitly enable alpha blending for the floor visual pass.
crates/lambda-rs/src/render/pipeline.rs Adds engine-level BlendMode and threads it into the platform pipeline builder via with_blend.
crates/lambda-rs-platform/src/wgpu/pipeline.rs Adds platform-level BlendMode (including Custom) and uses it to set ColorTargetState.blend, plus adds unit tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vmarcella vmarcella merged commit 3bd06e5 into main Feb 12, 2026
10 checks passed
@vmarcella vmarcella deleted the vmrcella/default-pipeline-blend-none branch February 12, 2026 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request lambda-rs Issues pertaining to the core framework lambda-rs-platform Issues pertaining to the dependency & platform wrappers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Default pipelines to opaque blending (blend: None)

1 participant