@@ -79,6 +79,11 @@ class TVarGatherTraverser : public TLiveTraverser {
79
79
target = &outputList;
80
80
else if (base->getQualifier ().isUniformOrBuffer () && !base->getQualifier ().isPushConstant ())
81
81
target = &uniformList;
82
+ // If a global is being visited, then we should also traverse it incase it's evaluation
83
+ // ends up visiting inputs we want to tag as live
84
+ else if (base->getQualifier ().storage == EvqGlobal)
85
+ addGlobalReference (base->getName ());
86
+
82
87
if (target) {
83
88
TVarEntryInfo ent = {base->getId (), base, ! traverseAll};
84
89
ent.stage = intermediate.getStage ();
@@ -1105,11 +1110,12 @@ bool TIoMapper::addStage(EShLanguage stage, TIntermediate& intermediate, TInfoSi
1105
1110
TVarGatherTraverser iter_binding_live (intermediate, false , inVarMap, outVarMap, uniformVarMap);
1106
1111
root->traverse (&iter_binding_all);
1107
1112
iter_binding_live.pushFunction (intermediate.getEntryPointMangledName ().c_str ());
1108
- while (! iter_binding_live.functions .empty ()) {
1109
- TIntermNode* function = iter_binding_live.functions .back ();
1110
- iter_binding_live.functions .pop_back ();
1111
- function ->traverse (&iter_binding_live);
1113
+ while (! iter_binding_live.destinations .empty ()) {
1114
+ TIntermNode* destination = iter_binding_live.destinations .back ();
1115
+ iter_binding_live.destinations .pop_back ();
1116
+ destination ->traverse (&iter_binding_live);
1112
1117
}
1118
+
1113
1119
// sort entries by priority. see TVarEntryInfo::TOrderByPriority for info.
1114
1120
std::for_each (inVarMap.begin (), inVarMap.end (),
1115
1121
[&inVector](TVarLivePair p) { inVector.push_back (p); });
@@ -1200,11 +1206,12 @@ bool TGlslIoMapper::addStage(EShLanguage stage, TIntermediate& intermediate, TIn
1200
1206
*uniformVarMap[stage]);
1201
1207
root->traverse (&iter_binding_all);
1202
1208
iter_binding_live.pushFunction (intermediate.getEntryPointMangledName ().c_str ());
1203
- while (! iter_binding_live.functions .empty ()) {
1204
- TIntermNode* function = iter_binding_live.functions .back ();
1205
- iter_binding_live.functions .pop_back ();
1206
- function ->traverse (&iter_binding_live);
1209
+ while (! iter_binding_live.destinations .empty ()) {
1210
+ TIntermNode* destination = iter_binding_live.destinations .back ();
1211
+ iter_binding_live.destinations .pop_back ();
1212
+ destination ->traverse (&iter_binding_live);
1207
1213
}
1214
+
1208
1215
TNotifyInOutAdaptor inOutNotify (stage, *resolver);
1209
1216
TNotifyUniformAdaptor uniformNotify (stage, *resolver);
1210
1217
// Resolve current stage input symbol location with previous stage output here,
0 commit comments