renderer: thread-local commandpools
This commit is contained in:
parent
4cbf1f053b
commit
2b09a2c4f8
|
@ -22,12 +22,14 @@ tracing-subscriber = {version ="0.3.18", features = ["env-filter"]}
|
||||||
glam = {version = "0.29.0", features = ["bytemuck"]}
|
glam = {version = "0.29.0", features = ["bytemuck"]}
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
bitflags = "2.6"
|
bitflags = "2.6"
|
||||||
|
thread_local = "1.1.8"
|
||||||
|
|
||||||
ash = "0.38.0"
|
ash = "0.38.0"
|
||||||
ash-window = "0.13.0"
|
ash-window = "0.13.0"
|
||||||
vk-mem = "0.4.0"
|
vk-mem = "0.4.0"
|
||||||
vk-sync = "0.1.6"
|
vk-sync = "0.1.6"
|
||||||
|
|
||||||
|
arrayvec = "0.7.6"
|
||||||
tinyvec = "1.8"
|
tinyvec = "1.8"
|
||||||
indexmap = "2"
|
indexmap = "2"
|
||||||
petgraph = "0.7"
|
petgraph = "0.7"
|
||||||
|
|
|
@ -5,6 +5,7 @@ edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tinyvec = { workspace = true }
|
tinyvec = { workspace = true }
|
||||||
|
arrayvec = { workspace = true }
|
||||||
indexmap = { workspace = true }
|
indexmap = { workspace = true }
|
||||||
petgraph = { workspace = true }
|
petgraph = { workspace = true }
|
||||||
itertools = { workspace = true }
|
itertools = { workspace = true }
|
||||||
|
@ -13,6 +14,7 @@ rand = { workspace = true }
|
||||||
parking_lot = { workspace = true }
|
parking_lot = { workspace = true }
|
||||||
glam = { workspace = true }
|
glam = { workspace = true }
|
||||||
bitflags = { workspace = true }
|
bitflags = { workspace = true }
|
||||||
|
thread_local = {workspace = true}
|
||||||
|
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
anyhow = { workspace = true }
|
anyhow = { workspace = true }
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -26,6 +26,7 @@ pub struct DeviceQueueFamilies {
|
||||||
pub(crate) present: (u32, u32),
|
pub(crate) present: (u32, u32),
|
||||||
pub(crate) async_compute: (u32, u32),
|
pub(crate) async_compute: (u32, u32),
|
||||||
pub(crate) transfer: (u32, u32),
|
pub(crate) transfer: (u32, u32),
|
||||||
|
pub(crate) properties: Box<[vk::QueueFamilyProperties]>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DeviceQueueFamilies {
|
impl DeviceQueueFamilies {
|
||||||
|
@ -78,12 +79,12 @@ bitflags::bitflags! {
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
pub struct QueueFlags: u32 {
|
pub struct QueueFlags: u32 {
|
||||||
const GRAPHICS = 1 << 0;
|
const GRAPHICS = 1 << 0;
|
||||||
const PRESENT = 1 << 1;
|
const ASYNC_COMPUTE = 1 << 1;
|
||||||
const ASYNC_COMPUTE = 1 << 2;
|
const TRANSFER = 1 << 2;
|
||||||
const TRANSFER = 1 << 3;
|
const PRESENT = 1 << 3;
|
||||||
|
|
||||||
const NONE = 0;
|
const NONE = 0;
|
||||||
const PRESENT_GRAPHICS = 1 << 0 | 1 << 1;
|
const PRESENT_GRAPHICS = 1 << 0 | 1 << 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,7 +257,7 @@ impl DeviceBuilder {
|
||||||
display_handle: Option<RawDisplayHandle>,
|
display_handle: Option<RawDisplayHandle>,
|
||||||
pdev: vk::PhysicalDevice,
|
pdev: vk::PhysicalDevice,
|
||||||
) -> DeviceQueueFamilies {
|
) -> DeviceQueueFamilies {
|
||||||
let queue_families = unsafe {
|
let queue_familiy_properties = unsafe {
|
||||||
instance
|
instance
|
||||||
.instance
|
.instance
|
||||||
.get_physical_device_queue_family_properties(pdev)
|
.get_physical_device_queue_family_properties(pdev)
|
||||||
|
@ -318,7 +319,7 @@ impl DeviceBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut queue_families = QueueFamilies(
|
let mut queue_families = QueueFamilies(
|
||||||
queue_families
|
queue_familiy_properties
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.map(|(i, family)| {
|
.map(|(i, family)| {
|
||||||
|
@ -416,6 +417,7 @@ impl DeviceBuilder {
|
||||||
async_compute,
|
async_compute,
|
||||||
transfer,
|
transfer,
|
||||||
present,
|
present,
|
||||||
|
properties: queue_familiy_properties.into_boxed_slice(),
|
||||||
};
|
};
|
||||||
|
|
||||||
queues
|
queues
|
||||||
|
@ -887,7 +889,7 @@ impl Device {
|
||||||
pub fn physical_device(&self) -> &PhysicalDevice {
|
pub fn physical_device(&self) -> &PhysicalDevice {
|
||||||
&self.0.physical
|
&self.0.physical
|
||||||
}
|
}
|
||||||
pub fn graphics_queue(&self) -> &Queue {
|
pub fn main_queue(&self) -> &Queue {
|
||||||
&self.0.main_queue
|
&self.0.main_queue
|
||||||
}
|
}
|
||||||
pub fn transfer_queue(&self) -> &Queue {
|
pub fn transfer_queue(&self) -> &Queue {
|
||||||
|
|
|
@ -5,6 +5,7 @@ use indexmap::IndexMap;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
buffers::{Buffer, BufferDesc},
|
buffers::{Buffer, BufferDesc},
|
||||||
|
commands::traits::CommandBufferExt,
|
||||||
device::{self, DeviceOwned},
|
device::{self, DeviceOwned},
|
||||||
images::{Image, ImageDesc, ImageViewDesc},
|
images::{Image, ImageDesc, ImageViewDesc},
|
||||||
render_graph::{
|
render_graph::{
|
||||||
|
|
|
@ -8,7 +8,8 @@ use std::{
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
buffers::{Buffer, BufferDesc},
|
buffers::{Buffer, BufferDesc},
|
||||||
commands, def_monotonic_id,
|
commands::{self, traits::CommandBufferExt},
|
||||||
|
def_monotonic_id,
|
||||||
device::{self, DeviceOwned},
|
device::{self, DeviceOwned},
|
||||||
images::{self, Image, ImageDesc},
|
images::{self, Image, ImageDesc},
|
||||||
util::{self, Rgba, WithLifetime},
|
util::{self, Rgba, WithLifetime},
|
||||||
|
@ -489,7 +490,7 @@ impl RenderGraph {
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let pool =
|
let pool =
|
||||||
commands::SingleUseCommandPool::new(device.clone(), device.graphics_queue().clone())?;
|
commands::SingleUseCommandPool::new(device.clone(), device.main_queue().clone())?;
|
||||||
|
|
||||||
let resources = &self.resources;
|
let resources = &self.resources;
|
||||||
let cmds = topo
|
let cmds = topo
|
||||||
|
|
|
@ -7,7 +7,7 @@ pub use crate::egui_pass::{egui_pass, egui_pre_pass};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
buffers::{Buffer, BufferDesc},
|
buffers::{Buffer, BufferDesc},
|
||||||
commands,
|
commands::{self, traits::CommandBufferExt},
|
||||||
device::{Device, DeviceOwned},
|
device::{Device, DeviceOwned},
|
||||||
images::ImageViewDesc,
|
images::ImageViewDesc,
|
||||||
pipeline,
|
pipeline,
|
||||||
|
@ -97,7 +97,7 @@ impl Wireframe {
|
||||||
},
|
},
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let pool = commands::SingleUseCommandPool::new(dev.clone(), dev.graphics_queue().clone())?;
|
let pool = commands::SingleUseCommandPool::new(dev.clone(), dev.main_queue().clone())?;
|
||||||
|
|
||||||
let cmd = pool.alloc()?;
|
let cmd = pool.alloc()?;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue