From 526d06d0a49578ee45cb87cfd6abf9a8307313b4 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Sat, 12 Nov 2016 10:03:18 +0100 Subject: [PATCH] Add more descriptive error message. --- spirv_cross.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spirv_cross.cpp b/spirv_cross.cpp index c8070a2d..4d027fda 100644 --- a/spirv_cross.cpp +++ b/spirv_cross.cpp @@ -1632,6 +1632,13 @@ void Compiler::parse(const Instruction &instruction) case OpFunctionEnd: { + if (current_block) + { + // Very specific error message, but seems to come up quite often. + throw CompilerError( + "Cannot end a function before ending the current block.\n" + "Likely cause: If this SPIR-V was created from glslang HLSL, make sure the entry point is valid."); + } current_function = nullptr; break; }