move bind type

This commit is contained in:
Carter Anderson 2020-03-10 02:10:44 -07:00
parent d08b243317
commit cfaee577e7
2 changed files with 28 additions and 28 deletions

View file

@ -689,30 +689,4 @@ impl Renderer for WgpuRenderer {
}
}
}
}
impl From<&BindType> for wgpu::BindingType {
fn from(bind_type: &BindType) -> Self {
match bind_type {
BindType::Uniform {
dynamic,
properties: _,
} => wgpu::BindingType::UniformBuffer { dynamic: *dynamic },
BindType::Buffer { dynamic, readonly } => wgpu::BindingType::StorageBuffer {
dynamic: *dynamic,
readonly: *readonly,
},
BindType::SampledTexture {
dimension,
multisampled,
} => wgpu::BindingType::SampledTexture {
dimension: (*dimension).into(),
multisampled: *multisampled,
},
BindType::Sampler => wgpu::BindingType::Sampler,
BindType::StorageTexture { dimension } => wgpu::BindingType::StorageTexture {
dimension: (*dimension).into(),
},
}
}
}
}

View file

@ -3,7 +3,7 @@ use crate::{
render::{
pass::{LoadOp, StoreOp},
pipeline::{
InputStepMode, VertexAttributeDescriptor, VertexBufferDescriptor, VertexFormat,
InputStepMode, VertexAttributeDescriptor, VertexBufferDescriptor, VertexFormat, BindType
},
render_resource::BufferUsage,
},
@ -131,3 +131,29 @@ impl From<StoreOp> for wgpu::StoreOp {
}
}
}
impl From<&BindType> for wgpu::BindingType {
fn from(bind_type: &BindType) -> Self {
match bind_type {
BindType::Uniform {
dynamic,
properties: _,
} => wgpu::BindingType::UniformBuffer { dynamic: *dynamic },
BindType::Buffer { dynamic, readonly } => wgpu::BindingType::StorageBuffer {
dynamic: *dynamic,
readonly: *readonly,
},
BindType::SampledTexture {
dimension,
multisampled,
} => wgpu::BindingType::SampledTexture {
dimension: (*dimension).into(),
multisampled: *multisampled,
},
BindType::Sampler => wgpu::BindingType::Sampler,
BindType::StorageTexture { dimension } => wgpu::BindingType::StorageTexture {
dimension: (*dimension).into(),
},
}
}
}