1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
/*
wearechat - generic multiplayer game with voip
Copyright (C) 2025 metamuffin
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, version 3 of the License only.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use super::InterfaceData;
use egui::{ComboBox, Grid, Slider, Widget};
use std::sync::Arc;
use wgpu::PresentMode;
pub struct GraphicsConfigInterface {
pub idata: Arc<InterfaceData>,
}
impl Widget for &mut GraphicsConfigInterface {
fn ui(self, ui: &mut egui::Ui) -> egui::Response {
let mut conf = self.idata.graphics_config.lock().unwrap();
Grid::new("gconf").show(ui, |ui| {
ui.label("Primitive Multisampling AA");
ui.vertical(|ui| {
ComboBox::from_id_salt("msaa")
.selected_text(match conf.1.sample_count {
1 => "No MSAA",
2 => "MSAAx2",
4 => "MSAAx4",
8 => "MSAAx8",
_ => unreachable!(),
})
.show_ui(ui, |ui| {
ui.selectable_value(&mut conf.1.sample_count, 1, "No MSAA");
ui.selectable_value(&mut conf.1.sample_count, 2, "MSAAx2");
ui.selectable_value(&mut conf.1.sample_count, 4, "MSAAx4");
ui.selectable_value(&mut conf.1.sample_count, 8, "MSAAx8");
});
});
ui.end_row();
ui.label("Mipmap Levels");
ui.add(Slider::new(&mut conf.1.max_mip_count, 1..=32).show_value(true));
ui.end_row();
ui.label("Maximum Anisotropy");
ui.add(Slider::new(&mut conf.1.max_anisotropy, 1..=32).show_value(true));
ui.end_row();
ui.label("Present Mode");
ui.vertical(|ui| {
ComboBox::from_id_salt("pm")
.selected_text(format!("{:?}", conf.1.present_mode))
.show_ui(ui, |ui| {
for mode in [
PresentMode::AutoVsync,
PresentMode::AutoNoVsync,
PresentMode::Fifo,
PresentMode::FifoRelaxed,
PresentMode::Immediate,
PresentMode::Mailbox,
] {
ui.selectable_value(
&mut conf.1.present_mode,
mode,
format!("{mode:?}"),
);
}
});
});
ui.end_row();
});
if ui.button("Apply").clicked() {
conf.0 = true;
}
ui.response()
}
}
|