Exemplo n.º 1
0
 def __init__(self, block):
     """Constructor."""
     GlslBlock.__init__(self)
     # Assumed block is already within the tree.
     if block.getParent():
         block.removeFromParent()
     self.addChildren(block)
Exemplo n.º 2
0
 def __init__(self, name, lst, terminator):
     """Constructor."""
     GlslBlock.__init__(self)
     self.__name = name
     self.__terminator = terminator
     # Hierarchy.
     self.addNamesUsed(name)
     self.addChildren(lst)
Exemplo n.º 3
0
 def __init__(self, typeid, name):
     """Constructor."""
     GlslBlock.__init__(self)
     self.__typeid = typeid
     self.__name = name
     # Hierarchy.
     name.setType(typeid)
     self.addNamesUsed(name)
Exemplo n.º 4
0
 def __init__(self, typeid, name):
     """Constructor."""
     GlslBlock.__init__(self)
     self.__typeid = typeid
     self.__name = name
     # Hierarchy.
     name.setType(typeid)
     self.addNamesUsed(name)
Exemplo n.º 5
0
 def __init__(self, name, lst, terminator):
     """Constructor."""
     GlslBlock.__init__(self)
     self.__name = name
     self.__terminator = terminator
     # Hierarchy.
     self.addNamesUsed(name)
     self.addChildren(lst)
Exemplo n.º 6
0
 def __init__(self, definition_ld, filename, varname, output_name=None):
     """Constructor."""
     GlslBlock.__init__(self)
     self.__definition_ld = definition_ld
     self.__filename = filename
     self.__variable_name = varname
     self.__output_name = output_name
     self.__content = ""
     self.detectType()
Exemplo n.º 7
0
 def __init__(self, definition_ld, filename, varname, output_name=None):
     """Constructor."""
     GlslBlock.__init__(self)
     self.__definition_ld = definition_ld
     self.__filename = filename
     self.__variable_name = varname
     self.__output_name = output_name
     self.__content = ""
     self.detectType()
Exemplo n.º 8
0
 def __init__(self, typeid, children, terminator):
     """Constructor."""
     GlslBlock.__init__(self)
     self.__typeid = typeid
     self.__terminator = terminator
     # Hierarchy.
     if not children:
         raise RuntimeError("array literal must have children")
     self.addChildren(children)
Exemplo n.º 9
0
 def __init__(self, lst, terminator = ""):
   """Constructor."""
   GlslBlock.__init__(self)
   self.__content = lst
   self.__terminator = terminator
   if (not is_listing(self.__content)) or (None in self.__content):
     raise RuntimeError("content must be a listing")
   # Hierarchy.
   self.addAccesses(lst)
   self.addNamesUsed(lst)
Exemplo n.º 10
0
 def __init__(self, typeid, lst):
     """Constructor."""
     GlslBlock.__init__(self)
     self.__typeid = typeid
     # Hierarchy.
     for ii in lst:
         name = ii.getName()
         name.setType(typeid)
         self.addNamesDeclared(name)
     self.addChildren(lst)
Exemplo n.º 11
0
 def __init__(self, lst, terminator=""):
     """Constructor."""
     GlslBlock.__init__(self)
     self.__content = lst
     self.__terminator = terminator
     if (not is_listing(self.__content)) or (None in self.__content):
         raise RuntimeError("content must be a listing")
     # Hierarchy.
     self.addAccesses(lst)
     self.addNamesUsed(lst)
Exemplo n.º 12
0
 def __init__(self, typeid, lst):
     """Constructor."""
     GlslBlock.__init__(self)
     self.__typeid = typeid
     # Hierarchy.
     for ii in lst:
         name = ii.getName()
         name.setType(typeid)
         self.addNamesDeclared(name)
     self.addChildren(lst)
Exemplo n.º 13
0
 def __init__(self, layout, typeid, size, name):
     """Constructor."""
     GlslBlock.__init__(self)
     self.__layout = layout
     self.__typeid = typeid
     self.__size = size
     self.__name = name
     # Hierarchy.
     self.addNamesDeclared(name)
     name.setType(typeid)
     self.addNamesUsed(name)
