Use if statement instead of match as that didn't work as expected.

This commit is contained in:
John Mitchell 2020-08-13 12:58:23 -04:00
parent c40f39ec7e
commit 5b99ad2483

View File

@ -113,15 +113,18 @@ impl WgpuRenderResourceContext {
.bindings
.iter()
.map(|binding| {
let shader_stage = if binding.shader_stage == BindingShaderStage::VERTEX | BindingShaderStage::FRAGMENT {
wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT
} else if binding.shader_stage == BindingShaderStage::VERTEX {
wgpu::ShaderStage::VERTEX
} else if binding.shader_stage == BindingShaderStage::FRAGMENT {
wgpu::ShaderStage::FRAGMENT
} else {
panic!("Invalid binding shader stage.")
};
wgpu::BindGroupLayoutEntry::new(
binding.index,
match binding.shader_stage {
BindingShaderStage::VERTEX | BindingShaderStage::FRAGMENT => wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
BindingShaderStage::VERTEX => wgpu::ShaderStage::VERTEX,
BindingShaderStage::FRAGMENT => wgpu::ShaderStage::FRAGMENT,
BindingShaderStage::COMPUTE => wgpu::ShaderStage::COMPUTE,
_ => panic!("Invalid binding shader stage."),
},
shader_stage,
(&binding.bind_type).wgpu_into(),
)
})