I am having issues reloading a shader in Ogre 2.1, with the GL3Plus rendering system. For reloading, I am using the same procedure as in HdrUtils and MiscUtils from the samples.
Something along these lines:
Code: Select all
Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().load( "HDR/Resolve_4xFP32_HDR_Box", Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME ). staticCast<Ogre::Material>(); Ogre::Pass *pass = material->getTechnique(0)->getPass(0); Ogre::GpuProgram *shader = 0; Ogre::GpuProgramParametersSharedPtr oldParams; //Save old manual & auto params oldParams = pass->getFragmentProgramParameters(); //Retrieve the HLSL/GLSL/Metal shader and rebuild it with the right settings. shader = pass->getFragmentProgram()->_getBindingDelegate(); shader->setParameter( "preprocessor_defines", preprocessorDefines ); pass->getFragmentProgram()->reload(); //Restore manual & auto params to the newly compiled shader pass->getFragmentProgramParameters()->copyConstantsFrom( *oldParams );
Is this a known issue, or am I just doing something wrong?
I found this issue on the subject:
which was fixed in
Unfortunately these changes don't apply very cleanly at all on 2.1 in isolation. Are there any other commits that would help apply these fixes more cleanly?