Spit out error messages in readFile
This commit is contained in:
parent
868c4a0975
commit
88035e14e5
2 changed files with 6 additions and 3 deletions
2
.vscode/c_cpp_properties.json
vendored
2
.vscode/c_cpp_properties.json
vendored
|
@ -18,5 +18,5 @@
|
||||||
"cppStandard": "c++17"
|
"cppStandard": "c++17"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"version": 3
|
"version": 4
|
||||||
}
|
}
|
7
main.cpp
7
main.cpp
|
@ -68,7 +68,7 @@ private:
|
||||||
VkDevice device;
|
VkDevice device;
|
||||||
VkSurfaceKHR surface;
|
VkSurfaceKHR surface;
|
||||||
VkQueue presentQueue;
|
VkQueue presentQueue;
|
||||||
VkSwapchainKHR swapChain;
|
VkSwapchainKHR swapChain = VK_NULL_HANDLE;
|
||||||
std::vector<VkImage> swapChainImages;
|
std::vector<VkImage> swapChainImages;
|
||||||
VkFormat swapChainImageFormat;
|
VkFormat swapChainImageFormat;
|
||||||
VkExtent2D swapChainExtent;
|
VkExtent2D swapChainExtent;
|
||||||
|
@ -592,7 +592,9 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
void createGraphicsPipeline() {
|
void createGraphicsPipeline() {
|
||||||
|
std::cerr << "Loading vertex shader." << std::endl;
|
||||||
auto vertShaderCode = readFile("shaders/vert.spv");
|
auto vertShaderCode = readFile("shaders/vert.spv");
|
||||||
|
std::cerr << "Loading fragment shader." << std::endl;
|
||||||
auto fragShaderCode = readFile("shaders/frag.spv");
|
auto fragShaderCode = readFile("shaders/frag.spv");
|
||||||
|
|
||||||
VkShaderModule vertShaderModule;
|
VkShaderModule vertShaderModule;
|
||||||
|
@ -736,9 +738,10 @@ private:
|
||||||
|
|
||||||
static std::vector<char> readFile(const std::string& filename) {
|
static std::vector<char> readFile(const std::string& filename) {
|
||||||
// Start reading at end of the file, as binary.
|
// Start reading at end of the file, as binary.
|
||||||
std::ifstream file(filename, std::ios::ate | std::ios::binary);
|
std::ifstream file(filename, std::ios::ate | std::ios::binary);
|
||||||
|
|
||||||
if(!file.is_open()) {
|
if(!file.is_open()) {
|
||||||
|
std::cerr << "Error code: " << strerror(errno) << std::endl;
|
||||||
throw std::runtime_error("failed to open file!");
|
throw std::runtime_error("failed to open file!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue