texture gets its own command buffer and fence

This commit is contained in:
Alex Janka 2023-10-19 13:48:20 +11:00
parent ab422a283d
commit 81bf301666
2 changed files with 11 additions and 3 deletions

View file

@ -26,12 +26,14 @@ pub(super) struct VulkanData {
pub(super) pool: vk::CommandPool, pub(super) pool: vk::CommandPool,
pub(super) draw_command_buffer: vk::CommandBuffer, pub(super) draw_command_buffer: vk::CommandBuffer,
pub(super) setup_command_buffer: vk::CommandBuffer, pub(super) setup_command_buffer: vk::CommandBuffer,
pub(super) texture_copy_command_buffer: vk::CommandBuffer,
pub(super) present_complete_semaphore: vk::Semaphore, pub(super) present_complete_semaphore: vk::Semaphore,
pub(super) rendering_complete_semaphore: vk::Semaphore, pub(super) rendering_complete_semaphore: vk::Semaphore,
pub(super) draw_commands_reuse_fence: vk::Fence, pub(super) draw_commands_reuse_fence: vk::Fence,
pub(super) setup_commands_reuse_fence: vk::Fence, pub(super) setup_commands_reuse_fence: vk::Fence,
pub(super) texture_copy_commands_reuse_fence: vk::Fence,
pub(super) descriptor_sets: Vec<vk::DescriptorSet>, pub(super) descriptor_sets: Vec<vk::DescriptorSet>,
pub(super) descriptor_pool: vk::DescriptorPool, pub(super) descriptor_pool: vk::DescriptorPool,
@ -108,7 +110,7 @@ impl VulkanData {
let pool = device.create_command_pool(&pool_create_info, None).unwrap(); let pool = device.create_command_pool(&pool_create_info, None).unwrap();
let command_buffer_allocate_info = vk::CommandBufferAllocateInfo::builder() let command_buffer_allocate_info = vk::CommandBufferAllocateInfo::builder()
.command_buffer_count(2) .command_buffer_count(3)
.command_pool(pool) .command_pool(pool)
.level(vk::CommandBufferLevel::PRIMARY) .level(vk::CommandBufferLevel::PRIMARY)
.build(); .build();
@ -118,6 +120,7 @@ impl VulkanData {
.unwrap(); .unwrap();
let setup_command_buffer = command_buffers[0]; let setup_command_buffer = command_buffers[0];
let draw_command_buffer = command_buffers[1]; let draw_command_buffer = command_buffers[1];
let texture_copy_command_buffer = command_buffers[2];
let device_memory_properties = manager let device_memory_properties = manager
.instance .instance
@ -133,6 +136,9 @@ impl VulkanData {
let setup_commands_reuse_fence = device let setup_commands_reuse_fence = device
.create_fence(&fence_create_info, None) .create_fence(&fence_create_info, None)
.expect("Create fence failed."); .expect("Create fence failed.");
let texture_copy_commands_reuse_fence = device
.create_fence(&fence_create_info, None)
.expect("Create fence failed.");
let semaphore_create_info = vk::SemaphoreCreateInfo::default(); let semaphore_create_info = vk::SemaphoreCreateInfo::default();
@ -199,10 +205,12 @@ impl VulkanData {
pool, pool,
draw_command_buffer, draw_command_buffer,
setup_command_buffer, setup_command_buffer,
texture_copy_command_buffer,
present_complete_semaphore, present_complete_semaphore,
rendering_complete_semaphore, rendering_complete_semaphore,
draw_commands_reuse_fence, draw_commands_reuse_fence,
setup_commands_reuse_fence, setup_commands_reuse_fence,
texture_copy_commands_reuse_fence,
descriptor_sets, descriptor_sets,
desc_set_layouts, desc_set_layouts,
descriptor_pool, descriptor_pool,

View file

@ -487,8 +487,8 @@ impl VulkanWindowInner {
record_submit_commandbuffer( record_submit_commandbuffer(
&self.vulkan_data.device, &self.vulkan_data.device,
self.vulkan_data.setup_command_buffer, self.vulkan_data.texture_copy_command_buffer,
self.vulkan_data.setup_commands_reuse_fence, self.vulkan_data.texture_copy_commands_reuse_fence,
self.vulkan_data.present_queue, self.vulkan_data.present_queue,
&[], &[],
&[], &[],