VirtualBox

Changeset 43652 in vbox


Ignore:
Timestamp:
Oct 16, 2012 9:40:24 AM (12 years ago)
Author:
vboxsync
Message:

crOpenGL: allow adding new commands w/o breaking backwards compatibility (i.e. w/o changing current opcode values)

Location:
trunk/src/VBox/GuestHost/OpenGL
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/OpenGL/glapi_parser/apiutil.py

    r43647 r43652  
    4747                self.props = []
    4848                self.chromium = []
     49                self.chrelopcode = -1
    4950
    5051
     
    162163                                                break
    163164
     165                        elif tokens[0] == 'chrelopcode':
     166                                record.chrelopcode = int(tokens[1])
     167
    164168                        else:
    165169                                print 'Invalid token %s after function %s' % (tokens[0], record.name)
     
    312316        d = GetFunctionDict()
    313317        return d[funcName].chromium
     318       
     319def ChromiumRelOpCode(funcName):
     320        """Return list of Chromium-specific properties of the named GL function."""
     321        d = GetFunctionDict()
     322        return d[funcName].chrelopcode
     323       
    314324
    315325def ParamProps(funcName):
     
    368378                return ''
    369379        elif (cat == '1.3' or
    370           cat == '1.4' or
    371           cat == '1.5' or
    372           cat == '2.0' or
    373           cat == '2.1'):
     380                  cat == '1.4' or
     381                  cat == '1.5' or
     382                  cat == '2.0' or
     383                  cat == '2.1'):
    374384                # i.e. OpenGL 1.3 or 1.4 or 1.5
    375385                return "OPENGL_VERSION_" + string.replace(cat, ".", "_")
     
    580590
    581591def MakeDeclarationStringWithContext(ctx_macro_prefix, params):
    582     """Same as MakeDeclarationString, but adds a context macro
    583     """
    584    
    585     n = len(params)
    586     if n == 0:
    587         return ctx_macro_prefix + '_ARGSINGLEDECL'
    588     else:
    589         result = MakeDeclarationString(params)
    590         return ctx_macro_prefix + '_ARGDECL ' + result
    591     #endif
     592        """Same as MakeDeclarationString, but adds a context macro
     593        """
     594       
     595        n = len(params)
     596        if n == 0:
     597                return ctx_macro_prefix + '_ARGSINGLEDECL'
     598        else:
     599                result = MakeDeclarationString(params)
     600                return ctx_macro_prefix + '_ARGDECL ' + result
     601        #endif
    592602#enddef
    593603
     
    639649        'GLhandleARB': 4,
    640650        'GLcharARB': 1,
    641     'uintptr_t': 4
     651        'uintptr_t': 4
    642652}
    643653
  • trunk/src/VBox/GuestHost/OpenGL/packer/opcodes.py

    r15532 r43652  
    5151# count up number of extended opcode commands
    5252num_extends = 0
     53num_auto_codes = 0
    5354for func in keys:
    5455        if "extpack" in apiutil.ChromiumProps(func):
    5556                num_extends += 1
     57                if apiutil.ChromiumRelOpCode(func) < 0:
     58                        num_auto_codes += 1
     59
     60# sanity check for compatibility breakage
     61# we currently have 304
     62if num_auto_codes != 304:
     63        print >> sys.stderr, "number of auto-generated op-codes should be 304, but is " + str(num_auto_codes)
     64        print >> sys.stderr, "which breaks backwards compatibility"
     65        print >> sys.stderr, "if this is really what you want to do, please adjust this script"
     66        print >> sys.stderr, "to handle a new auto-generated opcodes count"
     67        print "#error -- num_auto_codes should be 304, but is " + str(num_auto_codes)
     68        sys.exit(-1)
    5669
    5770print "/* Functions with a return value or output parameters */"
    5871print "typedef enum {"
    5972
     73opcode_index = 0
    6074enum_index = 0
     75chrelopcodes = {}
    6176for func in keys:
    6277        if "extpack" in apiutil.ChromiumProps(func):
    6378                opcodeName = apiutil.ExtendedOpcodeName(func)
     79                chrelopcode = apiutil.ChromiumRelOpCode(func)
     80                opcode = -1
     81                if chrelopcode >= 0:
     82                        if not chrelopcode in chrelopcodes.keys():
     83                                chrelopcodes[chrelopcode] = chrelopcode
     84                        else:
     85                                print >> sys.stderr, "non-unique chrelopcode: " + str(chrelopcode)
     86                                print "#error -- non-unique chrelopcode:  " + str(num_auto_codes)
     87                                sys.exit(-1)
     88                        opcode = num_auto_codes + chrelopcode
     89                else:
     90                        opcode = opcode_index
     91                        opcode_index = opcode_index + 1
     92
    6493                if enum_index != num_extends-1:
    65                         print "\t%s = %d," % (opcodeName, enum_index )
     94                        print "\t%s = %d," % (opcodeName, opcode )
    6695                else:
    67                         print "\t%s = %d" % (opcodeName, enum_index )
     96                        print "\t%s = %d" % (opcodeName, opcode )
    6897                enum_index = enum_index + 1
    6998print "} CRExtendOpcode;\n"
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette