Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Phong committed Sep 17, 2024
1 parent 0b7b847 commit f02ce54
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 0 additions & 2 deletions crates/renderer/src/drivers/metal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ pub struct MetalDriver {
pub(crate) gr_context: DirectContext,
pub(crate) metal_layer: MetalLayer,
pub(crate) command_queue: CommandQueue,
pub(crate) scale_factor: f64,
}

impl MetalDriver {
Expand Down Expand Up @@ -101,7 +100,6 @@ impl MetalDriver {
gr_context,
metal_layer,
command_queue,
scale_factor,
};

(driver, window, skia_surface)
Expand Down
11 changes: 8 additions & 3 deletions crates/renderer/src/drivers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ pub use metal::*;

use freya_engine::prelude::Surface as SkiaSurface;
use glutin::surface::GlSurface;
use metal::MetalDriver;
use winit::{
dpi::PhysicalSize,
event_loop::ActiveEventLoop,
Expand All @@ -26,8 +25,14 @@ impl GraphicsDriver {
window_attributes: WindowAttributes,
config: &LaunchConfig<State>,
) -> (Self, Window, SkiaSurface) {
let (driver, window, surface) = OpenGLDriver::new(event_loop, window_attributes, config);
(Self::OpenGl(driver), window, surface)
if cfg!(not(target_os = "macos")) {
let (driver, window, surface) =
OpenGLDriver::new(event_loop, window_attributes, config);
(Self::OpenGl(driver), window, surface)
} else {
let (driver, window, surface) = MetalDriver::new(event_loop, window_attributes, config);
(Self::Metal(driver), window, surface)
}
}

pub fn make_current(&mut self) {
Expand Down

0 comments on commit f02ce54

Please sign in to comment.