From 88035e14e51d4615667473c4cd1e47b4224777a5 Mon Sep 17 00:00:00 2001 From: Darren VanBuren Date: Mon, 11 Feb 2019 14:07:16 -0800 Subject: [PATCH] Spit out error messages in readFile --- .vscode/c_cpp_properties.json | 2 +- main.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 94dcc0a..43def6c 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -18,5 +18,5 @@ "cppStandard": "c++17" } ], - "version": 3 + "version": 4 } \ No newline at end of file diff --git a/main.cpp b/main.cpp index be1a971..ed9ff17 100644 --- a/main.cpp +++ b/main.cpp @@ -68,7 +68,7 @@ private: VkDevice device; VkSurfaceKHR surface; VkQueue presentQueue; - VkSwapchainKHR swapChain; + VkSwapchainKHR swapChain = VK_NULL_HANDLE; std::vector swapChainImages; VkFormat swapChainImageFormat; VkExtent2D swapChainExtent; @@ -592,7 +592,9 @@ private: } void createGraphicsPipeline() { + std::cerr << "Loading vertex shader." << std::endl; auto vertShaderCode = readFile("shaders/vert.spv"); + std::cerr << "Loading fragment shader." << std::endl; auto fragShaderCode = readFile("shaders/frag.spv"); VkShaderModule vertShaderModule; @@ -736,9 +738,10 @@ private: static std::vector readFile(const std::string& filename) { // 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()) { + std::cerr << "Error code: " << strerror(errno) << std::endl; throw std::runtime_error("failed to open file!"); }