summaryrefslogtreecommitdiff
path: root/src/VBox/GuestHost/OpenGL/packer/opcodes.py
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2014-03-26 19:21:20 +0000
committer <>2014-05-08 15:03:54 +0000
commitfb123f93f9f5ce42c8e5785d2f8e0edaf951740e (patch)
treec2103d76aec5f1f10892cd1d3a38e24f665ae5db /src/VBox/GuestHost/OpenGL/packer/opcodes.py
parent58ed4748338f9466599adfc8a9171280ed99e23f (diff)
downloadVirtualBox-master.tar.gz
Imported from /home/lorry/working-area/delta_VirtualBox/VirtualBox-4.3.10.tar.bz2.HEADVirtualBox-4.3.10master
Diffstat (limited to 'src/VBox/GuestHost/OpenGL/packer/opcodes.py')
-rw-r--r--src/VBox/GuestHost/OpenGL/packer/opcodes.py33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/VBox/GuestHost/OpenGL/packer/opcodes.py b/src/VBox/GuestHost/OpenGL/packer/opcodes.py
index e198150b..f359d218 100644
--- a/src/VBox/GuestHost/OpenGL/packer/opcodes.py
+++ b/src/VBox/GuestHost/OpenGL/packer/opcodes.py
@@ -50,21 +50,50 @@ print "} CROpcode;\n"
# count up number of extended opcode commands
num_extends = 0
+num_auto_codes = 0
for func in keys:
if "extpack" in apiutil.ChromiumProps(func):
num_extends += 1
+ if apiutil.ChromiumRelOpCode(func) < 0:
+ num_auto_codes += 1
+
+# sanity check for compatibility breakage
+# we currently have 304
+if num_auto_codes != 304:
+ print >> sys.stderr, "number of auto-generated op-codes should be 304, but is " + str(num_auto_codes)
+ print >> sys.stderr, "which breaks backwards compatibility"
+ print >> sys.stderr, "if this is really what you want to do, please adjust this script"
+ print >> sys.stderr, "to handle a new auto-generated opcodes count"
+ print "#error -- num_auto_codes should be 304, but is " + str(num_auto_codes)
+ sys.exit(-1)
print "/* Functions with a return value or output parameters */"
print "typedef enum {"
+opcode_index = 0
enum_index = 0
+chrelopcodes = {}
for func in keys:
if "extpack" in apiutil.ChromiumProps(func):
opcodeName = apiutil.ExtendedOpcodeName(func)
+ chrelopcode = apiutil.ChromiumRelOpCode(func)
+ opcode = -1
+ if chrelopcode >= 0:
+ if not chrelopcode in chrelopcodes.keys():
+ chrelopcodes[chrelopcode] = chrelopcode
+ else:
+ print >> sys.stderr, "non-unique chrelopcode: " + str(chrelopcode)
+ print "#error -- non-unique chrelopcode: " + str(num_auto_codes)
+ sys.exit(-1)
+ opcode = num_auto_codes + chrelopcode
+ else:
+ opcode = opcode_index
+ opcode_index = opcode_index + 1
+
if enum_index != num_extends-1:
- print "\t%s = %d," % (opcodeName, enum_index )
+ print "\t%s = %d," % (opcodeName, opcode )
else:
- print "\t%s = %d" % (opcodeName, enum_index )
+ print "\t%s = %d" % (opcodeName, opcode )
enum_index = enum_index + 1
print "} CRExtendOpcode;\n"
print "#endif /* CR_OPCODES_H */"