Checkpoint

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2023-09-22 14:53:25 -06:00
parent 3dc1e917bf
commit a237aa8164
3 changed files with 10 additions and 10 deletions

View file

@ -155,13 +155,13 @@ pub trait PlatformWindow {
unsafe impl<'a> HasRawWindowHandle for &'a dyn PlatformWindow { unsafe impl<'a> HasRawWindowHandle for &'a dyn PlatformWindow {
fn raw_window_handle(&self) -> raw_window_handle::RawWindowHandle { fn raw_window_handle(&self) -> raw_window_handle::RawWindowHandle {
self.raw_window_handle() (*self).raw_window_handle()
} }
} }
unsafe impl<'a> HasRawDisplayHandle for &'a dyn PlatformWindow { unsafe impl<'a> HasRawDisplayHandle for &'a dyn PlatformWindow {
fn raw_display_handle(&self) -> raw_window_handle::RawDisplayHandle { fn raw_display_handle(&self) -> raw_window_handle::RawDisplayHandle {
self.raw_display_handle() (*self).raw_display_handle()
} }
} }

View file

@ -1,6 +1,7 @@
use crate::{DevicePixels, Scene, Size}; use crate::{DevicePixels, Scene, Size};
use futures::{future::BoxFuture, FutureExt}; use futures::{future::BoxFuture, FutureExt};
use raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle}; use raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle};
use wgpu::Backends;
pub struct Renderer { pub struct Renderer {
device: wgpu::Device, device: wgpu::Device,
@ -21,7 +22,10 @@ impl Renderer {
where where
W: RenderTarget, W: RenderTarget,
{ {
let instance = wgpu::Instance::new(Default::default()); let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: Backends::METAL,
..Default::default()
});
let surface = unsafe { instance.create_surface(window).unwrap() }; let surface = unsafe { instance.create_surface(window).unwrap() };
let width = window.content_device_size().width; let width = window.content_device_size().width;
let height = window.content_device_size().height; let height = window.content_device_size().height;

View file

@ -1,11 +1,7 @@
use crate::{ use crate::{
renderer::Renderer, AvailableSpace, MainThreadOnly, Platform, PlatformWindow, Point, Size, px, renderer::Renderer, taffy::LayoutId, AppContext, AvailableSpace, Bounds, Context, EntityId,
Style, TextStyle, TextStyleRefinement, WindowOptions, Handle, MainThreadOnly, Pixels, Platform, PlatformWindow, Point, Reference, Size, Style,
}; TaffyLayoutEngine, TextStyle, TextStyleRefinement, WindowOptions,
use super::{
px, taffy::LayoutId, AppContext, Bounds, Context, EntityId, Handle, Pixels, Reference,
TaffyLayoutEngine,
}; };
use anyhow::Result; use anyhow::Result;
use derive_more::{Deref, DerefMut}; use derive_more::{Deref, DerefMut};