@@ -20,34 +20,28 @@ namespace vkapi {
20
20
21
21
CommandBuffer::CommandBuffer (
22
22
VkCommandBuffer handle,
23
- VkSemaphore semaphore,
24
23
const VkCommandBufferUsageFlags flags)
25
24
: handle_(handle),
26
- signal_semaphore_ (semaphore),
27
25
flags_ (flags),
28
26
state_(CommandBuffer::State::NEW),
29
27
bound_{} {}
30
28
31
29
CommandBuffer::CommandBuffer (CommandBuffer&& other) noexcept
32
30
: handle_(other.handle_),
33
- signal_semaphore_ (other.signal_semaphore_),
34
31
flags_ (other.flags_),
35
32
state_(other.state_),
36
33
bound_(other.bound_) {
37
34
other.handle_ = VK_NULL_HANDLE;
38
- other.signal_semaphore_ = VK_NULL_HANDLE;
39
35
other.bound_ .reset ();
40
36
}
41
37
42
38
CommandBuffer& CommandBuffer::operator =(CommandBuffer&& other) noexcept {
43
39
handle_ = other.handle_ ;
44
- signal_semaphore_ = other.signal_semaphore_ ;
45
40
flags_ = other.flags_ ;
46
41
state_ = other.state_ ;
47
42
bound_ = other.bound_ ;
48
43
49
44
other.handle_ = VK_NULL_HANDLE;
50
- other.signal_semaphore_ = VK_NULL_HANDLE;
51
45
other.bound_ .reset ();
52
46
other.state_ = CommandBuffer::State::INVALID;
53
47
@@ -310,12 +304,6 @@ CommandPool::~CommandPool() {
310
304
if (pool_ == VK_NULL_HANDLE) {
311
305
return ;
312
306
}
313
- for (auto & semaphore : semaphores_) {
314
- if (semaphore != VK_NULL_HANDLE) {
315
- vkDestroySemaphore (device_, semaphore, nullptr );
316
- }
317
- }
318
-
319
307
vkDestroyCommandPool (device_, pool_, nullptr );
320
308
}
321
309
@@ -326,15 +314,14 @@ CommandBuffer CommandPool::get_new_cmd(bool reusable) {
326
314
allocate_new_batch (config_.cmd_pool_batch_size );
327
315
328
316
VkCommandBuffer handle = buffers_[in_use_];
329
- VkSemaphore semaphore = semaphores_[in_use_];
330
317
331
318
VkCommandBufferUsageFlags cmd_flags = 0u ;
332
319
if (!reusable) {
333
320
cmd_flags |= VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
334
321
}
335
322
336
323
in_use_++;
337
- return CommandBuffer (handle, semaphore, cmd_flags);
324
+ return CommandBuffer (handle, cmd_flags);
338
325
}
339
326
340
327
void CommandPool::flush () {
@@ -350,7 +337,6 @@ void CommandPool::allocate_new_batch(const uint32_t count) {
350
337
}
351
338
352
339
buffers_.resize (buffers_.size () + count);
353
- semaphores_.resize (buffers_.size () + count);
354
340
355
341
const VkCommandBufferAllocateInfo allocate_info{
356
342
VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, // sType
@@ -362,17 +348,6 @@ void CommandPool::allocate_new_batch(const uint32_t count) {
362
348
363
349
VK_CHECK (vkAllocateCommandBuffers (
364
350
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
- }
376
351
}
377
352
378
353
} // namespace vkapi
0 commit comments