handleSchemeNotFound error on android

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
Post Reply
fla666
Greenskin
Posts: 129
Joined: Fri Oct 31, 2014 4:22 am

handleSchemeNotFound error on android

Post by fla666 »

hi guys, does anybody have encountered the "handleSchemeNotFound " problem on android ? i found that this will slow the apk start up time heavily before it can render normally .

on Google Nexus 5 mobile phone , the first call "RenderOneFrame" will take about 500ms , if modify "handleSchemeNotFound" to an empty function, the first "renderOneFrame" become fast , but nothing can be rendered on screen .

could somebody give me some suggestion on how to optimize the app start up time , how to resolve this "handleSchemeNotFound " error ? and will shader cache be help on android ? thanks !

in my app , i create all materials from code, and initialize the ShaderGenerator as following :

Code: Select all

initialiseRTShaderSystem(Ogre::SceneManager* sceneMgr)
{
            if (Ogre::RTShader::ShaderGenerator::initialize())
            {
                mShaderGenerator = Ogre::RTShader::ShaderGenerator::getSingletonPtr();

                mShaderGenerator->addSceneManager(sceneMgr);


                // Create and register the material manager listener if it doesn't exist yet.
                if (mMaterialMgrListener == NULL) {
                    mMaterialMgrListener = new ShaderGeneratorTechniqueResolverListener(mShaderGenerator);
                    Ogre::MaterialManager::getSingleton().addListener(mMaterialMgrListener);
                }
            }

            return true;
}
and ShaderGeneratorTechniqueResolverListener defined as following :

Code: Select all

class ShaderGeneratorTechniqueResolverListener : public MaterialManager::Listener
{
public:

    ShaderGeneratorTechniqueResolverListener(RTShader::ShaderGenerator* pShaderGenerator)
    {
        mShaderGenerator = pShaderGenerator;
    }

    virtual Technique* handleSchemeNotFound(unsigned short schemeIndex, 
        const String& schemeName, Material* originalMaterial, unsigned short lodIndex, 
        const Renderable* rend)
    {       
        // Case this is the default shader generator scheme.
        if (schemeName == RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME)
        {
            MaterialRegisterIterator itFind = mRegisteredMaterials.find(originalMaterial);
            bool techniqueCreated = false;

            // This material was not registered before.
            if (itFind == mRegisteredMaterials.end())
            {
                techniqueCreated = mShaderGenerator->createShaderBasedTechnique(
                    originalMaterial->getName(), 
                    MaterialManager::DEFAULT_SCHEME_NAME, 
                    schemeName);                
            }
            mRegisteredMaterials[originalMaterial] = techniqueCreated;
        }

        return NULL;
    }

protected:
    typedef std::map<Material*, bool>       MaterialRegisterMap;
    typedef MaterialRegisterMap::iterator   MaterialRegisterIterator;


protected:
    MaterialRegisterMap             mRegisteredMaterials;       // Registered material map.
    RTShader::ShaderGenerator*      mShaderGenerator;           // The shader generator instance.
};
Post Reply