Update to wgpu 0.15.1
This commit is contained in:
parent
a68a8f3cfa
commit
2676b841fe
5 changed files with 145 additions and 39 deletions
|
@ -1,4 +1,6 @@
|
|||
use cgmath::prelude::*;
|
||||
use wgpu::InstanceDescriptor;
|
||||
use std::default::Default;
|
||||
use std::num::NonZeroU32;
|
||||
use std::time::Duration;
|
||||
|
||||
|
@ -43,8 +45,8 @@ impl State {
|
|||
// Creating some of the wgpu types requires async code
|
||||
pub async fn new(window: &Window) -> Self {
|
||||
let size = window.inner_size();
|
||||
let instance = wgpu::Instance::new(wgpu::Backends::all());
|
||||
let surface = unsafe { instance.create_surface(window) };
|
||||
let instance = wgpu::Instance::new(InstanceDescriptor::default());
|
||||
let surface = unsafe { instance.create_surface(window).unwrap() };
|
||||
|
||||
let adapter = instance
|
||||
.request_adapter(&wgpu::RequestAdapterOptions {
|
||||
|
@ -72,13 +74,15 @@ impl State {
|
|||
.await
|
||||
.unwrap();
|
||||
|
||||
let caps = surface.get_capabilities(&adapter);
|
||||
let config = wgpu::SurfaceConfiguration {
|
||||
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
|
||||
format: surface.get_supported_formats(&adapter)[0],
|
||||
format: caps.formats[0],
|
||||
width: size.width,
|
||||
height: size.height,
|
||||
present_mode: wgpu::PresentMode::Fifo,
|
||||
alpha_mode: wgpu::CompositeAlphaMode::Opaque,
|
||||
view_formats: vec![caps.formats[0]],
|
||||
};
|
||||
|
||||
surface.configure(&device, &config);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue