Ejemplo n.º 1
0
def format_state(pos, value, fixp, state_map):
    try:
        path = state_map.lookup_address(pos)
        path_str = format_path(path)
    except KeyError:
        path = None
        path_str = '(UNKNOWN)'
    desc = ('  [%05X]' % pos) + ' ' + path_str
    if fixp:
        desc += ' = %f' % fixp_as_float(value)
    else:
        # For uniforms, show float value
        if (pos >= 0x05000 and pos < 0x06000) or (
                pos >= 0x07000 and pos < 0x08000) or (pos >= 0x30000
                                                      and pos < 0x32000):
            num = pos & 0xFFF
            spec = 'u%i.%s' % (num // 16, COMPS[(num // 4) % 4])
            desc += ' := %f (%s)' % (int_as_float(value), spec)
        elif path is not None:
            register = path[-1][0]
            desc += ' := '
            if isinstance(register.type, Domain):
                desc += format_addr(value)
            else:
                desc += register.describe(value)
    return desc
Ejemplo n.º 2
0
 def print_uniforms_for(self, out, stype, uniforms, count):
     out.write('[%s uniforms]:\n' % stype)
     base = 0
     comps = 'xyzw'
     while base < count:
         sub = []
         for idx in xrange(0, 4): # last uniform can be partial
             if (base + idx)<count:
                 sub.append(int(uniforms[base + idx]))
         subf = (int_as_float(x) for x in sub)
         subfs = ', '.join((str(x) for x in subf))
         out.write('    u%i.%s = (%s)\n' % (base//4, comps[0:len(sub)], subfs))
         base += 4
Ejemplo n.º 3
0
 def print_uniforms_for(self, out, stype, uniforms, count):
     out.write('[%s uniforms]:\n' % stype)
     base = 0
     comps = 'xyzw'
     while base < count:
         sub = []
         for idx in xrange(0, 4): # last uniform can be partial
             if (base + idx)<count:
                 sub.append(int(uniforms[base + idx]))
         subf = (int_as_float(x) for x in sub)
         subfs = ', '.join((str(x) for x in subf))
         out.write('    u%i.%s = (%s)\n' % (base//4, comps[0:len(sub)], subfs))
         base += 4
Ejemplo n.º 4
0
 def format_state(self, pos, value, fixp):
     try:
         path = self.state_map.lookup_address(pos)
         path_str = format_path(path)
     except KeyError:
         path = None
         path_str = '0x%05X' % pos
     desc = '  ' + path_str 
     if fixp:
         desc += ' = %f' % fixp_as_float(value)
     else:
         # For uniforms, show float value
         if (pos >= 0x05000 and pos < 0x06000) or (pos >= 0x07000 and pos < 0x08000):
             num = pos & 0xFFF
             desc += ' := %f (%s)' % (int_as_float(value), offset_to_uniform(num))
         elif path is not None:
             register = path[-1][0]
             desc += ' := ' + register.describe(value)
     return desc
Ejemplo n.º 5
0
 def format_state(self, pos, value, fixp):
     try:
         path = self.state_map.lookup_address(pos)
         path_str = format_path(path)
     except KeyError:
         path = None
         path_str = '0x%05X' % pos
     desc = '  ' + path_str 
     if fixp:
         desc += ' = %f' % fixp_as_float(value)
     else:
         # For uniforms, show float value
         if (pos >= 0x05000 and pos < 0x06000) or (pos >= 0x07000 and pos < 0x08000):
             num = pos & 0xFFF
             desc += ' := %f (%s)' % (int_as_float(value), offset_to_uniform(num))
         elif path is not None:
             register = path[-1][0]
             desc += ' := ' + register.describe(value)
     return desc
Ejemplo n.º 6
0
def format_state(pos, value, fixp, state_map, describe):
    try:
        path = state_map.lookup_address(pos)
        path_str = format_path(path)
    except KeyError:
        path = None
        path_str = '(UNKNOWN)'
    desc = ('  [%05X]' % pos) + ' ' + path_str 
    if fixp:
        desc += ' = %f' % fixp_as_float(value)
    else:
        # For uniforms, show float value
        if (pos >= 0x05000 and pos < 0x06000) or (pos >= 0x07000 and pos < 0x08000) or (pos >= 0x30000 and pos < 0x32000):
            num = pos & 0xFFF
            spec = 'u%i.%s' % (num//16, COMPS[(num//4)%4])
            desc += ' := %f (%s)' % (int_as_float(value), spec)
        elif path is not None:
            register = path[-1][0]
            desc += ' := ' + describe(register, value)
    return desc
Ejemplo n.º 7
0
def format_state(pos, value, fixp, state_map):
    try:
        path = state_map.lookup_address(pos)
        path_str = format_path(path) #+ ('(0x%05X)' % pos)
    except KeyError:
        path = None
        path_str = '0x%05X' % pos
    desc = '  ' + path_str 
    if fixp:
        desc += ' = %f' % fixp_as_float(value)
    else:
        # For uniforms, show float value
        if (pos >= 0x05000 and pos < 0x06000) or (pos >= 0x07000 and pos < 0x08000):
            num = pos & 0xFFF
            spec = 'u%i.%s' % (num//16, COMPS[(num//4)%4])
            desc += ' := %f (%s)' % (int_as_float(value), spec)
        elif path is not None:
            register = path[-1][0]
            desc += ' := '
            desc += register.describe(value)
    return desc
Ejemplo n.º 8
0
def hex_and_float(x):
    return '%08x (%f)' % (x, int_as_float(x))
Ejemplo n.º 9
0
def hex_and_float(x):
    return '%08x (%f)' % (x, int_as_float(x))