mirror of
https://github.com/reactos/reactos.git
synced 2025-06-14 23:48:29 +00:00
[OPENGL32]
- Get rid of the default stub table, use NULL instead - Simplify stub code by using the appropriate macros CORE-14024
This commit is contained in:
parent
b060a81d5d
commit
31acac46a1
5 changed files with 38 additions and 3710 deletions
File diff suppressed because it is too large
Load diff
|
@ -49,7 +49,6 @@ DllMain(HINSTANCE hInstance, DWORD Reason, LPVOID Reserved)
|
||||||
if (!init_tls_data())
|
if (!init_tls_data())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
#endif // defined(OPENGL32_USE_TLS)
|
#endif // defined(OPENGL32_USE_TLS)
|
||||||
IntSetCurrentDispatchTable(&StubTable.glDispatchTable);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DLL_THREAD_DETACH:
|
case DLL_THREAD_DETACH:
|
||||||
|
|
|
@ -9,38 +9,48 @@
|
||||||
#include <asm.inc>
|
#include <asm.inc>
|
||||||
#include <ks386.inc>
|
#include <ks386.inc>
|
||||||
|
|
||||||
|
.data
|
||||||
|
ASSUME nothing
|
||||||
|
|
||||||
|
.align 16
|
||||||
|
|
||||||
.code
|
.code
|
||||||
|
|
||||||
#ifdef OPENG32_USE_TLS
|
#ifdef OPENG32_USE_TLS
|
||||||
EXTERN _OglTlsIndex:DWORD
|
EXTERN _OglTlsIndex:DWORD
|
||||||
EXTERN _TlsGetValue@4:PROC
|
EXTERN _TlsGetValue@4:PROC
|
||||||
|
#endif
|
||||||
|
|
||||||
MACRO(USE_GL_FUNC, name, offset, stack)
|
MACRO(USE_GL_FUNC, name, offset, stack)
|
||||||
PUBLIC _gl&name&@&stack
|
PUBLIC _gl&name&@&stack
|
||||||
.PROC _gl&name&@&stack
|
.PROC _gl&name&@&stack
|
||||||
|
|
||||||
|
FPO 0, 0, 0, 0, 0, FRAME_FPO
|
||||||
|
|
||||||
|
#ifdef OPENG32_USE_TLS
|
||||||
push _OglTlsIndex
|
push _OglTlsIndex
|
||||||
call _TlsGetValue@4
|
call _TlsGetValue@4
|
||||||
|
/* If we don't have a thread data, this is a nop */
|
||||||
|
test eax, eax
|
||||||
|
jz name&_fast_ret
|
||||||
|
/* Get the GL table */
|
||||||
mov eax, [eax]
|
mov eax, [eax]
|
||||||
jmp dword ptr [eax+4*VAL(offset)]
|
|
||||||
.ENDP
|
|
||||||
ENDM
|
|
||||||
#else
|
#else
|
||||||
MACRO(USE_GL_FUNC, name, offset, stack)
|
|
||||||
EXTERN _nop_&name@&stack:PROC
|
|
||||||
PUBLIC _gl&name&@&stack
|
|
||||||
.PROC _gl&name&@&stack
|
|
||||||
/* Get the TEB */
|
/* Get the TEB */
|
||||||
mov eax, fs:[TEB_SELF]
|
mov eax, fs:[TEB_SELF]
|
||||||
/* Get the GL table */
|
/* Get the GL table */
|
||||||
mov eax, [eax + TEB_GL_TABLE]
|
mov eax, [eax + TEB_GL_TABLE]
|
||||||
/* If we don't have a dispatch table, call the nop */
|
#endif
|
||||||
|
|
||||||
|
/* If we don't have a dispatch table, this is a nop */
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz _nop_&name&@&stack
|
jz name&_fast_ret
|
||||||
/* Jump into the ICD */
|
/* Jump into the ICD */
|
||||||
jmp dword ptr [eax+4*VAL(offset)]
|
jmp dword ptr [eax+4*VAL(offset)]
|
||||||
|
name&_fast_ret:
|
||||||
|
ret VAL(stack)
|
||||||
.ENDP
|
.ENDP
|
||||||
ENDM
|
ENDM
|
||||||
#endif
|
|
||||||
|
|
||||||
USE_GL_FUNC Accum, 213, 8
|
USE_GL_FUNC Accum, 213, 8
|
||||||
USE_GL_FUNC AlphaFunc, 240, 8
|
USE_GL_FUNC AlphaFunc, 240, 8
|
||||||
|
|
|
@ -359,9 +359,6 @@ typedef struct _GLCLTPROCTABLE
|
||||||
|
|
||||||
typedef VOID (APIENTRY * PFN_SETPROCTABLE)(const GLCLTPROCTABLE*);
|
typedef VOID (APIENTRY * PFN_SETPROCTABLE)(const GLCLTPROCTABLE*);
|
||||||
|
|
||||||
/* Those functions are there in case GL calls are made without a context */
|
|
||||||
extern const GLCLTPROCTABLE StubTable;
|
|
||||||
|
|
||||||
/* This doesn't seem to be anywhere in ddk or psdk */
|
/* This doesn't seem to be anywhere in ddk or psdk */
|
||||||
DECLARE_HANDLE(DHGLRC);
|
DECLARE_HANDLE(DHGLRC);
|
||||||
|
|
||||||
|
|
|
@ -696,7 +696,7 @@ BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc)
|
||||||
ERR("DrvSetContext failed!\n");
|
ERR("DrvSetContext failed!\n");
|
||||||
/* revert */
|
/* revert */
|
||||||
InterlockedExchange(&ctx->thread_id, 0);
|
InterlockedExchange(&ctx->thread_id, 0);
|
||||||
IntSetCurrentDispatchTable(&StubTable.glDispatchTable);
|
IntSetCurrentDispatchTable(NULL);
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -728,8 +728,7 @@ BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc)
|
||||||
InterlockedExchange(&old_ctx->thread_id, 0);
|
InterlockedExchange(&old_ctx->thread_id, 0);
|
||||||
/* Unset it */
|
/* Unset it */
|
||||||
IntMakeCurrent(NULL, NULL, NULL);
|
IntMakeCurrent(NULL, NULL, NULL);
|
||||||
/* Reset the no-op table */
|
IntSetCurrentDispatchTable(NULL);
|
||||||
set_api_table(&StubTable);
|
|
||||||
/* Test conformance (extreme cases) */
|
/* Test conformance (extreme cases) */
|
||||||
return hglrc == NULL;
|
return hglrc == NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue