UniformParameterPtr Program::resolveParameter(GpuProgramParameters::AutoConstantType autoType, size_t data) { UniformParameterPtr param; // Check if parameter already exists. param = getParameterByAutoType(autoType); if (param) { return param; } // Create new parameter size_t size = 0; if(isArray(autoType)) std::swap(size, data); // for array autotypes the extra parameter is the size param = UniformParameterPtr(OGRE_NEW UniformParameter(autoType, data, size)); addParameter(param); return param; }
//----------------------------------------------------------------------------- UniformParameterPtr Program::resolveAutoParameterInt(GpuProgramParameters::AutoConstantType autoType, GpuConstantType type, size_t data, size_t size) { UniformParameterPtr param; // Check if parameter already exists. param = getParameterByAutoType(autoType); if (param.get() != NULL) { if (param->isAutoConstantIntParameter() && param->getAutoConstantIntData() == data) { param->setSize(std::max(size, param->getSize())); return param; } } // Create new parameter. param = UniformParameterPtr(OGRE_NEW UniformParameter(autoType, data, size, type)); addParameter(param); return param; }