glide3x, h3/h5: changed threadValue stuff from FxU32 to unsigned long.

This commit is contained in:
sezero
2018-08-21 04:11:28 +03:00
parent d04deb23d6
commit 85ec47f22b
4 changed files with 46 additions and 81 deletions

View File

@@ -1413,7 +1413,7 @@ struct _GlideRoot_s {
#if defined(__WATCOMC__) || defined(__MSC__) || (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)))
int p6Fencer; /* xchg to here to keep this in cache!!! */
#endif
FxU32
unsigned long
tlsIndex,
tlsOffset;
@@ -1884,9 +1884,9 @@ _grSstVRetraceOn(void);
#ifdef __GNUC__
extern __inline FxU32 getThreadValueFast (void)
extern __inline unsigned long getThreadValueFast (void)
{
FxU32 t;
unsigned long t;
__asm __volatile (" \
mov %%fs:(%0), %%eax; \
add %1, %%eax; \
@@ -1898,7 +1898,7 @@ extern __inline FxU32 getThreadValueFast (void)
#else /* __GNUC__ */
#pragma warning (4:4035) /* No return value */
__inline FxU32
__inline unsigned long
getThreadValueFast() {
__asm {
__asm mov eax, DWORD PTR fs:[WNT_TEB_PTR]
@@ -1910,8 +1910,8 @@ getThreadValueFast() {
#endif
#if (GLIDE_PLATFORM & GLIDE_OS_MACOS)
extern FxU32 _threadValueMacOS;
__inline FxU32
extern unsigned long _threadValueMacOS;
__inline unsigned long
getThreadValueFast() {
return _threadValueMacOS;
}
@@ -1923,7 +1923,7 @@ extern unsigned long threadValueLinux;
#endif
#if (GLIDE_PLATFORM & GLIDE_OS_DOS32)
extern FxU32 GR_CDECL threadValueDJGPP;
extern unsigned long GR_CDECL threadValueDJGPP;
#define getThreadValueFast() threadValueDJGPP
#endif

View File

@@ -25,8 +25,6 @@
#include <3dfx.h>
#include <glidesys.h>
#if defined( __WIN32__ )
#define FX_DLL_DEFINITION
#include <fxdll.h>
#include <glide.h>
@@ -34,6 +32,8 @@
#include "fxglide.h"
#include "fxcmd.h"
#if defined( __WIN32__ )
#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)
#include <windows.h>
#endif
@@ -89,17 +89,7 @@ void endCriticalSection( void ) {
#elif defined(macintosh)
#include <3dfx.h>
#include <glidesys.h>
#define FX_DLL_DEFINITION
#include <fxdll.h>
#include <glide.h>
#include "fxglide.h"
#include "fxcmd.h"
FxU32 _threadValueMacOS;
unsigned long _threadValueMacOS;
void initThreadStorage(void)
{
@@ -110,7 +100,7 @@ void setThreadValue( unsigned long value )
_threadValueMacOS = value;
}
FxU32 getThreadValueSLOW( void )
unsigned long getThreadValueSLOW( void )
{
return _threadValueMacOS;
}
@@ -129,17 +119,6 @@ void endCriticalSection(void)
#elif defined(__linux__) || defined(__FreeBSD__)
#include <3dfx.h>
#include <glidesys.h>
#define FX_DLL_DEFINITION
#include <fxdll.h>
#include <glide.h>
#include "fxglide.h"
#include "fxcmd.h"
unsigned long threadValueLinux;
void initThreadStorage(void)
@@ -170,29 +149,18 @@ void endCriticalSection(void)
#elif (GLIDE_PLATFORM & GLIDE_OS_DOS32)
#include <3dfx.h>
#include <glidesys.h>
#define FX_DLL_DEFINITION
#include <fxdll.h>
#include <glide.h>
#include "fxglide.h"
#include "fxcmd.h"
FxU32 GR_CDECL threadValueDJGPP;
unsigned long GR_CDECL threadValueDJGPP;
void initThreadStorage(void)
{
}
void setThreadValue( FxU32 value )
void setThreadValue( unsigned long value )
{
threadValueDJGPP = value;
}
FxU32 getThreadValueSLOW( void )
unsigned long getThreadValueSLOW( void )
{
return threadValueDJGPP;
}

View File

@@ -2013,8 +2013,8 @@ struct _GlideRoot_s {
#if defined(__WATCOMC__) || defined(__MSC__) || (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)))
int p6Fencer; /* xchg to here to keep this in cache!!! */
#endif
FxU32 tlsIndex;
FxU32 tlsOffset;
unsigned long tlsIndex;
unsigned long tlsOffset;
int current_sst;
FxI32 windowsInit[MAX_NUM_SST]; /* Is the fullscreen part of glide initialized? */
@@ -2735,14 +2735,14 @@ _grSstVRetraceOn(void);
#ifdef __GNUC__
extern
#endif
__inline FxU32
__inline unsigned long
getThreadValueFast() {
/* According to Microsoft, TlsGetValue is implemented with speed as the
* primary goal. The function performs minimal parameter validation and
* error checking. This function succeeds only when the TLS index is in
* the range 0 through (TLS_MINIMUM_AVAILABLE - 1).
*/
return (FxU32)TlsGetValue(_GlideRoot.tlsIndex);
return (unsigned long)TlsGetValue(_GlideRoot.tlsIndex);
}
#else
@@ -2757,9 +2757,9 @@ getThreadValueFast() {
#ifdef __GNUC__
extern __inline FxU32 getThreadValueFast (void)
extern __inline unsigned long getThreadValueFast (void)
{
FxU32 t;
unsigned long t;
__asm __volatile (" \
mov %%fs:(%0), %%eax; \
add %1, %%eax; \
@@ -2771,7 +2771,7 @@ extern __inline FxU32 getThreadValueFast (void)
#else /* __GNUC__ */
#pragma warning (4:4035) /* No return value */
__inline FxU32
__inline unsigned long
getThreadValueFast() {
__asm {
__asm mov eax, DWORD PTR fs:[WNT_TEB_PTR]
@@ -2786,7 +2786,7 @@ getThreadValueFast() {
#endif
#if (GLIDE_PLATFORM & GLIDE_OS_MACOS)
extern FxU32 _threadValueMacOS;
extern unsigned long _threadValueMacOS;
__inline FxU32
getThreadValueFast() {
return _threadValueMacOS;
@@ -2799,7 +2799,7 @@ extern unsigned long threadValueLinux;
#endif /* defined(GLIDE_PLATFORM & GLIDE_OS_UNIX) */
#if (GLIDE_PLATFORM & GLIDE_OS_DOS32)
extern FxU32 GR_CDECL threadValueDJGPP;
extern unsigned long GR_CDECL threadValueDJGPP;
#define getThreadValueFast() threadValueDJGPP
#endif /* DOS32 */

View File

@@ -19,7 +19,6 @@
**
*/
/* NOTE: This file is compiled to naught if we aren't
running under Win32 */
@@ -55,14 +54,14 @@ initThreadStorage( void )
if (_GlideRoot.tlsIndex == TLS_OUT_OF_INDEXES)
GrErrorCallback( "initThreadStorage: Failed to allocate TLS index.", FXTRUE );
/* pray the index is lower than 64 */
if ((_GlideRoot.tlsIndex < 0) ||
(_GlideRoot.tlsIndex > 63)) /* TLS_MINIMUM_AVAILABLE = 64 */
/* pray the index is lower than 64 -- TLS_MINIMUM_AVAILABLE = 64 */
if (_GlideRoot.tlsIndex => TLS_MINIMUM_AVAILABLE)
GrErrorCallback( "initThreadStorage: TLS index higher than 64.", FXTRUE );
#if !USE_STANDARD_TLS_FUNC
if (hwcIsOSWin9x()) {
_GlideRoot.tlsOffset = W95_TLS_INDEX_TO_OFFSET(_GlideRoot.tlsIndex);
} else {
}
else {
_GlideRoot.tlsOffset = WNT_TLS_INDEX_TO_OFFSET(_GlideRoot.tlsIndex);
}
#endif
@@ -83,9 +82,9 @@ unsigned long getThreadValueSLOW(void)
#if USE_STANDARD_TLS_FUNC
/* used in gdraw.c (grDrawTriangle) and xos.inc */
FxU32 getThreadValue(void)
unsigned long getThreadValue(void)
{
return (FxU32)TlsGetValue(_GlideRoot.tlsIndex);
return (unsigned long)TlsGetValue(_GlideRoot.tlsIndex);
}
#endif
@@ -123,7 +122,7 @@ void endCriticalSection( void ) {
#elif defined(macintosh)
FxU32 _threadValueMacOS;
unsigned long _threadValueMacOS;
void initThreadStorage(void)
{
@@ -134,7 +133,7 @@ void setThreadValue( unsigned long value )
_threadValueMacOS = value;
}
FxU32 getThreadValueSLOW( void )
unsigned long getThreadValueSLOW( void )
{
return _threadValueMacOS;
}
@@ -167,8 +166,6 @@ void initThreadStorage(void)
{
}
void setThreadValue( unsigned long value )
{
threadValueLinux = value;
@@ -197,18 +194,18 @@ void endCriticalSection(void)
#elif (GLIDE_PLATFORM & GLIDE_OS_DOS32)
FxU32 GR_CDECL threadValueDJGPP;
unsigned long GR_CDECL threadValueDJGPP;
void initThreadStorage(void)
{
}
void setThreadValue( FxU32 value )
void setThreadValue( unsigned long value )
{
threadValueDJGPP = value;
}
FxU32 getThreadValueSLOW( void )
unsigned long getThreadValueSLOW( void )
{
return threadValueDJGPP;
}