Better error handling on load failure

This commit is contained in:
Richard Harrison
2019-01-20 18:28:37 +01:00
parent 8e57a61aed
commit 4f6c8f7784
+12 -1
View File
@@ -830,6 +830,9 @@ void reload_shaders()
if (!fileName.empty()) { if (!fileName.empty()) {
shader->loadShaderSourceFromFile(fileName); shader->loadShaderSourceFromFile(fileName);
} }
else
SG_LOG(SG_INPUT, SG_ALERT, "Could not locate shader: " << fileName);
} }
} }
@@ -917,8 +920,13 @@ void ShaderProgramBuilder::buildAttribute(Effect* effect, Pass* pass,
Shader::Type stype = (Shader::Type)shaderKey.second; Shader::Type stype = (Shader::Type)shaderKey.second;
string fileName = SGModelLib::findDataFile(shaderName, options); string fileName = SGModelLib::findDataFile(shaderName, options);
if (fileName.empty()) if (fileName.empty())
{
SG_LOG(SG_INPUT, SG_ALERT, "Could not locate shader" << shaderName);
throw BuilderException(string("couldn't find shader ") + throw BuilderException(string("couldn't find shader ") +
shaderName); shaderName);
}
resolvedKey.shaders.push_back(ShaderKey(fileName, stype)); resolvedKey.shaders.push_back(ShaderKey(fileName, stype));
} }
ProgramMap::iterator resitr = resolvedProgramMap.find(resolvedKey); ProgramMap::iterator resitr = resolvedProgramMap.find(resolvedKey);
@@ -1405,8 +1413,11 @@ bool makeParametersFromStateSet(SGPropertyNode* effectRoot, const StateSet* ss)
// Walk the techniques property tree, building techniques and // Walk the techniques property tree, building techniques and
// passes. // passes.
static SGMutex realizeTechniques_lock;
bool Effect::realizeTechniques(const SGReaderWriterOptions* options) bool Effect::realizeTechniques(const SGReaderWriterOptions* options)
{ {
SGGuard<SGMutex> g(realizeTechniques_lock);
if (_isRealized) if (_isRealized)
return true; return true;
PropertyList tniqList = root->getChildren("technique"); PropertyList tniqList = root->getChildren("technique");