#include "cve_pipeline.hpp" #include #include #include namespace cve { CvePipeline::CvePipeline(CveDevice &device, const std::string& vertFilepath, const std::string& fragFilepath, const PipelineConfigInfo &configInfo) : cveDevice{device} { createGraphicsPipeline(vertFilepath, fragFilepath, configInfo); } std::vector CvePipeline::readFile(const std::string& filepath) { std::ifstream file{filepath, std::ios::ate | std::ios::binary}; if (!file.is_open()) { throw std::runtime_error("Failed to open file: " + filepath); } size_t fileSize = static_cast(file.tellg()); std::vector buffer(fileSize); file.seekg(0); file.read(buffer.data(), fileSize); file.close(); return buffer; } void CvePipeline::createGraphicsPipeline(const std::string& vertFilepath, const std::string& fragFilepath, const PipelineConfigInfo &configInfo) { auto vertCode = readFile(vertFilepath); auto fragCode = readFile(fragFilepath); std::cout << "Vertex shader code size: " << vertCode.size() << '\n'; std::cout << "Fragment shader code size: " << fragCode.size() << '\n'; } void createShaderModule(const std::vector& code, VkShaderModule *shaderModule) { VkShaderModuleCreateInfo createInfo{}; createInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO; createInfo.codeSize = code.size(); createInfo.pCode = reinterpret_cast(code.data()); } }