Skip to content

DesignCraft: An open-source page and layout design editor written by scratch in pure Rust

Graphics: keep a failed OpenGL out of the instance (macOS)

Hamza531605940502
diff --git a/apps/designcraft/src/gpu/backend.rs b/apps/designcraft/src/gpu/backend.rs
index 7a944b35c..3cac60890 100644
--- a/apps/designcraft/src/gpu/backend.rs
+++ b/apps/designcraft/src/gpu/backend.rs
@@ -144,7 +144,11 @@ pub fn choose(candidates: &[Backend], previous: &Record, version: &str, skipped:
{
failed.push(b);
}
- failed.retain(|b| candidates.contains(b));
+ // A stale entry for a backend this platform cannot use is dropped, but one that can still
+ // be reached stays: OpenGL is the in-process fallback off Windows (`instance_backends`)
+ // without being a candidate there, so forgetting it would offer it again after it failed
+ // to present — on macOS, where Metal is the only candidate, it never got left out at all.
+ failed.retain(|b| candidates.contains(b) || (!cfg!(windows) && *b == Backend::Gl));
let pick = |failed: &[Backend]| candidates.iter().copied().find(|b| !failed.contains(b) && !skipped.contains(b));
let backend = match pick(&failed) {
Some(b) => b,