apiutil.py revision af8d59d05d72f134aeea62712f1286b369807d52
606N/A# This file defines a bunch of utility functions for OpenGL API code 919N/A#====================================================================== 919N/A print """/* Copyright (c) 2001, Stanford University 919N/A print """; Copyright (c) 2001, Stanford University 970N/A#====================================================================== 970N/A """Class to represent a GL API function (name, return type, 947N/A """Open the named API spec file and call userFunc(record) for each record 606N/A # split line into tokens elif tokens[
0] ==
'paramaction':
elif tokens[
0] ==
'vectoralias':
# Dictionary [name] of APIFunction: # Dictionary [name] of name # Reverse mapping of function name aliases #if not "omit" in record.chromium: # Look for vector aliased functions # and look for regular aliases (for glloader) """Return sorted list of all functions known to Chromium.""" """Return sorted list of all functions handled by SPU dispatch table.""" #====================================================================== """Return the C return type of named function. Examples: "void" or "const GLubyte *". """ """Return list of tuples (name, type, vecSize) of function parameters. Example: if funcName=="ClipPlane" return [ ("plane", "GLenum", 0), ("equation", "const GLdouble *", 4) ] """ """Return list of names of actions for testing. """Return list of tuples (name, list of values) of function parameters. """Return list of tuples (name, vector of values) of function parameters. """Return list of tuples (name, list of values) of function parameters. """Return list of properties of the named GL function.""" """Return list of functions that have the named property.""" """Return the category of the named GL function.""" """Return list of Chromium-specific properties of the named GL function.""" """Return list of Parameter-specific properties of the named GL function.""" """Return the function that the named function is an alias of. Ex: Alias('DrawArraysEXT') = 'DrawArrays'. """Like Alias(), but the inverse.""" """Return the non-vector version of the given function, or ''. For example: NonVectorFunction("Color3fv") = "Color3f".""" """Return the vector version of the given non-vector-valued function, For example: VectorVersion("Color3f") = "Color3fv".""" """Return a C preprocessor token to test in order to wrap code. Example: GetTestWrapper("glActiveTextureARB") = "CR_multitexture" Example: GetTestWrapper("glBegin") = "" # i.e. OpenGL 1.3 or 1.4 or 1.5 """Return 1 if the function can be compiled into display lists, else 0.""" """Return 1 if the function or any alias has any property in the """Return 1 if the function can be packed, else 0.""" """Return 1 if the function has a true pack opcode""" """Return 1 if the function sets server-side state, else 0.""" # Exceptions. The first set of these functions *do* have # server-side state-changing effects, but will be missed # by the general query, because they either render (e.g. # Bitmap) or do not compile into display lists (e.g. all the others). # The second set do *not* have server-side state-changing # effects, despite the fact that they do not render # and can be compiled. They are control functions # that are not trackable via state. if funcName in [
'Bitmap',
'DeleteTextures',
'FeedbackBuffer',
'RenderMode',
'BindBufferARB',
'DeleteFencesNV']:
# All compilable functions that do not render and that do # not set or use client-side state (e.g. DrawArrays, et al.), set # All others don't set server-side state. """Return 1 if the function sets client-side state, else 0.""" """Return 1 if the function sets state that is tracked by the state tracker, else 0.""" # These functions set state, but aren't tracked by the state # tracker for various reasons: # - because the state tracker doesn't manage display lists # (e.g. CallList and CallLists) # - because the client doesn't have information about what # the server supports, so the function has to go to the # server (e.g. CompressedTexImage calls) # - because they require a round-trip to the server (e.g. # the CopyTexImage calls, SetFenceNV, TrackMatrixNV) 'CopyTexImage1D',
'CopyTexImage2D',
'CopyTexSubImage1D',
'CopyTexSubImage2D',
'CopyTexSubImage3D',
'CompressedTexImage1DARB',
'CompressedTexSubImage1DARB',
'CompressedTexImage2DARB',
'CompressedTexSubImage2DARB',
'CompressedTexImage3DARB',
'CompressedTexSubImage3DARB',
# Anything else that affects client-side state is trackable. # Anything else that doesn't set state at all is certainly # Per-vertex state isn't tracked the way other state is # tracked, so it is specifically excluded. # Everything else is fine """Return 1 if the function uses client-side state, else 0.""" """Return 1 if the function returns information to the user, else 0.""" """Return 1 if the function gets GL state, else 0.""" """Determine if the datatype is a pointer. Return 1 or 0.""" """Return the type of a pointer. Ex: PointerType('const GLubyte *') = 'GLubyte' """Return the C token for the opcode for the given function.""" """Return the C token for the extended opcode for the given function.""" #====================================================================== """Given a list of (name, type, vectorSize) parameters, make a C-style Ex return: 'index, x, y, z'. """Given a list of (name, type, vectorSize) parameters, make a C-style parameter declaration string. Ex return: 'GLuint index, GLfloat x, GLfloat y, GLfloat z'. """Given a list of (name, type, vectorSize) parameters, make a C-style parameter prototype string (types only). Ex return: 'GLuint, GLfloat, GLfloat, GLfloat'. # see if we need a comma separator #====================================================================== 'GLintptrARB':
4,
# XXX or 8 bytes? 'GLsizeiptrARB':
4,
# XXX or 8 bytes? """Return size of C datatype, in bytes.""" #====================================================================== # if we want double-alignment take word-alignment instead, # yes, this is super-lame, but we know what we are doing return 8 # Leave room for a 64 bit pointer #====================================================================== # __specials[filename] = {} # print "%s not present" % filename return 0 #should never happen