summaryrefslogtreecommitdiff
path: root/src/mesa/glapi
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/glapi')
-rw-r--r--src/mesa/glapi/glx86asm.py35
1 files changed, 25 insertions, 10 deletions
diff --git a/src/mesa/glapi/glx86asm.py b/src/mesa/glapi/glx86asm.py
index ea0479720d..f070c23ea1 100644
--- a/src/mesa/glapi/glx86asm.py
+++ b/src/mesa/glapi/glx86asm.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-# $Id: glx86asm.py,v 1.7 2003/10/14 23:47:21 kendallb Exp $
+# $Id: glx86asm.py,v 1.8 2003/10/22 21:02:15 kendallb Exp $
# Mesa 3-D graphics library
# Version: 4.1
@@ -43,11 +43,13 @@ def PrintHead():
print '#include "glapioffsets.h"'
print ''
print '#ifndef __WIN32__'
- print ''
- print '#if defined(USE_MGL_NAMESPACE)'
- print '#define GL_PREFIX(n) GLNAME(CONCAT(mgl,n))'
+ print ''
+ print '#if defined(STDCALL_API)'
+ print '#define GL_PREFIX(n,n2) GLNAME(CONCAT(gl,n2))'
+ print '#elif defined(USE_MGL_NAMESPACE)'
+ print '#define GL_PREFIX(n,n2) GLNAME(CONCAT(mgl,n))'
print '#else'
- print '#define GL_PREFIX(n) GLNAME(CONCAT(gl,n))'
+ print '#define GL_PREFIX(n,n2) GLNAME(CONCAT(gl,n))'
print '#endif'
print ''
print '#define GL_OFFSET(x) CODEPTR(REGOFF(4 * x, EAX))'
@@ -84,6 +86,19 @@ def FindOffset(funcName):
return -1
#enddef
+# Find the size of the arguments on the stack for _stdcall name mangling
+def FindStackSize(typeList):
+ result = 0
+ for typ in typeList:
+ if typ == 'GLdouble' or typ == 'GLclampd':
+ result += 8;
+ else:
+ result += 4;
+ #endif
+ #endfor
+ return result
+#enddef
+
def EmitFunction(name, returnType, argTypeList, argNameList, alias, offset):
argList = apiparser.MakeArgList(argTypeList, argNameList)
if alias != '':
@@ -105,18 +120,18 @@ def EmitFunction(name, returnType, argTypeList, argNameList, alias, offset):
# save this info in case we need to look up an alias later
records.append((name, dispatchName, offset))
+ # Find the argument stack size for _stdcall name mangling
+ stackSize = FindStackSize(argTypeList)
+
# print the assembly code
print 'ALIGNTEXT16'
- print "GLOBL_FN(GL_PREFIX(%s))" % (name)
- print "GL_PREFIX(%s):" % (name)
+ print "GLOBL_FN(GL_PREFIX(%s,%s@%s))" % (name, name, stackSize)
+ print "GL_PREFIX(%s,%s@%s):" % (name, name, stackSize)
print '\tMOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX)'
print "\tJMP(GL_OFFSET(_gloffset_%s))" % (dispatchName)
print ''
-
#enddef
-
-
PrintHead()
apiparser.ProcessSpecFile("APIspec", EmitFunction)
PrintTail()