Remove Vukan
This commit is contained in:
parent
5e34c37848
commit
7b50b884f4
|
|
@ -32,15 +32,6 @@ version = "1.0.54"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a99269dff3bc004caa411f38845c20303f1e393ca2bd6581576fa3a7f59577d"
|
||||
|
||||
[[package]]
|
||||
name = "ash"
|
||||
version = "0.36.0+1.3.206"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ceea9c64653169f33f946debf0a41568afc4e23a4c37d29004a23b2ffbfb4034"
|
||||
dependencies = [
|
||||
"libloading",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atty"
|
||||
version = "0.2.14"
|
||||
|
|
@ -983,7 +974,6 @@ name = "pteropus"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"ash",
|
||||
"bytes",
|
||||
"clap 3.1.0",
|
||||
"futures",
|
||||
|
|
|
|||
|
|
@ -17,4 +17,3 @@ anyhow = "~1.0"
|
|||
futures = "~0.3"
|
||||
bytes = "~1.1"
|
||||
las = {version="~0.7", features=["laz"]}
|
||||
ash = {version="~0.36", features=["linked"]}
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
use {clap::Parser, geo_types::Point, las::Read as LasRead, proj::Proj, tokio::io::AsyncReadExt};
|
||||
|
||||
mod geonb;
|
||||
mod vulkan;
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[clap(author, version, about, long_about=None)]
|
||||
|
|
@ -23,12 +22,6 @@ struct Args {
|
|||
async fn main() -> Result<(), anyhow::Error> {
|
||||
let args = Args::parse();
|
||||
|
||||
vulkan::init(vulkan::InitOptions {
|
||||
debug_init: args.debug_init,
|
||||
window_width: 1600,
|
||||
window_height: 1200
|
||||
});
|
||||
|
||||
if let (Some(latitude), Some(longitude)) = (args.latitude, args.longitude) {
|
||||
let location = Proj::new_known_crs("+proj=longlat +datum=WGS84", "EPSG:2953", None)
|
||||
.unwrap()
|
||||
|
|
|
|||
107
src/vulkan.rs
107
src/vulkan.rs
|
|
@ -1,107 +0,0 @@
|
|||
use ash::{vk, Entry};
|
||||
|
||||
fn pretty_print_memory_size(x: u64) -> String {
|
||||
if x > 1_000_000_000 {
|
||||
format!("{:.1}G", x / 1_000_000_000)
|
||||
} else if x > 1_000_000 {
|
||||
format!("{:.0}M", x / 1_000_000)
|
||||
} else if x > 1000 {
|
||||
format!("{:.0}K", x / 1000)
|
||||
} else {
|
||||
format!("{}", x)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct InitOptions {
|
||||
pub window_width: u32,
|
||||
pub window_height: u32,
|
||||
pub debug_init: bool,
|
||||
}
|
||||
|
||||
pub struct Window {}
|
||||
|
||||
fn describe_devices(instance: &ash::Instance) {
|
||||
unsafe {
|
||||
instance
|
||||
.enumerate_physical_devices()
|
||||
.expect("vulkan physical devices")
|
||||
.iter()
|
||||
.for_each(|&device| {
|
||||
let device_properties = instance.get_physical_device_properties(device);
|
||||
let api_version = device_properties.api_version;
|
||||
let api_major_version = (api_version >> 22) & 0x7f;
|
||||
let api_minor_version = (api_version >> 12) & 0x3ff;
|
||||
println!(
|
||||
"{}:\n\tAPI Version{}.{}\n\t{:?}",
|
||||
std::ffi::CStr::from_ptr(&device_properties.device_name[0])
|
||||
.to_str()
|
||||
.expect("device name string"),
|
||||
api_major_version,
|
||||
api_minor_version,
|
||||
device_properties.device_type
|
||||
);
|
||||
println!("\tMemory:");
|
||||
let memory_properties = instance.get_physical_device_memory_properties(device);
|
||||
for i in 0..memory_properties.memory_type_count as usize {
|
||||
let memory_type = memory_properties.memory_types[i];
|
||||
let heap_index = memory_type.heap_index as usize;
|
||||
let heap = memory_properties.memory_heaps[heap_index];
|
||||
println!("\t\t{:?}", memory_type.property_flags);
|
||||
println!(
|
||||
"\t\t\t{}: {}\t{:?}",
|
||||
heap_index,
|
||||
pretty_print_memory_size(heap.size),
|
||||
heap.flags
|
||||
);
|
||||
}
|
||||
println!("\tQueues:");
|
||||
instance
|
||||
.get_physical_device_queue_family_properties(device)
|
||||
.iter()
|
||||
.enumerate()
|
||||
.for_each(|(i, queue_info)| {
|
||||
println!(
|
||||
"\t\t{}: {:?} ({})",
|
||||
i, queue_info.queue_flags, queue_info.queue_count
|
||||
);
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn create_logical_device(instance: &ash::Instance) {
|
||||
unsafe {
|
||||
instance
|
||||
.enumerate_physical_devices()
|
||||
.expect("vulkan physical devices")
|
||||
.iter().find(|&device|{
|
||||
let device_properties = instance.get_physical_device_properties(device);
|
||||
device_properties.device_type == DISCRETE_GPU
|
||||
}).map(|&device| {
|
||||
vk::DeviceCreateInfo{
|
||||
}
|
||||
|
||||
pub fn init(options: InitOptions) -> Window {
|
||||
let instance = {
|
||||
let entry = Entry::linked();
|
||||
let app_info = vk::ApplicationInfo {
|
||||
api_version: vk::make_api_version(0, 1, 0, 0),
|
||||
..Default::default()
|
||||
};
|
||||
let create_info = vk::InstanceCreateInfo {
|
||||
p_application_info: &app_info,
|
||||
..Default::default()
|
||||
};
|
||||
unsafe {
|
||||
entry
|
||||
.create_instance(&create_info, None)
|
||||
.expect("vulkan instance")
|
||||
}
|
||||
};
|
||||
|
||||
if options.debug_init {
|
||||
describe_devices(&instance);
|
||||
}
|
||||
|
||||
Window {}
|
||||
}
|
||||
Loading…
Reference in New Issue