Files
sophia/engine/src/vulkan/pipelines/pipeline.cpp
T
2026-09-21 01:15:58 -07:00

28 lines
770 B
C++

#include "pipeline.hpp"
#include <sophia/util/logger.hpp>
#include <stdexcept>
namespace sophia {
Pipeline::Pipeline(Device& device, vk::PipelineBindPoint bindPoint)
: device{device}, bindPoint{bindPoint} {}
void Pipeline::bind(vk::CommandBuffer commandBuffer) {
commandBuffer.bindPipeline(this->bindPoint, this->pipeline.get());
}
vk::UniqueShaderModule Pipeline::createShaderModule(
const std::vector<u32>& spirv) {
try {
return device.get()->createShaderModuleUnique(
{vk::ShaderModuleCreateFlags(), spirv.size() * sizeof(u32),
spirv.data()});
} catch (const vk::SystemError& err) {
log::fatal("failed to create shader module");
throw std::runtime_error("failed to create shader module");
}
}
} // namespace sophia