Skip to content

Commit

Permalink
Skia: Don't render with software by default on macOS/Windows
Browse files Browse the repository at this point in the history
On macOS we should default to the Meta renderer, similar `renderer-skia` defaults to D3D on Windows. Unfortunately commit 0d36f88 broke this by forgetting
that None with the requested graphics API means: Go for with what we have, nothing special requested.

This also fixes the terminal output "Failed to initialize Skia GPU renderer: Requested non-Metal rendering with Metal renderer . Falling back to software rendering" (and similar on Windows).
  • Loading branch information
tronical committed Dec 20, 2024
1 parent 2edb59d commit 102d83a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/renderers/skia/d3d_surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ impl super::Surface for D3DSurface {
size: PhysicalWindowSize,
requested_graphics_api: Option<RequestedGraphicsAPI>,
) -> Result<Self, i_slint_core::platform::PlatformError> {
if !matches!(requested_graphics_api, Some(RequestedGraphicsAPI::Direct3D)) {
if requested_graphics_api.map_or(false, |api| api != RequestedGraphicsAPI::Direct3D) {
return Err(format!("Requested non-Direct3D rendering with Direct3D renderer").into());
}

Expand Down
2 changes: 1 addition & 1 deletion internal/renderers/skia/metal_surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl super::Surface for MetalSurface {
size: PhysicalWindowSize,
requested_graphics_api: Option<RequestedGraphicsAPI>,
) -> Result<Self, i_slint_core::platform::PlatformError> {
if !matches!(requested_graphics_api, Some(RequestedGraphicsAPI::Metal)) {
if requested_graphics_api.map_or(false, |api| api != RequestedGraphicsAPI::Metal) {
return Err(format!("Requested non-Metal rendering with Metal renderer").into());
}

Expand Down
2 changes: 1 addition & 1 deletion internal/renderers/skia/vulkan_surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ impl super::Surface for VulkanSurface {
size: PhysicalWindowSize,
requested_graphics_api: Option<RequestedGraphicsAPI>,
) -> Result<Self, i_slint_core::platform::PlatformError> {
if !matches!(requested_graphics_api, Some(RequestedGraphicsAPI::Vulkan)) {
if requested_graphics_api.map_or(false, |api| api != RequestedGraphicsAPI::Vulkan) {
return Err(format!("Requested non-Vulkan rendering with Vulkan renderer").into());
}
let library = VulkanLibrary::new()
Expand Down

0 comments on commit 102d83a

Please sign in to comment.