summaryrefslogtreecommitdiffstats
path: root/src/VBox/GuestHost/OpenGL/packer/pack_currentheader.py
blob: 62a9912baa142c44774c150539dfc39abcf3870f (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Copyright (c) 2001, Stanford University
# All rights reserved.
#
# See the file LICENSE.txt for information on redistributing this software.

# This script generates the include/state/cr_currentpointers.h file.

from __future__ import print_function
import sys
sys.path.append( "../glapi_parser" )
import apiutil

from pack_currenttypes import *

apiutil.CopyrightC()

print("""
/* DO NOT EDIT - THIS FILE GENERATED BY THE pack_currentheader.py SCRIPT */

#ifndef CR_CURRENT_H
#define CR_CURRENT_H

#include "state/cr_limits.h"
""")

sorted_keys = sorted(current_fns.keys())

for k in sorted_keys:
	name = k.lower();
	print("typedef struct {")
	if 'array' in current_fns[k]:
		print("\tconst unsigned char *ptr[%s];" % current_fns[k]['array'])
	else:
		print("\tconst unsigned char *ptr;")
	for type in current_fns[k]['types']:
		for size in current_fns[k]['sizes']:
			if 'array' in current_fns[k]:
				print("\tconst unsigned char *%s%d[%s];" % (type, size, current_fns[k]['array']))
			else:
				print("\tconst unsigned char *%s%d;" % (type, size))
	print("} GL%s_p;\n" % name)

print("typedef	struct attrs {")
for k in sorted_keys:
	name = k.lower()
	field = '%s%s' % (k[:1].lower(),k[1:])
	print("\tGL%s_p %s;" % (name,field))
print("	} CRCurrentStateAttr;")
	

print("typedef struct {")
print("""
	CRCurrentStateAttr c;
	unsigned char *vtx_op;
	unsigned char *vtx_data;
	unsigned char *begin_op;
	unsigned char *begin_data;
	unsigned int vtx_count;
	unsigned int vtx_max;
	unsigned int vtx_count_begin;
	unsigned int attribsUsedMask;
    unsigned int changedVertexAttrib;
} CRCurrentStatePointers;

#endif /* CR_CURRENT_H */
""")