MCPcopy Create free account
hub / github.com/OGRECave/ogre / translateGpuProgram

Method translateGpuProgram

OgreMain/src/OgreScriptTranslator.cpp:3451–3587  ·  view source on GitHub ↗

-------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

3449 }
3450 //-------------------------------------------------------------------------
3451 void GpuProgramTranslator::translateGpuProgram(ScriptCompiler *compiler, ObjectAbstractNode *obj, String language)
3452 {
3453 String syntax;
3454 std::vector<String> delegates;
3455 std::vector<std::pair<PropertyAbstractNode*, String> > customParameters;
3456 String source, profiles, target;
3457 AbstractNodePtr params;
3458 for(auto & i : obj->children)
3459 {
3460 if(i->type == ANT_PROPERTY)
3461 {
3462 PropertyAbstractNode *prop = (PropertyAbstractNode*)i.get();
3463 if(prop->id == ID_SOURCE)
3464 {
3465 if(!getValue(prop, compiler, source))
3466 return;
3467 }
3468 else if(prop->name == "delegate")
3469 {
3470 String value;
3471 if(!getValue(prop, compiler, value))
3472 return;
3473
3474 ProcessResourceNameScriptCompilerEvent evt(ProcessResourceNameScriptCompilerEvent::GPU_PROGRAM, value);
3475 compiler->_fireEvent(&evt, 0);
3476 delegates.push_back(evt.mName);
3477 }
3478 else
3479 {
3480 StringVector values;
3481 _getVector(prop->values.begin(), prop->values.end(), values, prop->values.size());
3482
3483 if(prop->name == "attach")
3484 {
3485 compiler->addError(*prop, "attach. Use the #include directive instead",
3486 ScriptCompiler::CE_DEPRECATEDSYMBOL);
3487
3488 for (auto& value : values)
3489 {
3490 ProcessResourceNameScriptCompilerEvent evt(ProcessResourceNameScriptCompilerEvent::GPU_PROGRAM, value);
3491 compiler->_fireEvent(&evt, 0);
3492 value = evt.mName;
3493 }
3494 }
3495
3496 String value = StringConverter::toString(values);
3497
3498 if(prop->name == "profiles")
3499 profiles = value;
3500 else if(prop->name == "target")
3501 target = value;
3502 else if(prop->id == ID_SYNTAX && language == "asm")
3503 syntax = value;
3504 else
3505 customParameters.push_back(std::make_pair(prop, value));
3506 }
3507 }
3508 else if(i->type == ANT_OBJECT)

Callers

nothing calls this directly

Calls 15

_getVectorFunction · 0.85
getProgramTypeFunction · 0.85
_fireEventMethod · 0.80
addErrorMethod · 0.80
getResourceGroupMethod · 0.80
setSourceFileMethod · 0.80
getValueFunction · 0.70
toStringFunction · 0.50
getMethod · 0.45
push_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected