ID3DX11EffectVariable* CUniformParameterBuilder::findAnnotationByName(ID3DX11EffectVariable *effectVariable, const char* name) { // The latest effect 11 library is very verbose when an annotation // is not found by name. This version will stay quiet if the // annotation is not found. if (mAnnotationIndex.empty()) { D3DX11_EFFECT_VARIABLE_DESC varDesc; effectVariable->GetDesc(&varDesc); for (uint32_t idx = 0; idx < varDesc.Annotations; ++idx) { ID3DX11EffectVariable* var = effectVariable->GetAnnotationByIndex(idx); if (var) { D3DX11_EFFECT_VARIABLE_DESC varDesc; var->GetDesc(&varDesc); mAnnotationIndex.insert(TAnnotationIndex::value_type(std::string(varDesc.Name), idx)); } } mAnnotationIndex.insert(TAnnotationIndex::value_type(std::string("Done!"), 0)); } TAnnotationIndex::const_iterator index = mAnnotationIndex.find(std::string(name)); if (index != mAnnotationIndex.end()) return effectVariable->GetAnnotationByIndex((*index).second); else return 0; }
void Effect::ExtractGlobalVars(D3DX11_EFFECT_DESC& effectDesc) { for(U32 i = 0; i < effectDesc.GlobalVariables; ++i) { ID3DX11EffectVariable* pVar = dx11Effect->GetVariableByIndex(i); D3DX11_EFFECT_VARIABLE_DESC varDesc; DXCall(pVar->GetDesc(&varDesc)); ID3DX11EffectType* pType = pVar->GetType(); D3DX11_EFFECT_TYPE_DESC typeDesc; DXCall(pType->GetDesc(&typeDesc)); AddVariable(pVar, &varDesc, &typeDesc); } }