Exemplo n.º 14
0
 def __init__(self, layout, typeid, size, name):
     """Constructor."""
     GlslBlock.__init__(self)
     self.__layout = layout
     self.__typeid = typeid
     self.__size = size
     self.__name = name
     # Hierarchy.
     self.addNamesDeclared(name)
     name.setType(typeid)
     self.addNamesUsed(name)
Exemplo n.º 15
0
 def __init__(self, type_name, members, name=None, size=0):
     """Constructor."""
     GlslBlock.__init__(self)
     self.__type_name = type_name
     self.__members = members
     self.__name = name
     self.__size = size
     self.__member_accesses = []
     # Hierarchy.
     name.setType(type_name)
     self.addNamesDeclared(name)
     self.addNamesUsed(name)
Exemplo n.º 16
0
 def __init__(self, control, declaration, lst):
     """Constructor."""
     GlslBlock.__init__(self)
     self.__control = control
     self.__declaration = declaration
     self.__statements = lst
     self.__target = None
     # Hierarchy.
     if declaration:
         self.addChildren(declaration)
     if lst:
         self.addChildren(lst)
Exemplo n.º 17
0
 def __init__(self, inout, typeid, assignment):
     """Constructor."""
     GlslBlock.__init__(self)
     self.__inout = inout
     self.__typeid = typeid
     self.__assignment = assignment
     # Set type of name.
     name = assignment.getName()
     name.setType(typeid)
     # Hierarchy.
     self.addNamesDeclared(name)
     self.addChildren(assignment)
Exemplo n.º 18
0
 def __init__(self, control, declaration, lst):
     """Constructor."""
     GlslBlock.__init__(self)
     self.__control = control
     self.__declaration = declaration
     self.__statements = lst
     self.__target = None
     # Hierarchy.
     if declaration:
         self.addChildren(declaration)
     if lst:
         self.addChildren(lst)
Exemplo n.º 19
0
 def __init__(self, type_name, members, name=None, size=0):
     """Constructor."""
     GlslBlock.__init__(self)
     self.__type_name = type_name
     self.__members = members
     self.__name = name
     self.__size = size
     self.__member_accesses = []
     # Hierarchy.
     name.setType(type_name)
     self.addNamesDeclared(name)
     self.addNamesUsed(name)
Exemplo n.º 20
0
 def __init__(self, typeid):
     """Constructor."""
     GlslBlock.__init__(self)
     self.__typeid = typeid
     # Validate type id.
     if not typeid.getPrecision():
         raise RuntimeError(
             "type '%s' in precision block missing precision qualifier" %
             (self.__typeid.format()))
     # Type must be in allowed precision types.
     if not is_glsl_precision_type_string(self.getType()):
         raise RuntimeError("invalid type '%s' for precision block" %
                            (self.getType()))
Exemplo n.º 21
0
 def __init__(self, name, lst, assign, statement):
   """Constructor."""
   GlslBlock.__init__(self)
   self.__name = name
   self.__modifiers = lst
   self.__assign = assign
   if self.__assign and (not statement):
     raise RuntimeError("if assigning, must have a statement")
   # Hierarchy.
   self.addNamesUsed(name)
   self.addAccesses(lst)
   if statement:
     self.addChildren(statement)
Exemplo n.º 22
0
 def __init__(self, name, lst, assign, children, terminator):
     """Constructor."""
     GlslBlock.__init__(self)
     self.__name = name
     self.__modifiers = lst
     self.__assign = assign
     self.__terminator = terminator
     # Error cases.
     if self.__assign and (not children):
         raise RuntimeError("if assigning, must have child statements")
     # Hierarchy.
     self.addNamesUsed(name)
     self.addAccesses(lst)
     if children:
         self.addChildren(children)
