Operating System: Windows 10
Render System: DX11
There appears to be a logic error in CompositorInstance::resolveTexReference when using a texture_ref with a globabl_scope texture from another compositor chain. Referring to the code listed below, the comment on the first if statement says "Try chain first". However, if the compositor referenced in refCompName is not found on the current chain, Ogre throws an exception, instead of continuing on to try the global search.
For example, I currently have one compositor chain with Compositor A that creates a texture with global_scope. I also have a second independent compositor chain with Compositor B that contains a texture_ref of the texture created by Compositor A. With the current code, it is not possible to resolve the texture reference, because Compositor A does not exist on the chain that holds Compositor B.
The manual seems to indicate it is OK to share global_scope textures across different compositor chains. Am I misunderstanding how this should be used or is this a bug?
Thanks!
Code: Select all
CompositionTechnique::TextureDefinition*
CompositorInstance::resolveTexReference(const CompositionTechnique::TextureDefinition* texDef)
{
//This TextureDefinition is reference.
//Since referenced TD's have no info except name we have to find original TD
CompositionTechnique::TextureDefinition* refTexDef = 0;
//Try chain first
if(mChain)
{
CompositorInstance* refCompInst = mChain->getCompositor(texDef->refCompName);
if(!refCompInst)
OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND, "Referencing non-existent compositor");
refTexDef = refCompInst->getCompositor()->getSupportedTechnique(
refCompInst->getScheme())->getTextureDefinition(texDef->refTexName);
}
if(!refTexDef)
{
//Still NULL. Try global search.
const CompositorPtr &refComp = CompositorManager::getSingleton().getByName(texDef->refCompName);
if(refComp)
{
refTexDef = refComp->getSupportedTechnique()->getTextureDefinition(texDef->refTexName);
}
}
if(!refTexDef)
{
OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND, "Referencing non-existent compositor texture");
}
if (refTexDef->scope == CompositionTechnique::TS_LOCAL)
OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
"Referenced texture '" + texDef->refTexName + "' has only local scope");
return refTexDef;
}