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 {
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 {
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 futures::{future::BoxFuture, FutureExt};
use raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle};
use wgpu::Backends;
pub struct Renderer {
device: wgpu::Device,
@ -21,7 +22,10 @@ impl Renderer {
where
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 width = window.content_device_size().width;
let height = window.content_device_size().height;

View file

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