nir/algebraic: Fail to compile of a variable is used in a replace but not the search
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 29 Jan 2015 19:45:31 +0000 (11:45 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 30 Jan 2015 01:07:45 +0000 (17:07 -0800)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/nir/nir_algebraic.py

index f9b246dd86529879ae1863ccb856511ffc26b38c..75436f42ccc4c824e7e89bf6ac9cdb99c0bbf149 100644 (file)
@@ -34,13 +34,18 @@ class VarSet(object):
    def __init__(self):
       self.names = {}
       self.ids = itertools.count()
+      self.immutable = False;
 
    def __getitem__(self, name):
       if name not in self.names:
+         assert not self.immutable, "Unknown replacement variable: " + name
          self.names[name] = self.ids.next()
 
       return self.names[name]
 
+   def lock(self):
+      self.immutable = True
+
 class Value(object):
    @staticmethod
    def create(val, name_base, varset):
@@ -138,6 +143,8 @@ class SearchAndReplace(object):
       else:
          self.search = Expression(search, "search{0}".format(self.id), varset)
 
+      varset.lock()
+
       if isinstance(replace, Value):
          self.replace = replace
       else: