[OPENGL32]
[reactos.git] / dll / opengl / opengl32 / glapi_x86.s
index 2bfb61e..81e697e 100644 (file)
@@ -7,9 +7,11 @@
 
 /* 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
 
@@ -22,6 +24,23 @@ PUBLIC _gl&name&@&stack
     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
@@ -360,4 +379,4 @@ USE_GL_FUNC Vertex4sv, 149, 4
 USE_GL_FUNC VertexPointer, 321, 16
 USE_GL_FUNC Viewport, 305, 16
 
-END
\ No newline at end of file
+END