儲存庫 vbox 的更動 18539
- 時間撮記:
- 2009-3-30 下午12:44:59 (16 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Additions/common/crOpenGL/entrypoints.py
r15532 r18539 17 17 18 18 def GenerateEntrypoints(hacks = []): 19 20 21 19 """Emit code for all the OpenGL/Chromium entrypoints. 20 hacks is an optional list of functions which are special cased. 21 """ 22 22 23 23 apiutil.CopyrightC() 24 24 25 print '#define GL_GLEXT_PROTOTYPES' 26 print '#include <stdio.h>' 27 print '#include <stdlib.h>' 28 print '#include <GL/gl.h>' 29 print '#include "chromium.h"' 30 print '#include "stub.h"' 31 print '' 25 print '#define GL_GLEXT_PROTOTYPES' 26 print '#include <stdio.h>' 27 print '#include <stdlib.h>' 28 print '#include <GL/gl.h>' 29 print '#include "chromium.h"' 30 print '#include "stub.h"' 31 print '#include "dri_glx.h"' 32 print '' 32 33 33 34 35 36 34 # Get sorted list of dispatched functions. 35 # The order is very important - it must match cr_opcodes.h 36 # and spu_dispatch_table.h 37 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") 37 38 38 39 40 41 42 39 for index in range(len(keys)): 40 func_name = keys[index] 41 if apiutil.Category(func_name) == "Chromium": 42 # this function is defined in stub.c 43 continue 43 44 44 45 45 return_type = apiutil.ReturnType(func_name) 46 params = apiutil.Parameters(func_name) 46 47 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 print "%s gl%s( %s );" % (return_type, func_name, apiutil.MakeDeclarationString(params))91 92 print "%s gl%s( %s )" % (return_type, func_name, apiutil.MakeDeclarationString(params))93 94 95 96 97 98 99 48 if func_name in hacks: 49 print "/* hacked entrypoint: %s */" % func_name 50 if func_name == "TexImage3D": 51 # Pretty common: internalformat is GLenum, not GLint 52 print "void glTexImage3D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels )" 53 print "{" 54 print "\tglim.TexImage3D( target, level, (GLint) internalformat, width, height, depth, border, format, type, pixels );" 55 print "}" 56 elif func_name == "TexImage2D": 57 # Pretty common: internalformat is GLenum, not GLint 58 print "void glTexImage2D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels )" 59 print "{" 60 print "\tglim.TexImage2D( target, level, (GLint) internalformat, width, height, border, format, type, pixels );" 61 print "}" 62 elif func_name == "TexImage1D": 63 # Pretty common: internalformat is GLenum, not GLint 64 print "void glTexImage1D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels )" 65 print "{" 66 print "\tglim.TexImage1D( target, level, (GLint) internalformat, width, border, format, type, pixels );" 67 print "}" 68 elif func_name == "EdgeFlagPointer": 69 # second arg is GLboolean instead of GLvoid 70 print "void glEdgeFlagPointer( GLsizei stride, const GLboolean *pointer )" 71 print "{" 72 print "\tglim.EdgeFlagPointer( stride, pointer );" 73 print "}" 74 elif func_name == "ProgramParameters4fvNV": 75 print "void glProgramParameters4fvNV( GLenum target, GLuint index, GLuint num, const GLfloat *params )" 76 print "{" 77 print "\tglim.ProgramParameters4fvNV( target, index, num, params );" 78 print "}" 79 elif func_name == "MultiDrawElementsEXT": 80 print "void glMultiDrawElementsEXT(GLenum mode, GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount)" 81 print "{" 82 print "\tglim.MultiDrawElementsEXT(mode, count,type, indices, primcount);" 83 print "}" 84 elif func_name == "ProgramParameters4dvNV": 85 print "void glProgramParameters4dvNV( GLenum target, GLuint index, GLuint num, const GLdouble *params )" 86 print "{" 87 print "\tglim.ProgramParameters4dvNV( target, index, num, params );" 88 print "}" 89 else: 90 # the usual path 91 print "%s VBOXGLTAG(gl%s)( %s );" % (return_type, func_name, apiutil.MakeDeclarationString(params)) 92 print "" 93 print "%s VBOXGLTAG(gl%s)( %s )" % (return_type, func_name, apiutil.MakeDeclarationString(params)) 94 print "{" 95 print "\t", 96 if return_type != "void": 97 print "return ", 98 print "glim.%s( %s );" % (func_name, apiutil.MakeCallString(params)) 99 print "}" 100 print "" 100 101 101 102 103 102 print '/*' 103 print '* Aliases' 104 print '*/' 104 105 105 106 107 108 109 106 # Now loop over all the functions and take care of any aliases 107 allkeys = apiutil.GetAllFunctions(sys.argv[1]+"/APIspec.txt") 108 for func_name in allkeys: 109 if "omit" in apiutil.ChromiumProps(func_name): 110 continue 110 111 111 112 113 112 if func_name in keys: 113 # we already processed this function earlier 114 continue 114 115 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 print "%s gl%s( %s );" % (return_type, func_name, apiutil.MakeDeclarationString(params))144 145 print "%s gl%s( %s )" % (return_type, func_name, apiutil.MakeDeclarationString(params))146 147 148 149 150 151 152 116 # alias is the function we're aliasing 117 alias = apiutil.Alias(func_name) 118 if alias: 119 if func_name in hacks: 120 print "/* hacked entrypoint: %s */" % func_name 121 if func_name == "MultiDrawArrays": 122 print "void glMultiDrawArrays( GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount )" 123 print "{" 124 print "\tglim.MultiDrawArraysEXT( mode, (GLint*)first, (GLsizei*)count, primcount );" 125 print "}" 126 elif func_name == "BufferData": 127 print "void glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)" 128 print "{" 129 print "\tglim.BufferDataARB(target, size, data, usage);" 130 print "}" 131 elif func_name == "BufferSubData": 132 print "void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)" 133 print "{" 134 print "\tglim.BufferSubDataARB(target, offset, size, data);" 135 print "}" 136 elif func_name == "GetBufferSubData": 137 print "void glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data)" 138 print "{" 139 print "\tglim.GetBufferSubDataARB(target, offset, size, data);" 140 print "}" 141 else: 142 return_type = apiutil.ReturnType(func_name) 143 params = apiutil.Parameters(func_name) 144 print "%s VBOXGLTAG(gl%s)( %s );" % (return_type, func_name, apiutil.MakeDeclarationString(params)) 145 print "" 146 print "%s VBOXGLTAG(gl%s)( %s )" % (return_type, func_name, apiutil.MakeDeclarationString(params)) 147 print "{" 148 print "\t", 149 if return_type != "void": 150 print "return ", 151 print "glim.%s( %s );" % (alias, apiutil.MakeCallString(params)) 152 print "}" 153 print "" 153 154 154 155 156 155 print '/*' 156 print '* No-op stubs' 157 print '*/' 157 158 158 159 160 161 162 159 # Now generate no-op stub functions 160 for func_name in allkeys: 161 if "stub" in apiutil.ChromiumProps(func_name): 162 return_type = apiutil.ReturnType(func_name) 163 params = apiutil.Parameters(func_name) 163 164 164 print "%s gl%s( %s );" % (return_type, func_name, apiutil.MakeDeclarationString(params))165 166 print "%s gl%s( %s )" % (return_type, func_name, apiutil.MakeDeclarationString(params))167 168 169 170 171 165 print "%s VBOXGLTAG(gl%s)( %s );" % (return_type, func_name, apiutil.MakeDeclarationString(params)) 166 print "" 167 print "%s VBOXGLTAG(gl%s)( %s )" % (return_type, func_name, apiutil.MakeDeclarationString(params)) 168 print "{" 169 if return_type != "void": 170 print "return (%s) 0" % return_type 171 print "}" 172 print "" 172 173 173 174
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器