-------------------------------------------------------------------------
| 4817 | } |
| 4818 | //------------------------------------------------------------------------- |
| 4819 | void GpuProgramTranslator::translateUnifiedGpuProgram(ScriptCompiler *compiler, ObjectAbstractNode *obj) |
| 4820 | { |
| 4821 | list<std::pair<String,String> >::type customParameters; |
| 4822 | AbstractNodePtr params; |
| 4823 | for(AbstractNodeList::iterator i = obj->children.begin(); i != obj->children.end(); ++i) |
| 4824 | { |
| 4825 | if((*i)->type == ANT_PROPERTY) |
| 4826 | { |
| 4827 | PropertyAbstractNode *prop = (PropertyAbstractNode*)(*i).get(); |
| 4828 | if(prop->name == "delegate") |
| 4829 | { |
| 4830 | String value; |
| 4831 | if(!prop->values.empty() && prop->values.front()->type == ANT_ATOM) |
| 4832 | value = ((AtomAbstractNode*)prop->values.front().get())->value; |
| 4833 | |
| 4834 | ProcessResourceNameScriptCompilerEvent evt(ProcessResourceNameScriptCompilerEvent::GPU_PROGRAM, value); |
| 4835 | compiler->_fireEvent(&evt, 0); |
| 4836 | customParameters.emplace_back( "delegate", evt.mName ); |
| 4837 | } |
| 4838 | else |
| 4839 | { |
| 4840 | String name = prop->name, value; |
| 4841 | bool first = true; |
| 4842 | for(AbstractNodeList::iterator it = prop->values.begin(); it != prop->values.end(); ++it) |
| 4843 | { |
| 4844 | if((*it)->type == ANT_ATOM) |
| 4845 | { |
| 4846 | if(!first) |
| 4847 | value += " "; |
| 4848 | else |
| 4849 | first = false; |
| 4850 | value += ((AtomAbstractNode*)(*it).get())->value; |
| 4851 | } |
| 4852 | } |
| 4853 | customParameters.emplace_back( name, value ); |
| 4854 | } |
| 4855 | } |
| 4856 | else if((*i)->type == ANT_OBJECT) |
| 4857 | { |
| 4858 | if(((ObjectAbstractNode*)(*i).get())->id == ID_DEFAULT_PARAMS) |
| 4859 | params = *i; |
| 4860 | else |
| 4861 | processNode(compiler, *i); |
| 4862 | } |
| 4863 | } |
| 4864 | |
| 4865 | // Allocate the program |
| 4866 | HighLevelGpuProgram *prog = 0; |
| 4867 | CreateHighLevelGpuProgramScriptCompilerEvent evt(obj->file, obj->name, compiler->getResourceGroup(), "", "unified", translateIDToGpuProgramType(obj->id)); |
| 4868 | bool processed = compiler->_fireEvent(&evt, (void*)&prog); |
| 4869 | |
| 4870 | if(!processed) |
| 4871 | { |
| 4872 | prog = HighLevelGpuProgramManager::getSingleton().createProgram(obj->name, compiler->getResourceGroup(), "unified", translateIDToGpuProgramType(obj->id)).get(); |
| 4873 | } |
| 4874 | |
| 4875 | // Check that allocation worked |
| 4876 | if(prog == 0) |
nothing calls this directly
no test coverage detected