Allow configuration of gpu backends, features, and limits
This commit is contained in:
parent
d7f48d4627
commit
20e4ff829c
|
@ -29,10 +29,15 @@ pub struct Context<'window> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'window> Context<'window> {
|
impl<'window> Context<'window> {
|
||||||
pub async fn new(window: Arc<Window>, limits: wgpu::Limits) -> Result<Self, ContextError> {
|
pub async fn new(
|
||||||
|
window: Arc<Window>,
|
||||||
|
backends: wgpu::Backends,
|
||||||
|
required_features: wgpu::Features,
|
||||||
|
required_limits: wgpu::Limits,
|
||||||
|
) -> Result<Self, ContextError> {
|
||||||
log::info!("Initialising WGPU context...");
|
log::info!("Initialising WGPU context...");
|
||||||
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
|
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
|
||||||
backends: wgpu::Backends::VULKAN,
|
backends,
|
||||||
dx12_shader_compiler: Default::default(),
|
dx12_shader_compiler: Default::default(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
});
|
});
|
||||||
|
@ -63,8 +68,8 @@ impl<'window> Context<'window> {
|
||||||
.request_device(
|
.request_device(
|
||||||
&wgpu::DeviceDescriptor {
|
&wgpu::DeviceDescriptor {
|
||||||
label: None,
|
label: None,
|
||||||
required_features: wgpu::Features::empty(),
|
required_features,
|
||||||
required_limits: limits,
|
required_limits,
|
||||||
},
|
},
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue