Minor refactor

This commit is contained in:
Joshua Groves 2018-10-11 23:56:56 -06:00
parent 90e04cbe75
commit 277bef37c7
2 changed files with 7 additions and 6 deletions

View File

@ -41,7 +41,7 @@ pub(crate) fn map_buffer_usage(
} }
pub(crate) fn map_binding_type( pub(crate) fn map_binding_type(
binding_ty: &binding_model::BindingType, binding_ty: binding_model::BindingType,
) -> hal::pso::DescriptorType { ) -> hal::pso::DescriptorType {
use binding_model::BindingType::*; use binding_model::BindingType::*;
use hal::pso::DescriptorType as H; use hal::pso::DescriptorType as H;
@ -91,12 +91,13 @@ pub(crate) fn map_blend_state_descriptor(
desc: &pipeline::BlendStateDescriptor, desc: &pipeline::BlendStateDescriptor,
) -> hal::pso::ColorBlendDesc { ) -> hal::pso::ColorBlendDesc {
let color_mask = desc.write_mask; let color_mask = desc.write_mask;
let blend_state = match desc.blend_enabled { let blend_state = if desc.blend_enabled {
true => hal::pso::BlendState::On { hal::pso::BlendState::On {
color: map_blend_descriptor(&desc.color), color: map_blend_descriptor(&desc.color),
alpha: map_blend_descriptor(&desc.alpha), alpha: map_blend_descriptor(&desc.alpha),
}, }
false => hal::pso::BlendState::Off, } else {
hal::pso::BlendState::Off
}; };
hal::pso::ColorBlendDesc(map_color_write_flags(color_mask), blend_state) hal::pso::ColorBlendDesc(map_color_write_flags(color_mask), blend_state)
} }

View File

@ -123,7 +123,7 @@ pub extern "C" fn wgpu_device_create_bind_group_layout(
bindings.iter().map(|binding| { bindings.iter().map(|binding| {
hal::pso::DescriptorSetLayoutBinding { hal::pso::DescriptorSetLayoutBinding {
binding: binding.binding, binding: binding.binding,
ty: conv::map_binding_type(&binding.ty), ty: conv::map_binding_type(binding.ty),
count: bindings.len(), count: bindings.len(),
stage_flags: conv::map_shader_stage_flags(binding.visibility), stage_flags: conv::map_shader_stage_flags(binding.visibility),
immutable_samplers: false, // TODO immutable_samplers: false, // TODO