Error-reporting: add some errors for Effect shaders
This commit is contained in:
@@ -289,6 +289,8 @@ void buildPass(Effect* effect, Technique* tniq, const SGPropertyNode* prop,
|
|||||||
const SGReaderWriterOptions* options)
|
const SGReaderWriterOptions* options)
|
||||||
{
|
{
|
||||||
// REVIEW: Memory Leak - 35,712 bytes in 72 blocks are still reachable
|
// REVIEW: Memory Leak - 35,712 bytes in 72 blocks are still reachable
|
||||||
|
simgear::ErrorReportContext ec("effect-pass", prop->getPath());
|
||||||
|
|
||||||
Pass* pass = new Pass;
|
Pass* pass = new Pass;
|
||||||
tniq->passes.push_back(pass);
|
tniq->passes.push_back(pass);
|
||||||
for (int i = 0; i < prop->nChildren(); ++i) {
|
for (int i = 0; i < prop->nChildren(); ++i) {
|
||||||
@@ -841,10 +843,12 @@ void reload_shaders()
|
|||||||
string fileName = SGModelLib::findDataFile(sitr->first.first);
|
string fileName = SGModelLib::findDataFile(sitr->first.first);
|
||||||
if (!fileName.empty()) {
|
if (!fileName.empty()) {
|
||||||
loadShaderFromUTF8File(shader, fileName);
|
loadShaderFromUTF8File(shader, fileName);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
SG_LOG(SG_INPUT, SG_ALERT, "Could not locate shader: " << fileName);
|
SG_LOG(SG_INPUT, SG_ALERT, "Could not locate shader: " << fileName);
|
||||||
|
simgear::reportFailure(simgear::LoadFailure::NotFound,
|
||||||
|
simgear::ErrorCode::MissingShader,
|
||||||
|
"Reload: couldn't find shader:" + sitr->first.first);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -962,8 +966,19 @@ void ShaderProgramBuilder::buildAttribute(Effect* effect, Pass* pass,
|
|||||||
ref_ptr<Shader> shader = new Shader(stype);
|
ref_ptr<Shader> shader = new Shader(stype);
|
||||||
shader->setName(fileName);
|
shader->setName(fileName);
|
||||||
if (loadShaderFromUTF8File(shader, fileName)) {
|
if (loadShaderFromUTF8File(shader, fileName)) {
|
||||||
program->addShader(shader.get());
|
if (!program->addShader(shader.get())) {
|
||||||
|
simgear::reportFailure(simgear::LoadFailure::BadData,
|
||||||
|
simgear::ErrorCode::MissingShader,
|
||||||
|
"Program::addShader failed",
|
||||||
|
SGPath::fromUtf8(fileName));
|
||||||
|
}
|
||||||
|
|
||||||
shaderMap.insert(ShaderMap::value_type(skey, shader));
|
shaderMap.insert(ShaderMap::value_type(skey, shader));
|
||||||
|
} else {
|
||||||
|
simgear::reportFailure(simgear::LoadFailure::BadData,
|
||||||
|
simgear::ErrorCode::MissingShader,
|
||||||
|
"Failed to read shader source code",
|
||||||
|
SGPath::fromUtf8(fileName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1324,6 +1339,8 @@ InstallAttributeBuilder<DepthBuilder> installDepth("depth");
|
|||||||
void buildTechnique(Effect* effect, const SGPropertyNode* prop,
|
void buildTechnique(Effect* effect, const SGPropertyNode* prop,
|
||||||
const SGReaderWriterOptions* options)
|
const SGReaderWriterOptions* options)
|
||||||
{
|
{
|
||||||
|
simgear::ErrorReportContext ec("effect-technique", prop->getPath());
|
||||||
|
|
||||||
// REVIEW: Memory Leak - 13,248 bytes in 72 blocks are indirectly lost
|
// REVIEW: Memory Leak - 13,248 bytes in 72 blocks are indirectly lost
|
||||||
Technique* tniq = new Technique;
|
Technique* tniq = new Technique;
|
||||||
effect->techniques.push_back(tniq);
|
effect->techniques.push_back(tniq);
|
||||||
|
|||||||
Reference in New Issue
Block a user