@@ -20,34 +20,28 @@ namespace vkapi {
2020
2121CommandBuffer::CommandBuffer (
2222 VkCommandBuffer handle,
23- VkSemaphore semaphore,
2423 const VkCommandBufferUsageFlags flags)
2524 : handle_(handle),
26- signal_semaphore_ (semaphore),
2725 flags_ (flags),
2826 state_(CommandBuffer::State::NEW),
2927 bound_{} {}
3028
3129CommandBuffer::CommandBuffer (CommandBuffer&& other) noexcept
3230 : handle_(other.handle_),
33- signal_semaphore_ (other.signal_semaphore_),
3431 flags_ (other.flags_),
3532 state_(other.state_),
3633 bound_(other.bound_) {
3734 other.handle_ = VK_NULL_HANDLE;
38- other.signal_semaphore_ = VK_NULL_HANDLE;
3935 other.bound_ .reset ();
4036}
4137
4238CommandBuffer& CommandBuffer::operator =(CommandBuffer&& other) noexcept {
4339 handle_ = other.handle_ ;
44- signal_semaphore_ = other.signal_semaphore_ ;
4540 flags_ = other.flags_ ;
4641 state_ = other.state_ ;
4742 bound_ = other.bound_ ;
4843
4944 other.handle_ = VK_NULL_HANDLE;
50- other.signal_semaphore_ = VK_NULL_HANDLE;
5145 other.bound_ .reset ();
5246 other.state_ = CommandBuffer::State::INVALID;
5347
@@ -310,12 +304,6 @@ CommandPool::~CommandPool() {
310304 if (pool_ == VK_NULL_HANDLE) {
311305 return ;
312306 }
313- for (auto & semaphore : semaphores_) {
314- if (semaphore != VK_NULL_HANDLE) {
315- vkDestroySemaphore (device_, semaphore, nullptr );
316- }
317- }
318-
319307 vkDestroyCommandPool (device_, pool_, nullptr );
320308}
321309
@@ -326,15 +314,14 @@ CommandBuffer CommandPool::get_new_cmd(bool reusable) {
326314 allocate_new_batch (config_.cmd_pool_batch_size );
327315
328316 VkCommandBuffer handle = buffers_[in_use_];
329- VkSemaphore semaphore = semaphores_[in_use_];
330317
331318 VkCommandBufferUsageFlags cmd_flags = 0u ;
332319 if (!reusable) {
333320 cmd_flags |= VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
334321 }
335322
336323 in_use_++;
337- return CommandBuffer (handle, semaphore, cmd_flags);
324+ return CommandBuffer (handle, cmd_flags);
338325}
339326
340327void CommandPool::flush () {
@@ -350,7 +337,6 @@ void CommandPool::allocate_new_batch(const uint32_t count) {
350337 }
351338
352339 buffers_.resize (buffers_.size () + count);
353- semaphores_.resize (buffers_.size () + count);
354340
355341 const VkCommandBufferAllocateInfo allocate_info{
356342 VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, // sType
@@ -362,17 +348,6 @@ void CommandPool::allocate_new_batch(const uint32_t count) {
362348
363349 VK_CHECK (vkAllocateCommandBuffers (
364350 device_, &allocate_info, buffers_.data () + in_use_));
365-
366- const VkSemaphoreCreateInfo semaphoreCreateInfo = {
367- VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO, nullptr , 0 };
368-
369- for (uint32_t i = 0 ; i < count; i++) {
370- VK_CHECK (vkCreateSemaphore (
371- device_,
372- &semaphoreCreateInfo,
373- nullptr ,
374- semaphores_.data () + in_use_ + i));
375- }
376351}
377352
378353} // namespace vkapi
0 commit comments