summaryrefslogtreecommitdiff
path: root/src/gallium/winsys/r600/drm/gen_r600_states.py
blob: 9bd5ab208257f4b970467f9b000d65a415070ea0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import os
import re

def main():
    fileIN = open('r600_states.h', 'r')
    line = fileIN.readline()
    next_is_reg = False
    count = 0

    print "/* This file is autogenerated from r600_states.h - do not edit directly */"
    print "/* autogenerating script is gen_r600_states.py */"
    print ""
    while line:
        if line[0:2] == "};":
            if next_is_reg == True:
                print "#define " + name + "_SIZE\t\t", count
                print "#define " + name + "_PM4 128\t\t"
            next_is_reg = False
            count = 0
            print ""
    
        if line[0:6] == "static":
            name = line.rstrip("\n")
            cline = name.split()
            name = cline[4].split('[')
            name = name[0].replace("_names", "")
            print "/* " + name + " */"
            next_is_reg = True
        elif next_is_reg == True:
            reg = line.split();
            reg = reg[3].replace("},", "")
            reg = reg.replace("\"", "")
            print "#define " + name + "__" + reg + "\t\t", count
            count = count + 1

        line = fileIN.readline()

if __name__ == "__main__":
    main()