diff --git a/ogre2/src/Ogre2Material.cc b/ogre2/src/Ogre2Material.cc index d603a7784..924a29e2a 100644 --- a/ogre2/src/Ogre2Material.cc +++ b/ogre2/src/Ogre2Material.cc @@ -646,6 +646,13 @@ void Ogre2Material::UpdateShaderParams(ConstShaderParamsPtr _params, continue; } + if (!_ogreParams->_findNamedConstantDefinition(name_param.first)) + { + ignwarn << "Unable to find GPU program parameter: " + << name_param.first << std::endl; + continue; + } + if (ShaderParam::PARAM_FLOAT == name_param.second.Type()) { float value; diff --git a/test/integration/camera.cc b/test/integration/camera.cc index c228cdd46..92fd0f252 100644 --- a/test/integration/camera.cc +++ b/test/integration/camera.cc @@ -671,6 +671,10 @@ void CameraTest::ShaderSelection(const std::string &_renderEngine) // correct type and value. auto params = visual->Material()->VertexShaderParams(); (*params)["worldviewproj_matrix"] = 1; + + // check setting invalid param - this should print a warning msg and + // not cause the program to crash. + (*params)["worldviewproj_matrix_invalid"] = 1; } // render a few frames