From 58d9a6d0b5d9a6677bca6cb4f45f0942e7a6ae2a Mon Sep 17 00:00:00 2001 From: James Turner Date: Tue, 5 Jan 2021 12:58:46 +0000 Subject: [PATCH] Sentry: adjust reporting of missing shaders Reduce noise on the backend when a shader is missing, by special- casing how we report it. --- simgear/scene/material/Effect.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/simgear/scene/material/Effect.cxx b/simgear/scene/material/Effect.cxx index 823c61dc..d62d3aeb 100644 --- a/simgear/scene/material/Effect.cxx +++ b/simgear/scene/material/Effect.cxx @@ -76,7 +76,7 @@ #include #include #include - +#include #include namespace simgear @@ -928,7 +928,8 @@ void ShaderProgramBuilder::buildAttribute(Effect* effect, Pass* pass, // FIXME orig: const string& shaderName = shaderKey.first; string shaderName = shaderKey.first; Shader::Type stype = (Shader::Type)shaderKey.second; - if (getPropertyRoot()->getBoolValue("/sim/version/compositor-support", false) && + const bool compositorEnabled = getPropertyRoot()->getBoolValue("/sim/version/compositor-support", false); + if (compositorEnabled && shaderName.substr(0, shaderName.find("/")) == "Shaders") { shaderName = "Compositor/" + shaderName; } @@ -936,7 +937,9 @@ void ShaderProgramBuilder::buildAttribute(Effect* effect, Pass* pass, if (fileName.empty()) { SG_LOG(SG_INPUT, SG_ALERT, "Could not locate shader" << shaderName); - + if (!compositorEnabled) { + reportError("Missing shader", shaderName); + } throw BuilderException(string("couldn't find shader ") + shaderName);