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);
|
||||
|
|
|
@ -30,6 +30,7 @@ impl Texture {
|
|||
dimension: wgpu::TextureDimension::D2,
|
||||
format: Self::DEPTH_FORMAT,
|
||||
usage: wgpu::TextureUsages::RENDER_ATTACHMENT | wgpu::TextureUsages::TEXTURE_BINDING,
|
||||
view_formats: &[],
|
||||
};
|
||||
let texture = device.create_texture(&desc);
|
||||
|
||||
|
@ -42,7 +43,7 @@ impl Texture {
|
|||
min_filter: wgpu::FilterMode::Linear,
|
||||
mipmap_filter: wgpu::FilterMode::Nearest,
|
||||
compare,
|
||||
lod_min_clamp: -100.0,
|
||||
lod_min_clamp: 0.0,
|
||||
lod_max_clamp: 100.0,
|
||||
..Default::default()
|
||||
});
|
||||
|
@ -76,6 +77,7 @@ impl Texture {
|
|||
dimension: wgpu::TextureDimension::D2,
|
||||
format,
|
||||
usage: wgpu::TextureUsages::TEXTURE_BINDING | wgpu::TextureUsages::COPY_DST,
|
||||
view_formats: &[],
|
||||
});
|
||||
|
||||
// dbg!(stride);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue