35 lines
904 B
C++
35 lines
904 B
C++
#include "vulkan_command_buffer.h"
|
|
|
|
#include "vulkan_context.h"
|
|
|
|
namespace mirai {
|
|
vulkan_command_buffer::vulkan_command_buffer(std::shared_ptr<vulkan_queue> queue, vk::CommandBufferLevel level) {
|
|
queue_ = queue;
|
|
level_ = level;
|
|
cmd_ = vulkan_thread_context::get().allocate_command_buffer(queue_, level_);
|
|
}
|
|
|
|
vk::Result vulkan_command_buffer::begin(const vk::CommandBufferBeginInfo& info) const {
|
|
return cmd_.begin(info);
|
|
}
|
|
|
|
void vulkan_command_buffer::pipeline_barrier(const vk::DependencyInfo& dependency_info) {
|
|
return cmd_.pipelineBarrier2(dependency_info);
|
|
}
|
|
|
|
void vulkan_command_buffer::execute_cleanup_tasks() {
|
|
for (const auto& task : cleanup_tasks_) {
|
|
if (task.task) {
|
|
task.task();
|
|
}
|
|
}
|
|
cleanup_tasks_.clear();
|
|
}
|
|
|
|
void vulkan_command_buffer::on_destroying() {
|
|
object::on_destroying();
|
|
|
|
vulkan_thread_context::get().free_command_buffer(queue_, cmd_);
|
|
}
|
|
}
|