Skip to content

Commit

Permalink
Lower command buffer/descriptor set allocator defaults (vulkano-rs#2369)
Browse files Browse the repository at this point in the history
  • Loading branch information
marc0246 authored and hakolao committed Feb 20, 2024
1 parent 8ee4020 commit a63ba84
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
8 changes: 4 additions & 4 deletions vulkano/src/command_buffer/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -539,12 +539,12 @@ pub struct StandardCommandBufferAllocatorCreateInfo {
/// would mean that the pool would have to be reset more often, or that more pools would need
/// to be created, depending on the lifetime of the command buffers.
///
/// The default value is `256`.
/// The default value is `32`.
pub primary_buffer_count: usize,

/// Same as `primary_buffer_count` except for secondary command buffers.
///
/// The default value is `256`.
/// The default value is `0`.
pub secondary_buffer_count: usize,

pub _ne: crate::NonExhaustive,
Expand All @@ -554,8 +554,8 @@ impl Default for StandardCommandBufferAllocatorCreateInfo {
#[inline]
fn default() -> Self {
StandardCommandBufferAllocatorCreateInfo {
primary_buffer_count: 256,
secondary_buffer_count: 256,
primary_buffer_count: 32,
secondary_buffer_count: 0,
_ne: crate::NonExhaustive(()),
}
}
Expand Down
22 changes: 17 additions & 5 deletions vulkano/src/command_buffer/auto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,9 @@ mod tests {
use crate::{
buffer::{Buffer, BufferCreateInfo, BufferUsage},
command_buffer::{
allocator::StandardCommandBufferAllocator, AutoCommandBufferBuilder, BufferCopy,
CommandBufferUsage, CopyBufferInfoTyped, PrimaryCommandBufferAbstract,
allocator::{StandardCommandBufferAllocator, StandardCommandBufferAllocatorCreateInfo},
AutoCommandBufferBuilder, BufferCopy, CommandBufferUsage, CopyBufferInfoTyped,
PrimaryCommandBufferAbstract,
},
descriptor_set::{
allocator::StandardDescriptorSetAllocator,
Expand Down Expand Up @@ -447,7 +448,13 @@ mod tests {
fn secondary_nonconcurrent_conflict() {
let (device, queue) = gfx_dev_and_queue!();

let cb_allocator = StandardCommandBufferAllocator::new(device, Default::default());
let cb_allocator = StandardCommandBufferAllocator::new(
device,
StandardCommandBufferAllocatorCreateInfo {
secondary_buffer_count: 1,
..Default::default()
},
);

// Make a secondary CB that doesn't support simultaneous use.
let builder = AutoCommandBufferBuilder::secondary(
Expand Down Expand Up @@ -605,8 +612,13 @@ mod tests {
unsafe {
let (device, queue) = gfx_dev_and_queue!();

let cb_allocator =
StandardCommandBufferAllocator::new(device.clone(), Default::default());
let cb_allocator = StandardCommandBufferAllocator::new(
device.clone(),
StandardCommandBufferAllocatorCreateInfo {
secondary_buffer_count: 1,
..Default::default()
},
);
let cbb = AutoCommandBufferBuilder::primary(
&cb_allocator,
queue.queue_family_index(),
Expand Down
4 changes: 2 additions & 2 deletions vulkano/src/descriptor_set/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ pub struct StandardDescriptorSetAllocatorCreateInfo {
/// hand would mean that the pool would have to be reset more often, or that more pools would
/// need to be created, depending on the lifetime of the descriptor sets.
///
/// The default value is `256`.
/// The default value is `32`.
pub set_count: usize,

/// Whether to allocate descriptor pools with the
Expand All @@ -481,7 +481,7 @@ impl Default for StandardDescriptorSetAllocatorCreateInfo {
#[inline]
fn default() -> Self {
StandardDescriptorSetAllocatorCreateInfo {
set_count: 256,
set_count: 32,
update_after_bind: false,
_ne: crate::NonExhaustive(()),
}
Expand Down

0 comments on commit a63ba84

Please # to comment.