完成Buffer创建和销毁,以及直接访问模式的数据上传
This commit is contained in:
34
src/render/vulkan_command_buffer.cpp
Normal file
34
src/render/vulkan_command_buffer.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#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_);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user