Added error handling, and fixed some typos

This commit is contained in:
2026-02-20 11:07:45 +00:00
parent 8515256162
commit 38dd0e732c
2 changed files with 13 additions and 8 deletions

BIN
a.out

Binary file not shown.

View File

@@ -3,6 +3,7 @@
#include <fstream>
#include <stdexcept>
#include <iostream>
#include <cassert>
namespace cve {
CvePipeline::CvePipeline(CveDevice &device, const std::string& vertFilepath,
@@ -38,6 +39,10 @@ namespace cve {
auto vertCode = readFile(vertFilepath);
auto fragCode = readFile(fragFilepath);
assert(configInfo.pipelineLayout != VK_NULL_HANDLE &&
"Unable to create graphics pipeline");
assert(configInfo.renderPass != VK_NULL_HANDLE &&
"Unable to create graphics pipeline");
createShaderModule(vertCode, &vertShaderModule);
createShaderModule(fragCode, &fragShaderModule);
@@ -47,16 +52,16 @@ namespace cve {
shaderStages[0].module = vertShaderModule;
shaderStages[0].pName = "main";
shaderStages[0].flags = 0;
shaderStages[0].pName = nullptr;
shaderStages[0].pNext = nullptr;
shaderStages[0].pSpecializationInfo = nullptr;
shaderStages[0].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
shaderStages[0].stage = VK_SHADER_STAGE_FRAGMENT_BIT;
shaderStages[0].module = fragShaderModule;
shaderStages[0].pName = "main";
shaderStages[0].flags = 0;
shaderStages[0].pName = nullptr;
shaderStages[0].pSpecializationInfo = nullptr;
shaderStages[1].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
shaderStages[1].stage = VK_SHADER_STAGE_FRAGMENT_BIT;
shaderStages[1].module = fragShaderModule;
shaderStages[1].pName = "main";
shaderStages[1].flags = 0;
shaderStages[1].pNext = nullptr;
shaderStages[1].pSpecializationInfo = nullptr;
VkPipelineVertexInputStateCreateInfo vertexInputInfo{};
vertexInputInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;