From fb7653d8e5f7b4f46dbb9981dbb8e733deed6b50 Mon Sep 17 00:00:00 2001 From: Tobias Frisch <tfrisch@uni-koblenz.de> Date: Fri, 9 Jul 2021 12:09:54 +0200 Subject: [PATCH] [#56] Added missing check into first_mesh example Signed-off-by: Tobias Frisch <tfrisch@uni-koblenz.de> --- projects/first_mesh/src/main.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/projects/first_mesh/src/main.cpp b/projects/first_mesh/src/main.cpp index 6eaf429c..c71d80b3 100644 --- a/projects/first_mesh/src/main.cpp +++ b/projects/first_mesh/src/main.cpp @@ -34,9 +34,8 @@ int main(int argc, const char** argv) { if (result == 1) { std::cout << "Mesh loading successful!" << std::endl; - } - else { - std::cout << "Mesh loading failed: " << result << std::endl; + } else { + std::cerr << "Mesh loading failed: " << result << std::endl; return 1; } @@ -74,7 +73,7 @@ int main(int argc, const char** argv) { vkcv::PassHandle firstMeshPass = core.createPass(firstMeshPassDefinition); if (!firstMeshPass) { - std::cout << "Error. Could not create renderpass. Exiting." << std::endl; + std::cerr << "Error. Could not create renderpass. Exiting." << std::endl; return EXIT_FAILURE; } @@ -113,12 +112,15 @@ int main(int argc, const char** argv) { vkcv::PipelineHandle firstMeshPipeline = core.createGraphicsPipeline(firstMeshPipelineConfig); if (!firstMeshPipeline) { - std::cout << "Error. Could not create graphics pipeline. Exiting." << std::endl; + std::cerr << "Error. Could not create graphics pipeline. Exiting." << std::endl; + return EXIT_FAILURE; + } + + if (mesh.textures.empty()) { + std::cerr << "Error. No textures found. Exiting." << std::endl; return EXIT_FAILURE; } - // FIXME There should be a test here to make sure there is at least 1 - // texture in the mesh. vkcv::asset::Texture &tex = mesh.textures[0]; vkcv::Image texture = core.createImage(vk::Format::eR8G8B8A8Srgb, tex.w, tex.h); texture.fill(tex.data.data()); -- GitLab