Exemplo n.º 23
0
 def __init__(self, lst, explicit):
     """Constructor."""
     GlslBlock.__init__(self)
     self.__explicit = explicit
     self.__squashable = False
     self.__allow_squash = False
     # Check for degenerate scope.
     if (1 == len(lst)) and is_glsl_block_declaration(lst[0]):
         raise RuntimeError("scope with only block '%s' is degenerate" % (lst[0].format(True)))
     # Check for empty scope (likely an error).
     if 0 >= len(lst):
         if is_verbose():
             print("WARNING: empty scope")
     # Hierarchy.
     self.addChildren(lst)
Exemplo n.º 24
0
 def __init__(self, typeid, name, lst, scope):
     """Constructor."""
     GlslBlock.__init__(self)
     self.__typeid = typeid
     self.__name = name
     self.__parameters = lst
     self.__scope = scope
     if not is_listing(self.__parameters):
         raise RuntimeError("parameters must be a listing")
     # Hierarchy.
     name.setType(typeid)
     self.addNamesDeclared(name)
     self.addNamesUsed(name)
     self.addChildren(lst)
     self.addChildren(scope)
Exemplo n.º 25
0
 def __init__(self, typeid, name, lst, scope):
     """Constructor."""
     GlslBlock.__init__(self)
     self.__typeid = typeid
     self.__name = name
     self.__parameters = lst
     self.__scope = scope
     if not is_listing(self.__parameters):
         raise RuntimeError("parameters must be a listing")
     # Hierarchy.
     name.setType(typeid)
     self.addNamesDeclared(name)
     self.addNamesUsed(name)
     self.addChildren(lst)
     self.addChildren(scope)
Exemplo n.º 26
0
 def __init__(self,
              definition_ld,
              filename,
              output_name=None,
              varname=None):
     """Constructor."""
     GlslBlock.__init__(self)
     self.__definition_ld = definition_ld
     self.__filename = filename
     self.__basename = os.path.basename(filename)
     self.__output_name = output_name
     self.__variable_name = varname
     self.__content = ""
     # Determine remaining fields from the former.
     self.detectType()
Exemplo n.º 27
0
 def __init__(self, lst, explicit):
     """Constructor."""
     GlslBlock.__init__(self)
     self.__explicit = explicit
     self.__squashable = False
     self.__allow_squash = False
     # Check for degenerate scope.
     if (1 == len(lst)) and is_glsl_block_declaration(lst[0]):
         raise RuntimeError("scope with only block '%s' is degenerate" %
                            (lst[0].format(True)))
     # Check for empty scope (likely an error).
     if 0 >= len(lst):
         if is_verbose():
             print("WARNING: empty scope")
     # Hierarchy.
     self.addChildren(lst)
Exemplo n.º 28
0
 def __init__(self, content):
     """Constructor."""
     GlslBlock.__init__(self)
     self.__content = content
Exemplo n.º 29
0
 def __init__(self, elements):
     """Constructor."""
     GlslBlock.__init__(self)
     self.__elements = elements
Exemplo n.º 30
0
 def __init__(self, lst):
     """Constructor."""
     GlslBlock.__init__(self)
     # Hierarchy.
     self.addChildren(lst)
Exemplo n.º 31
0
 def __init__(self, layout, inout):
     """Constructor."""
     GlslBlock.__init__(self)
     self._layout = layout
     self._inout = inout
Exemplo n.º 32
0
 def __init__(self, source):
     """Constructor."""
     GlslBlock.__init__(self)
     lines = source.strip().split()
     self.__content = " ".join(lines)
Exemplo n.º 33
0
 def __init__(self, content):
     """Constructor."""
     GlslBlock.__init__(self)
     self.__content = content
Exemplo n.º 34
0
 def __init__(self, inout, lst):
     """Constructor."""
     GlslBlock.__init__(self)
     self.__inout = inout
     self.__scope = lst
Exemplo n.º 35
0
 def __init__(self, elements):
     """Constructor."""
     GlslBlock.__init__(self)
     self.__elements = elements
Exemplo n.º 36
0
 def __init__(self, layout, inout):
     """Constructor."""
     GlslBlock.__init__(self)
     self._layout = layout
     self._inout = inout