feat(gpu): route legacy hardware to OpenGL, add hardware info to About, and expose Graphics options tab

This commit is contained in:
Karim Jerbi committed 2026-10-06 12:23:59 +01:00
1 parent 81bb8d48cf
commit abf302eba5
12 files changed
+838 -21

No files matched your search

+15
View File
@@ -619,6 +619,10 @@ pub(super) struct OpenCADStudio {
dyn_mode: i16,
/// Currently visible page in the application Options dialog.
options_tab: crate::ui::window::options::OptionsTab,
/// Saved graphics options (backend, compat renderer); read at launch, so
/// edits here only take effect after a restart.
#[cfg(not(target_arch = "wasm32"))]
graphics_prefs: crate::gpu_backend::GraphicsPrefs,
/// The Options window's commit point (see `options_session`).
options_saved: Option<options_session::OptionsSnapshot>,
/// Close was pressed with unapplied changes; the discard guard is up.
@@ -2262,6 +2266,15 @@ pub enum Message {
OptionsOpen,
/// Switch the visible page in Options.
OptionsTabChanged(crate::ui::window::options::OptionsTab),
/// Options > Graphics: pin a backend (applies at next launch).
#[cfg(not(target_arch = "wasm32"))]
GraphicsBackendChanged(crate::gpu_backend::BackendChoice),
/// Options > Graphics: force the packed compatibility renderer.
#[cfg(not(target_arch = "wasm32"))]
GraphicsCompatToggled(bool),
/// Options > Graphics: prefer OpenGL on older GPUs.
#[cfg(not(target_arch = "wasm32"))]
GraphicsLegacyGlToggled(bool),
/// Set CURSORSIZE from the Display-page slider.
CursorSizeChanged(i32),
/// Set PICKBOX from the Selection-page slider.
@@ -4153,6 +4166,8 @@ impl OpenCADStudio {
dyn_input: true,
dyn_mode: 3,
options_tab: crate::ui::window::options::OptionsTab::General,
#[cfg(not(target_arch = "wasm32"))]
graphics_prefs: crate::gpu_backend::load_prefs(),
options_saved: None,
options_close_confirm: false,
spacemouse: {
+1
View File
@@ -347,6 +347,7 @@ where
"modeling" => OptionsTab::Modeling,
"selection" => OptionsTab::Selection,
"user-preferences" => OptionsTab::UserPreferences,
"graphics" => OptionsTab::Graphics,
_ => OptionsTab::General,
})
}
+22 -10
View File
@@ -7932,6 +7932,27 @@ impl OpenCADStudio {
Task::none()
}
#[cfg(not(target_arch = "wasm32"))]
Message::GraphicsBackendChanged(choice) => {
self.graphics_prefs.backend = choice;
crate::gpu_backend::save_prefs(self.graphics_prefs);
Task::none()
}
#[cfg(not(target_arch = "wasm32"))]
Message::GraphicsCompatToggled(on) => {
self.graphics_prefs.compat_renderer = on;
crate::gpu_backend::save_prefs(self.graphics_prefs);
Task::none()
}
#[cfg(not(target_arch = "wasm32"))]
Message::GraphicsLegacyGlToggled(on) => {
self.graphics_prefs.legacy_gl = on;
crate::gpu_backend::save_prefs(self.graphics_prefs);
Task::none()
}
Message::CursorSizeChanged(value) => {
self.cursor_size = value.clamp(1, 100);
self.persist_settings_if_changed();
@@ -8976,16 +8997,7 @@ impl OpenCADStudio {
}
Message::AboutCopyInfo => {
let info = format!(
"Open CAD Studio v{}\nRevision: {}\nCommit date: {}\nProfile: {}\nFeatures: {}\nOS: {}\nArch: {}",
env!("OCS_FULL_VERSION"),
env!("OCS_GIT_REV"),
env!("OCS_COMMIT_DATE"),
env!("OCS_BUILD_PROFILE"),
env!("OCS_BUILD_FEATURES"),
crate::ui::window::about::platform_name(),
crate::ui::window::about::architecture_name(),
);
let info = crate::ui::window::about::report();
#[cfg(target_arch = "wasm32")]
{
crate::sys::write_clipboard_text(&info);
+10
View File
@@ -332,6 +332,16 @@ impl OpenCADStudio {
self.spacemouse_preferences, self.spacemouse.status(),
self.spacemouse_paused, self.spacemouse_details,
),
{
#[cfg(not(target_arch = "wasm32"))]
let page = crate::ui::window::options::graphics::view(
self.graphics_prefs,
crate::gpu_backend::active_gpu(),
);
#[cfg(target_arch = "wasm32")]
let page = iced::widget::Space::new().into();
page
},
&self.snap_angle_input,
&self.zoom_factor_input,
{