Skip to content

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

Revert "Merge #168: Fix Windows startup crash by defaulting to DirectX 12"

aionggb832cdb065b7
diff --git a/README.md b/README.md
index 01eb85b79..f47e5238f 100644
--- a/README.md
+++ b/README.md
@@ -120,20 +120,6 @@ CRAFT_FONTS_DIR="$PWD/../craft-fonts" cargo run --release -p designcraft # abs
Without it, Japanese falls back to the system's fonts (none on the web). Release builds always
include it.
-On Windows, the desktop app initializes only DirectX 12 by default. This avoids an AMD
-OpenGL driver startup crash in `atio6axx.dll`; no custom launcher or shortcut is needed.
-For graphics troubleshooting, `WGPU_BACKEND` overrides this default (for example, `dx12`
-or `vulkan`). In PowerShell, run this from the directory containing the executable:
-
-```powershell
-$env:WGPU_BACKEND = "vulkan"
-& .\designcraft.exe
-Remove-Item Env:WGPU_BACKEND # restore the default for later launches
-```
-
-An explicit `opengl` override can reintroduce the driver crash on affected systems.
-The macOS, Linux and web backend defaults are unchanged.
-
To drive a running app, send JSON lines to `127.0.0.1:7979`. The protocol is described in
[`docs/control-protocol.md`](docs/control-protocol.md).
diff --git a/apps/designcraft/src/graphics.rs b/apps/designcraft/src/graphics.rs
deleted file mode 100644
index d8b70bc57..000000000
--- a/apps/designcraft/src/graphics.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-//! Windows instance configuration, applied before wgpu can initialize any driver.
-
-use eframe::{NativeOptions, egui_wgpu::WgpuSetup, wgpu::Backends};
-
-pub fn configure(options: &mut NativeOptions, backend_override: Option<Backends>) {
- if let WgpuSetup::CreateNew(create) = &mut options.wgpu_options.wgpu_setup {
- // eframe's default includes GL. Creating that backend can crash inside
- // AMD's atio6axx.dll before adapter selection or Rust error handling.
- // Match the verified WGPU_BACKEND=dx12 workaround without mutating
- // process environment variables or initializing GL as a fallback.
- create.instance_descriptor.backends = backend_override.unwrap_or(Backends::DX12);
- }
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
-
- fn configured_backends(backend_override: Option<Backends>) -> Backends {
- let mut options = NativeOptions::default();
- configure(&mut options, backend_override);
- let WgpuSetup::CreateNew(create) = options.wgpu_options.wgpu_setup else {
- panic!("default native options must create a wgpu instance");
- };
- create.instance_descriptor.backends
- }
-
- #[test]
- fn windows_default_initializes_only_dx12() {
- // Adapter preference is too late: enabling GL can crash inside atio6axx.dll
- // while creating the instance, even when a different adapter is selected.
- assert_eq!(configured_backends(None), Backends::DX12);
- }
-
- #[test]
- fn explicit_backend_override_is_preserved() {
- for backends in [Backends::VULKAN, Backends::GL, Backends::DX12, Backends::VULKAN | Backends::DX12, Backends::empty()] {
- assert_eq!(configured_backends(Some(backends)), backends);
- }
- }
-}
diff --git a/apps/designcraft/src/main.rs b/apps/designcraft/src/main.rs
index 6fbe7e728..62859bb95 100644
--- a/apps/designcraft/src/main.rs
+++ b/apps/designcraft/src/main.rs
@@ -9,8 +9,6 @@
#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
mod control_server;
-#[cfg(any(target_os = "windows", test))]
-mod graphics;
mod logging;
#[cfg(target_os = "macos")]
mod native_menu;
@@ -241,8 +239,6 @@ fn main() -> eframe::Result {
.with_title_shown(false),
..Default::default()
};
- #[cfg(target_os = "windows")]
- graphics::configure(&mut options, eframe::wgpu::Backends::from_env());
options.viewport = options.viewport.with_app_id(APP_ID);
if let Some(icon) = app_icon() {
options.viewport = options.viewport.with_icon(icon);