Skip to content

Commit b8e78cb

Browse files
committed
[add] tests for additive blend modes.
1 parent 08fa65b commit b8e78cb

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

crates/lambda-rs-platform/src/wgpu/pipeline.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,23 @@ mod tests {
826826
BlendMode::PremultipliedAlpha.to_wgpu(),
827827
Some(wgpu::BlendState::PREMULTIPLIED_ALPHA_BLENDING)
828828
);
829+
assert_eq!(
830+
BlendMode::Additive.to_wgpu(),
831+
Some(wgpu::BlendState {
832+
color: wgpu::BlendComponent {
833+
src_factor: wgpu::BlendFactor::One,
834+
dst_factor: wgpu::BlendFactor::One,
835+
operation: wgpu::BlendOperation::Add,
836+
},
837+
alpha: wgpu::BlendComponent {
838+
src_factor: wgpu::BlendFactor::One,
839+
dst_factor: wgpu::BlendFactor::One,
840+
operation: wgpu::BlendOperation::Add,
841+
},
842+
})
843+
);
844+
let custom = wgpu::BlendState::ALPHA_BLENDING;
845+
assert_eq!(BlendMode::Custom(custom).to_wgpu(), Some(custom));
829846
assert_eq!(BlendMode::None.to_wgpu(), None);
830847
}
831848
}

0 commit comments

Comments
 (0)