rt(wgpu): use Option::filter instead of let_chains

This commit is contained in:
chyyran 2024-09-13 18:03:27 -04:00 committed by Ronny Chan
parent 2661effab4
commit 57f9a13ee7
4 changed files with 15 additions and 8 deletions

View file

@ -180,8 +180,11 @@ impl FilterPass {
render_pass.set_bind_group(1, &sampler_bind_group, &[]);
if let Some(push) = &self.reflection.push_constant
&& !has_pcb_buffer
if let Some(push) = &self
.reflection
.push_constant
.as_ref()
.filter(|_| !has_pcb_buffer)
{
let mut stage_mask = ShaderStages::empty();
if push.stage_mask.contains(BindingStage::FRAGMENT) {

View file

@ -56,8 +56,10 @@ impl PipelineLayoutObjects {
let mut push_constant_range = Vec::new();
if let Some(push_meta) = reflection.push_constant.as_ref()
&& !push_meta.stage_mask.is_empty()
if let Some(push_meta) = reflection
.push_constant
.as_ref()
.filter(|push_meta| !push_meta.stage_mask.is_empty())
{
let push_mask = util::binding_stage_to_wgpu_stage(push_meta.stage_mask);
@ -80,8 +82,10 @@ impl PipelineLayoutObjects {
}
}
if let Some(ubo_meta) = reflection.ubo.as_ref()
&& !ubo_meta.stage_mask.is_empty()
if let Some(ubo_meta) = reflection
.ubo
.as_ref()
.filter(|ubo_meta| !ubo_meta.stage_mask.is_empty())
{
let ubo_mask = util::binding_stage_to_wgpu_stage(ubo_meta.stage_mask);
main_bindings.push(BindGroupLayoutEntry {

View file

@ -4,7 +4,6 @@
//! See [`librashader::runtime::wgpu`](https://docs.rs/librashader/latest/librashader/runtime/wgpu/index.html) instead.
#![deny(unsafe_op_in_unsafe_fn)]
#![feature(type_alias_impl_trait)]
#![feature(let_chains)]
mod buffer;
mod draw_quad;

View file

@ -124,7 +124,8 @@ impl<'a> State<'a> {
//
// let preset = ShaderPreset::try_parse("../test/basic.slangp").unwrap();
//
let preset = ShaderPreset::try_parse("../test/shaders_slang/test/feedback.slangp").unwrap();
let preset =
ShaderPreset::try_parse("../test/shaders_slang/crt/crt-royale.slangp").unwrap();
// let preset = ShaderPreset::try_parse(
// "../test/shaders_slang/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp",