完成Buffer创建和销毁,以及直接访问模式的数据上传

This commit is contained in:
2026-01-16 20:04:17 +08:00
parent 735f1a08b6
commit d45ae1d436
27 changed files with 638 additions and 215 deletions

View 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_);
}
}