Lower command buffer/descriptor set allocator defaults (#2369)

This commit is contained in:
marc0246 2023-10-24 18:13:41 +02:00 committed by GitHub
parent eba2514924
commit b972244b78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 11 deletions

View File

@ -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 /// 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. /// 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, pub primary_buffer_count: usize,
/// Same as `primary_buffer_count` except for secondary command buffers. /// 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 secondary_buffer_count: usize,
pub _ne: crate::NonExhaustive, pub _ne: crate::NonExhaustive,
@ -554,8 +554,8 @@ impl Default for StandardCommandBufferAllocatorCreateInfo {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
StandardCommandBufferAllocatorCreateInfo { StandardCommandBufferAllocatorCreateInfo {
primary_buffer_count: 256, primary_buffer_count: 32,
secondary_buffer_count: 256, secondary_buffer_count: 0,
_ne: crate::NonExhaustive(()), _ne: crate::NonExhaustive(()),
} }
} }

View File

@ -321,8 +321,9 @@ mod tests {
use crate::{ use crate::{
buffer::{Buffer, BufferCreateInfo, BufferUsage}, buffer::{Buffer, BufferCreateInfo, BufferUsage},
command_buffer::{ command_buffer::{
allocator::StandardCommandBufferAllocator, AutoCommandBufferBuilder, BufferCopy, allocator::{StandardCommandBufferAllocator, StandardCommandBufferAllocatorCreateInfo},
CommandBufferUsage, CopyBufferInfoTyped, PrimaryCommandBufferAbstract, AutoCommandBufferBuilder, BufferCopy, CommandBufferUsage, CopyBufferInfoTyped,
PrimaryCommandBufferAbstract,
}, },
descriptor_set::{ descriptor_set::{
allocator::StandardDescriptorSetAllocator, allocator::StandardDescriptorSetAllocator,
@ -447,7 +448,13 @@ mod tests {
fn secondary_nonconcurrent_conflict() { fn secondary_nonconcurrent_conflict() {
let (device, queue) = gfx_dev_and_queue!(); 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. // Make a secondary CB that doesn't support simultaneous use.
let builder = AutoCommandBufferBuilder::secondary( let builder = AutoCommandBufferBuilder::secondary(
@ -605,8 +612,13 @@ mod tests {
unsafe { unsafe {
let (device, queue) = gfx_dev_and_queue!(); let (device, queue) = gfx_dev_and_queue!();
let cb_allocator = let cb_allocator = StandardCommandBufferAllocator::new(
StandardCommandBufferAllocator::new(device.clone(), Default::default()); device.clone(),
StandardCommandBufferAllocatorCreateInfo {
secondary_buffer_count: 1,
..Default::default()
},
);
let cbb = AutoCommandBufferBuilder::primary( let cbb = AutoCommandBufferBuilder::primary(
&cb_allocator, &cb_allocator,
queue.queue_family_index(), queue.queue_family_index(),

View File

@ -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 /// 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. /// 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, pub set_count: usize,
/// Whether to allocate descriptor pools with the /// Whether to allocate descriptor pools with the
@ -481,7 +481,7 @@ impl Default for StandardDescriptorSetAllocatorCreateInfo {
#[inline] #[inline]
fn default() -> Self { fn default() -> Self {
StandardDescriptorSetAllocatorCreateInfo { StandardDescriptorSetAllocatorCreateInfo {
set_count: 256, set_count: 32,
update_after_bind: false, update_after_bind: false,
_ne: crate::NonExhaustive(()), _ne: crate::NonExhaustive(()),
} }