1 | import sys
|
---|
2 |
|
---|
3 | import apiutil
|
---|
4 |
|
---|
5 | import sys, re, string
|
---|
6 |
|
---|
7 |
|
---|
8 | line_re = re.compile(r'^(\S+)\s+(GL_\S+)\s+(.*)\s*$')
|
---|
9 | extensions_line_re = re.compile(r'^(\S+)\s+(GL_\S+)\s(\S+)\s+(.*)\s*$')
|
---|
10 |
|
---|
11 | params = {}
|
---|
12 | extended_params = {}
|
---|
13 |
|
---|
14 | input = open( sys.argv[2]+"/state_isenabled.txt", 'r' )
|
---|
15 | for line in input.readlines():
|
---|
16 | match = line_re.match( line )
|
---|
17 | if match:
|
---|
18 | type = match.group(1)
|
---|
19 | pname = match.group(2)
|
---|
20 | fields = string.split( match.group(3) )
|
---|
21 | params[pname] = ( type, fields )
|
---|
22 |
|
---|
23 | input = open( sys.argv[2]+"/state_extensions_isenabled.txt", 'r' )
|
---|
24 | for line in input.readlines():
|
---|
25 | match = extensions_line_re.match( line )
|
---|
26 | if match:
|
---|
27 | type = match.group(1)
|
---|
28 | pname = match.group(2)
|
---|
29 | ifdef = match.group(3)
|
---|
30 | fields = string.split( match.group(4) )
|
---|
31 | extended_params[pname] = ( type, ifdef, fields )
|
---|
32 |
|
---|
33 |
|
---|
34 | apiutil.CopyrightC()
|
---|
35 |
|
---|
36 | print """#include "cr_blitter.h"
|
---|
37 | #include "cr_spu.h"
|
---|
38 | #include "chromium.h"
|
---|
39 | #include "cr_error.h"
|
---|
40 | #include "cr_net.h"
|
---|
41 | #include "cr_rand.h"
|
---|
42 | #include "cr_mem.h"
|
---|
43 | #include "cr_string.h"
|
---|
44 | #include <cr_dump.h>
|
---|
45 | #include "cr_pixeldata.h"
|
---|
46 |
|
---|
47 | #include <iprt/cdefs.h>
|
---|
48 | #include <iprt/types.h>
|
---|
49 | #include <iprt/mem.h>
|
---|
50 |
|
---|
51 | #include <stdio.h>
|
---|
52 |
|
---|
53 | #ifdef VBOX_WITH_CRDUMPER
|
---|
54 | """
|
---|
55 |
|
---|
56 | from get_sizes import *;
|
---|
57 |
|
---|
58 | getprops = apiutil.ParamProps("GetDoublev")
|
---|
59 | enableprops = apiutil.ParamProps("Enable")
|
---|
60 |
|
---|
61 | #print "//missing get props:"
|
---|
62 | #for prop in getprops:
|
---|
63 | # try:
|
---|
64 | # tmp = num_get_values[prop]
|
---|
65 | # except KeyError:
|
---|
66 | # try:
|
---|
67 | # keyvalues = extensions_num_get_values[prop]
|
---|
68 | # except KeyError:
|
---|
69 | # print "//%s" % prop
|
---|
70 | #
|
---|
71 | print """
|
---|
72 | static void crRecDumpPrintVal(CR_DUMPER *pDumper, struct nv_struct *pDesc, float *pfData)
|
---|
73 | {
|
---|
74 | char aBuf[4096];
|
---|
75 | crDmpFormatArray(aBuf, sizeof (aBuf), "%f", sizeof (float), pfData, pDesc->num_values);
|
---|
76 | crDmpStrF(pDumper, "%s = %s;", pDesc->pszName, aBuf);
|
---|
77 | }
|
---|
78 |
|
---|
79 |
|
---|
80 | void crRecDumpGlGetState(CR_RECORDER *pRec, CRContext *ctx)
|
---|
81 | {
|
---|
82 | float afData[CR_MAX_GET_VALUES];
|
---|
83 | struct nv_struct *pDesc;
|
---|
84 |
|
---|
85 | for (pDesc = num_values_array; pDesc->num_values != 0 ; pDesc++)
|
---|
86 | {
|
---|
87 | memset(afData, 0, sizeof(afData));
|
---|
88 | pRec->pDispatch->GetFloatv(pDesc->pname, afData);
|
---|
89 | crRecDumpPrintVal(pRec->pDumper, pDesc, afData);
|
---|
90 | }
|
---|
91 | }
|
---|
92 |
|
---|
93 | void crRecDumpGlEnableState(CR_RECORDER *pRec, CRContext *ctx)
|
---|
94 | {
|
---|
95 | GLboolean fEnabled;
|
---|
96 | """
|
---|
97 | keys = params.keys()
|
---|
98 | keys.sort();
|
---|
99 |
|
---|
100 | for pname in keys:
|
---|
101 | print "\tfEnabled = pRec->pDispatch->IsEnabled(%s);" % pname
|
---|
102 | print "\tcrDmpStrF(pRec->pDumper, \"%s = %%d;\", fEnabled);" % pname
|
---|
103 |
|
---|
104 | keys = extended_params.keys();
|
---|
105 | keys.sort()
|
---|
106 |
|
---|
107 | for pname in keys:
|
---|
108 | (srctype,ifdef,fields) = extended_params[pname]
|
---|
109 | ext = ifdef[3:] # the extension name with the "GL_" prefix removed
|
---|
110 | ext = ifdef
|
---|
111 | print '#ifdef CR_%s' % ext
|
---|
112 | print "\tfEnabled = pRec->pDispatch->IsEnabled(%s);" % pname
|
---|
113 | print "\tcrDmpStrF(pRec->pDumper, \"%s = %%d;\", fEnabled);" % pname
|
---|
114 | print '#endif /* CR_%s */' % ext
|
---|
115 |
|
---|
116 | #print "//missing enable props:"
|
---|
117 | #for prop in enableprops:
|
---|
118 | # try:
|
---|
119 | # keyvalues = params[prop]
|
---|
120 | # except KeyError:
|
---|
121 | # try:
|
---|
122 | # keyvalues = extended_params[prop]
|
---|
123 | # except KeyError:
|
---|
124 | # print "//%s" % prop
|
---|
125 | #
|
---|
126 | print """
|
---|
127 | }
|
---|
128 | #endif
|
---|
129 | """
|
---|