feat: show vulkan extensions

This commit is contained in:
Ilya Zlobintsev
2022-11-19 15:46:33 +02:00
parent 3a0f7b0aef
commit 5c48d519f6
4 changed files with 47 additions and 13 deletions
Generated
-2
View File
@@ -576,11 +576,9 @@ name = "lact-gui"
version = "0.1.0"
dependencies = [
"anyhow",
"glib",
"gtk",
"lact-schema",
"nix",
"pango",
"serde",
"serde_json",
"tracing",
+1 -2
View File
@@ -7,8 +7,7 @@ edition = "2021"
[dependencies]
lact-schema = { path = "../lact-schema" }
gtk = "0.16"
pango = "0.16"
glib = "0.16"
# pango = "0.16"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
nix = "0.25"
@@ -1,7 +1,6 @@
use gtk::prelude::*;
use gtk::*;
use lact_schema::VulkanInfo;
use std::collections::BTreeMap;
use tracing::trace;
#[derive(Clone)]
@@ -10,6 +9,7 @@ pub struct VulkanInfoFrame {
device_name_label: Label,
version_label: Label,
features_box: Box,
extensions_box: Box,
}
impl VulkanInfoFrame {
@@ -25,6 +25,8 @@ impl VulkanInfoFrame {
container.set_shadow_type(ShadowType::None);
let vbox = Box::new(Orientation::Vertical, 5);
let grid = Grid::new();
grid.set_margin_start(5);
@@ -33,6 +35,7 @@ impl VulkanInfoFrame {
grid.set_margin_top(5);
grid.set_column_homogeneous(true);
grid.set_row_homogeneous(false);
grid.set_row_spacing(7);
grid.set_column_spacing(5);
@@ -71,9 +74,11 @@ impl VulkanInfoFrame {
grid.attach(&version_label, 2, 1, 3, 1);
vbox.pack_start(&grid, false, true, 5);
let features_expander = Expander::new(Some("Feature support"));
grid.attach(&features_expander, 0, 2, 5, 1);
vbox.pack_start(&features_expander, false, true, 5);
let features_scrolled_window = ScrolledWindow::builder().build();
@@ -87,13 +92,32 @@ impl VulkanInfoFrame {
features_expander.add(&features_scrolled_window);
container.add(&grid);
let extensions_box = Box::builder()
.orientation(Orientation::Vertical)
.spacing(5)
.halign(Align::Center)
.build();
let extensions_expander = Expander::builder()
.label("Extension support")
.child(
&ScrolledWindow::builder()
.vexpand(true)
.child(&extensions_box)
.build(),
)
.build();
vbox.pack_start(&extensions_expander, false, true, 5);
container.add(&vbox);
Self {
container,
device_name_label,
version_label,
features_box,
extensions_box,
}
}
@@ -105,11 +129,10 @@ impl VulkanInfoFrame {
self.version_label
.set_markup(&format!("<b>{}</b>", vulkan_info.api_version));
let features: BTreeMap<_, _> = vulkan_info.supported_features.iter().collect();
for (feature, supported) in features.into_iter() {
for (feature, supported) in &vulkan_info.supported_features {
let vbox = Box::new(Orientation::Horizontal, 5);
let feature_name_label = Label::new(Some(feature));
let feature_name_label = Label::new(Some(&feature));
vbox.pack_start(&feature_name_label, false, false, 0);
@@ -118,9 +141,23 @@ impl VulkanInfoFrame {
feature_supported_checkbutton.set_sensitive(false);
feature_supported_checkbutton.set_active(*supported);
vbox.pack_start(&feature_supported_checkbutton, false, false, 0);
vbox.pack_end(&feature_supported_checkbutton, false, false, 0);
self.features_box.pack_end(&vbox, false, false, 0);
self.features_box.pack_start(&vbox, false, false, 0);
}
for (extension, supported) in &vulkan_info.supported_extensions {
let vbox = Box::new(Orientation::Horizontal, 5);
let extension_name_label = Label::new(Some(&extension));
vbox.pack_start(&extension_name_label, false, false, 0);
let extension_supported_checkbutton = CheckButton::builder()
.sensitive(false)
.active(*supported)
.build();
vbox.pack_end(&extension_supported_checkbutton, false, false, 0);
self.extensions_box.pack_start(&vbox, false, false, 0);
}
}
}
+1 -1
View File
@@ -1,7 +1,7 @@
use anyhow::{anyhow, Context};
use lact_schema::{request::Request, response::Response, DeviceInfo, DeviceListEntry, DeviceStats};
use nix::unistd::getuid;
use serde::{de::DeserializeOwned, Deserialize};
use serde::Deserialize;
use std::{
io::{BufRead, BufReader, Write},
marker::PhantomData,