/* X86 opengl API entry points, fast forward to the current thread's dispatch table */
#include <asm.inc>
+#include <ks386.inc>
.code
+#ifdef OPENG32_USE_TLS
EXTERN _OglTlsIndex:DWORD
EXTERN _TlsGetValue@4:PROC
jmp dword ptr [eax+4*VAL(offset)]
.ENDP
ENDM
+#else
+MACRO(USE_GL_FUNC, name, offset, stack)
+EXTERN _nop_&name@&stack:PROC
+PUBLIC _gl&name&@&stack
+.PROC _gl&name&@&stack
+ /* Get the TEB */
+ mov eax, fs:[TEB_SELF]
+ /* Get the GL table */
+ mov eax, [eax + TEB_GL_TABLE]
+ /* If we don't have a dispatch table, call the nop */
+ test eax, eax
+ jz _nop_&name&@&stack
+ /* Jump into the ICD */
+ jmp dword ptr [eax+4*VAL(offset)]
+.ENDP
+ENDM
+#endif
USE_GL_FUNC Accum, 213, 8
USE_GL_FUNC AlphaFunc, 240, 8
USE_GL_FUNC VertexPointer, 321, 16
USE_GL_FUNC Viewport, 305, 16
-END
\ No newline at end of file
+END