fix selecting wrong window for key events
This commit is contained in:
parent
ce4702ec5f
commit
ceefdaf46b
5 changed files with 119 additions and 15 deletions
|
@ -5,7 +5,7 @@ use std::time::Instant;
|
|||
use cgmath::{Matrix4, Point3, Rad, Vector3, perspective};
|
||||
use futures::executor::block_on;
|
||||
use thiserror::Error;
|
||||
use wgpu::util::DeviceExt;
|
||||
use wgpu::{Backends, InstanceDescriptor, util::DeviceExt};
|
||||
use winit::window::Window;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
|
@ -240,7 +240,10 @@ pub struct WgpuCtx<'window> {
|
|||
|
||||
impl<'window> WgpuCtx<'window> {
|
||||
pub async fn new(window: Arc<Window>) -> Result<WgpuCtx<'window>, ContextError> {
|
||||
let instance = wgpu::Instance::default();
|
||||
let instance = wgpu::Instance::new(&InstanceDescriptor {
|
||||
backends: Backends::from_comma_list("dx12,metal,opengl,webgpu"),
|
||||
..Default::default()
|
||||
});
|
||||
let surface = instance.create_surface(Arc::clone(&window))?;
|
||||
let adapter = instance
|
||||
.request_adapter(&wgpu::RequestAdapterOptions {
|
||||
|
@ -255,8 +258,7 @@ impl<'window> WgpuCtx<'window> {
|
|||
&wgpu::DeviceDescriptor {
|
||||
label: None,
|
||||
required_features: wgpu::Features::empty(),
|
||||
required_limits: wgpu::Limits::downlevel_webgl2_defaults()
|
||||
.using_resolution(adapter.limits()),
|
||||
required_limits: wgpu::Limits::default().using_resolution(adapter.limits()),
|
||||
memory_hints: wgpu::MemoryHints::Performance,
|
||||
},
|
||||
None,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue