From 9f00daecc2517aa8fd5a6e4545b2db3f2fff985d Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 23 Jun 2020 17:19:11 +0300 Subject: [PATCH] Make setting a nonexistent uniform only a warning in debug builds During development it's sometimes necessary to disable parts of a shader, which causes variables to disappear. --- source/programdata.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source/programdata.cpp b/source/programdata.cpp index 68820c59..f454fe51 100644 --- a/source/programdata.cpp +++ b/source/programdata.cpp @@ -1,5 +1,7 @@ #include +#include #include +#include #include "buffer.h" #include "color.h" #include "error.h" @@ -92,10 +94,15 @@ void ProgramData::uniform(const string &name, Uniform *uni) else if(name[name.size()-1]==']') throw invalid_argument("ProgramData::uniform"); } - catch(...) + catch(const exception &e) { delete uni; +#ifdef DEBUG + IO::print(IO::cerr, "Error while setting uniform %s: %s: %s\n", name, Debug::demangle(typeid(e).name()), e.what()); + return; +#else throw; +#endif } int i = find_uniform_index(name); -- 2.45.2