From da70978cfd6ef8ea42456c44fa3cf287298b5031 Mon Sep 17 00:00:00 2001 From: dborca <> Date: Thu, 7 Oct 2004 07:16:38 +0000 Subject: [PATCH] corrected grDrawTriangle on MSVC --- glide3x/h3/glide3/src/fxglide.h | 30 +++++++++++++++++++++++++++++- glide3x/h3/glide3/src/gdraw.c | 9 ++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/glide3x/h3/glide3/src/fxglide.h b/glide3x/h3/glide3/src/fxglide.h index 44e6e9a..91c8fa9 100644 --- a/glide3x/h3/glide3/src/fxglide.h +++ b/glide3x/h3/glide3/src/fxglide.h @@ -19,6 +19,9 @@ ** ** $Header$ ** $Log$ +** Revision 1.2.4.7 2004/10/05 14:47:15 dborca +** conditional compilation a bit more sane +** ** Revision 1.2.4.6 2004/10/04 09:26:30 dborca ** DOS/OpenWatcom support ** @@ -1635,10 +1638,35 @@ _trisetup_noclip_valid(TRISETUPARGS); #define TRISETUP_RGB(__cullMode) TRISETUP_NORGB(__cullMode) #define TRISETUP_ARGB(__cullMode) TRISETUP_NORGB(__cullMode) -#if defined( __MSC__ ) +#if defined( __MSC__ ) + +#if (_MSC_VER < 1200) +// TRISETUP Macro for pre-msvc 6.0 #define TRISETUP \ __asm { mov edx, gc }; \ (*gc->triSetupProc) +#else // _MSC_VER +// TRISETUP Macro for msvc 6 or later +#if defined(GLIDE_DEBUG) || GLIDE_USE_C_TRISETUP +// MSVC6 Debug does funny stuff, so push our parms inline +#define TRISETUP(_a, _b, _c) \ + __asm { \ + __asm mov edx, gc \ + __asm mov eax, _c \ + __asm push eax \ + __asm mov ebx, _b \ + __asm push ebx \ + __asm mov ecx, _a \ + __asm push ecx \ + } \ + ((FxI32 (*)(void))*gc->triSetupProc)() +#else // GLIDE_DEBUG +// MSVC6 Retail does funny stuff too, but Larry figured it out: +#define TRISETUP(_a, _b, _c) \ + __asm { mov edx, gc }; \ + ((FxI32 (*)(const void *va, const void *vb, const void *vc, GrGC *gc))*gc->triSetupProc)(_a, _b, _c, gc) +#endif // GLIDE_DEBUG +#endif // _MSC_VER #elif defined( __linux__ ) || defined(__DJGPP__) diff --git a/glide3x/h3/glide3/src/gdraw.c b/glide3x/h3/glide3/src/gdraw.c index bfb6769..79360b6 100644 --- a/glide3x/h3/glide3/src/gdraw.c +++ b/glide3x/h3/glide3/src/gdraw.c @@ -19,6 +19,9 @@ ** ** $Header$ ** $Log$ + ** Revision 1.2.6.4 2004/10/05 14:47:15 dborca + ** conditional compilation a bit more sane + ** ** Revision 1.2.6.3 2004/10/04 09:26:31 dborca ** DOS/OpenWatcom support ** @@ -255,7 +258,11 @@ GR_ENTRY(grDrawLine, void, (const void *a, const void *b)) /*--------------------------------------------------------------------------- ** grDrawTriangle */ - +#if !defined(GLIDE_DEBUG) && !(GLIDE_PLATFORM & GLIDE_OS_UNIX) && !(GLIDE_PLATFORM & GLIDE_OS_DOS32) +#if !(GLIDE_USE_C_TRISETUP) +__declspec( naked ) +#endif +#endif /* !defined(GLIDE_DEBUG) && !(GLIDE_PLATFORM & GLIDE_OS_UNIX) && !(GLIDE_PLATFORM & GLIDE_OS_DOS32) */ GR_ENTRY(grDrawTriangle, void, (const void *a, const void *b, const void *c)) { #define FN_NAME "grDrawTriangle"