Lines Matching defs:variable
95 ValueEntry::ValueEntry (const Variable* variable)
96 : m_variable (variable)
97 , m_valueRange (variable->getType())
116 Variable* variable = new Variable(type, storage, name);
119 m_liveVariables.push_back(variable);
120 return variable;
124 delete variable;
129 void VariableScope::declare (Variable* variable)
131 m_declaredVariables.push_back(variable);
132 removeLive(variable);
135 void VariableScope::removeLive (const Variable* variable)
137 vector<Variable*>::iterator pos = std::find(m_liveVariables.begin(), m_liveVariables.end(), variable);
160 ValueEntry* ValueScope::allocate (const Variable* variable)
162 ValueEntry* entry = new ValueEntry(variable);
178 CompareEntryVariable (const Variable* variable)
179 : m_variable(variable)
197 ValueEntry* ValueScope::findEntry (const Variable* variable) const
199 vector<ValueEntry*>::const_iterator pos = std::find(m_entries.begin(), m_entries.end(), CompareEntryVariable(variable));
203 void ValueScope::setValue (const Variable* variable, ConstValueRangeAccess value)
205 ValueEntry* entry = findEntry(variable);
213 void ValueScope::removeValue (const Variable* variable)
215 vector<ValueEntry*>::iterator pos = std::find(m_entries.begin(), m_entries.end(), CompareEntryVariable(variable));
249 Variable* variable = varScope.allocate(type, Variable::STORAGE_LOCAL, name);
252 ValueEntry* valueEntry = valueScope.allocate(variable);
260 setStorage(variable, storage);
262 return variable;
265 void VariableManager::setStorage (Variable* variable, Variable::Storage storage)
267 int numScalars = variable->getType().getScalarSize();
270 if (variable->getStorage() == Variable::STORAGE_SHADER_IN)
275 else if (variable->getStorage() == Variable::STORAGE_UNIFORM)
287 variable->setStorage(storage);
290 bool VariableManager::canDeclareInCurrentScope (const Variable* variable) const
293 return std::find(curLiveVars.begin(), curLiveVars.end(), variable) != curLiveVars.end();
301 void VariableManager::declareVariable (Variable* variable)
304 std::vector<const ValueEntry*>::iterator pos = std::find(m_entryCache.begin(), m_entryCache.end(), CompareEntryVariable(variable));
308 DE_ASSERT(std::find(m_entryCache.begin(), m_entryCache.end(), CompareEntryVariable(variable)) == m_entryCache.end());
314 scope->removeValue(variable);
318 getCurVariableScope().declare(variable);
321 const ValueEntry* VariableManager::getValue (const Variable* variable) const
323 vector<const ValueEntry*>::const_iterator pos = std::find(m_entryCache.begin(), m_entryCache.end(), CompareEntryVariable(variable));
327 void VariableManager::removeValueFromCurrentScope (const Variable* variable)
330 std::vector<const ValueEntry*>::iterator pos = std::find(m_entryCache.begin(), m_entryCache.end(), CompareEntryVariable(variable));
335 getCurValueScope().removeValue(variable);
338 const ValueEntry* VariableManager::getParentValue (const Variable* variable) const
346 ValueEntry* entry = scope->findEntry(variable);
355 void VariableManager::setValue (const Variable* variable, ConstValueRangeAccess value)
359 if (!curScope.findEntry(variable))
362 ValueEntry* newEntry = curScope.allocate(variable);
363 std::vector<const ValueEntry*>::iterator cachePos = std::find(m_entryCache.begin(), m_entryCache.end(), CompareEntryVariable(variable));
371 curScope.setValue(variable, value);
488 addedVars.insert(var); // Record as cached variable.