From 5c48d519f6b34508af46a8e0d1f8afe9fd2e8a8f Mon Sep 17 00:00:00 2001 From: Ilya Zlobintsev Date: Sat, 19 Nov 2022 15:46:33 +0200 Subject: [PATCH] feat: show vulkan extensions --- Cargo.lock | 2 - lact-gui/Cargo.toml | 3 +- .../app/root_stack/info_page/vulkan_info.rs | 53 ++++++++++++++++--- lact-gui/src/client.rs | 2 +- 4 files changed, 47 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4e5d8b1b..db7b71d9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -576,11 +576,9 @@ name = "lact-gui" version = "0.1.0" dependencies = [ "anyhow", - "glib", "gtk", "lact-schema", "nix", - "pango", "serde", "serde_json", "tracing", diff --git a/lact-gui/Cargo.toml b/lact-gui/Cargo.toml index 9db1e463..45f8e6e2 100644 --- a/lact-gui/Cargo.toml +++ b/lact-gui/Cargo.toml @@ -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" diff --git a/lact-gui/src/app/root_stack/info_page/vulkan_info.rs b/lact-gui/src/app/root_stack/info_page/vulkan_info.rs index b84207d3..287c60f0 100644 --- a/lact-gui/src/app/root_stack/info_page/vulkan_info.rs +++ b/lact-gui/src/app/root_stack/info_page/vulkan_info.rs @@ -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!("{}", 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); } } } diff --git a/lact-gui/src/client.rs b/lact-gui/src/client.rs index 071148ba..3bf3ce52 100644 --- a/lact-gui/src/client.rs +++ b/lact-gui/src/client.rs @@ -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,