From: Roy.li Date: Wed, 19 Feb 2020 08:38:02 +0000 (+0800) Subject: Fix iomapper issue X-Git-Tag: upstream/11.4.0~308^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=615ae258919944f432a5e9da5cb6245f22b70fe5;p=platform%2Fupstream%2Fglslang.git Fix iomapper issue Use type name to index map to instead of use instance name to index map, or anonymous block will cause a map issue. --- diff --git a/glslang/MachineIndependent/iomapper.cpp b/glslang/MachineIndependent/iomapper.cpp index 4856422..94ece67 100644 --- a/glslang/MachineIndependent/iomapper.cpp +++ b/glslang/MachineIndependent/iomapper.cpp @@ -579,7 +579,10 @@ TDefaultGlslIoResolver::TDefaultGlslIoResolver(const TIntermediate& intermediate int TDefaultGlslIoResolver::resolveInOutLocation(EShLanguage stage, TVarEntryInfo& ent) { const TType& type = ent.symbol->getType(); - const TString& name = ent.symbol->getName(); + const TString& name = IsAnonymous(ent.symbol->getName()) ? + ent.symbol->getType().getTypeName() + : + ent.symbol->getName(); if (currentStage != stage) { preStage = currentStage; currentStage = stage; @@ -663,7 +666,10 @@ int TDefaultGlslIoResolver::resolveInOutLocation(EShLanguage stage, TVarEntryInf int TDefaultGlslIoResolver::resolveUniformLocation(EShLanguage /*stage*/, TVarEntryInfo& ent) { const TType& type = ent.symbol->getType(); - const TString& name = ent.symbol->getName(); + const TString& name = IsAnonymous(ent.symbol->getName()) ? + ent.symbol->getType().getTypeName() + : + ent.symbol->getName(); // kick out of not doing this if (! doAutoLocationMapping()) { return ent.newLocation = -1; @@ -734,7 +740,10 @@ int TDefaultGlslIoResolver::resolveUniformLocation(EShLanguage /*stage*/, TVarEn int TDefaultGlslIoResolver::resolveBinding(EShLanguage /*stage*/, TVarEntryInfo& ent) { const TType& type = ent.symbol->getType(); - const TString& name = ent.symbol->getName(); + const TString& name = IsAnonymous(ent.symbol->getName()) ? + ent.symbol->getType().getTypeName() + : + ent.symbol->getName(); // On OpenGL arrays of opaque types take a seperate binding for each element int numBindings = intermediate.getSpv().openGl != 0 && type.isSizedArray() ? type.getCumulativeArraySize() : 1; TResourceType resource = getResourceType(type); @@ -809,7 +818,10 @@ void TDefaultGlslIoResolver::endCollect(EShLanguage /*stage*/) { void TDefaultGlslIoResolver::reserverStorageSlot(TVarEntryInfo& ent, TInfoSink& infoSink) { const TType& type = ent.symbol->getType(); - const TString& name = ent.symbol->getName(); + const TString& name = IsAnonymous(ent.symbol->getName()) ? + ent.symbol->getType().getTypeName() + : + ent.symbol->getName(); TStorageQualifier storage = type.getQualifier().storage; EShLanguage stage(EShLangCount); switch (storage) { @@ -869,7 +881,10 @@ void TDefaultGlslIoResolver::reserverStorageSlot(TVarEntryInfo& ent, TInfoSink& void TDefaultGlslIoResolver::reserverResourceSlot(TVarEntryInfo& ent, TInfoSink& infoSink) { const TType& type = ent.symbol->getType(); - const TString& name = ent.symbol->getName(); + const TString& name = IsAnonymous(ent.symbol->getName()) ? + ent.symbol->getType().getTypeName() + : + ent.symbol->getName(); int resource = getResourceType(type); if (type.getQualifier().hasBinding()) { TVarSlotMap& varSlotMap = resourceSlotMap[resource];