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);