Last needed 64 bit fixes for h5/h3, complete 64 bit support for cvg

This commit is contained in:
jwrdegoede
2005-08-13 21:07:04 +00:00
parent a30877fb0f
commit 93f42cc6f8
66 changed files with 839 additions and 749 deletions

View File

@@ -3,6 +3,9 @@
*
* $Header$
* $Log$
* Revision 1.1.2.2 2005/05/11 14:42:15 jwrdegoede
* Also fix gcc4 PIC compilation of cpuid.c for cvg
*
* Revision 1.1.2.10 2004/10/05 14:54:29 dborca
* DOS/OpenWatcom woes
*
@@ -36,7 +39,7 @@
#include "cpuid.h"
typedef unsigned long word32;
typedef unsigned int word32;
/* These are the bit flags that get set on calling cpuid
* with register eax set to 1

View File

@@ -19,6 +19,9 @@
**
** $Header$
** $Log$
** Revision 1.1.1.1 1999/12/07 21:42:31 joseph
** Initial checkin into SourceForge.
**
**
** 1 10/08/98 11:30a Brent
**
@@ -452,8 +455,8 @@ GR_DIENTRY(grDrawVertexArrayContiguous, void , (FxU32 mode, FxU32 Count, void *p
{
FxU32 i;
for (i = 0; i < Count; i++)
GDBG_INFO(110, "%s: pointers[%d] = 0x%x\n",
FN_NAME, i, (int)pointers + gc->state.vData.vStride * i);
GDBG_INFO(110, "%s: pointers[%d] = 0x%lx\n",
FN_NAME, i, (unsigned long)pointers + gc->state.vData.vStride * i);
}
#endif

View File

@@ -19,6 +19,9 @@
**
** $Header$
** $Log$
** Revision 1.1.1.1 1999/12/07 21:42:31 joseph
** Initial checkin into SourceForge.
**
**
** 1 10/08/98 11:30a Brent
**
@@ -350,16 +353,16 @@ cvgRegNames[] = {
"reserved0FF", /* 0xff */
};
#define GEN_INDEX(a) ((((FxU32) a) - ((FxU32) gc->reg_ptr)) >> 2)
#define GEN_INDEX(a) ((((unsigned long) a) - ((unsigned long) gc->reg_ptr)) >> 2)
void
_grFifoWriteDebug(FxU32 addr, FxU32 val, FxU32 fifoPtr)
_grFifoWriteDebug(FxU32 addr, FxU32 val, unsigned long fifoPtr)
{
GR_DCL_GC;
FxU32 index = GEN_INDEX(addr);
GDBG_INFO(gc->myLevel + 199, "Storing to FIFO:\n");
GDBG_INFO(gc->myLevel + 199, " FIFO Ptr: 0x%x : 0x%X\n", fifoPtr, gc->cmdTransportInfo.fifoRoom);
GDBG_INFO(gc->myLevel + 199, " FIFO Ptr: 0x%lx : 0x%X\n", fifoPtr, gc->cmdTransportInfo.fifoRoom);
if (index <= 0xff) {
GDBG_INFO(gc->myLevel + 199, " Reg Name: %s\n", cvgRegNames[index]);
GDBG_INFO(gc->myLevel + 199, " Reg Num: 0x%X\n", index);
@@ -382,19 +385,19 @@ _grFifoWriteDebug(FxU32 addr, FxU32 val, FxU32 fifoPtr)
}
GDBG_INFO(gc->myLevel + 199, " Value: 0x%X 0x%X\n", (index << 2), val);
GDBG_INFO(120, " SET(0x%X, %ld(0x%X)) 0 %s (0x%X)\n",
GDBG_INFO(120, " SET(0x%X, %ld(0x%X)) 0 %s (0x%lX)\n",
0x10000000UL + (FxU32)(index << 2), val, val,
cvgRegNames[index & 0xFF], fifoPtr);
} /* _grFifoWriteDebug */
void
_grFifoFWriteDebug(FxU32 addr, float val, FxU32 fifoPtr)
_grFifoFWriteDebug(FxU32 addr, float val, unsigned long fifoPtr)
{
GR_DCL_GC;
FxU32 index = GEN_INDEX(addr);
GDBG_INFO(gc->myLevel + 200, "Storing to FIFO:\n");
GDBG_INFO(gc->myLevel + 200, " FIFO Ptr: 0x%x\n", fifoPtr);
GDBG_INFO(gc->myLevel + 200, " FIFO Ptr: 0x%lx\n", fifoPtr);
if (index <= 0xff) {
GDBG_INFO(gc->myLevel + 200, " Reg Name: %s\n", cvgRegNames[index]);
GDBG_INFO(gc->myLevel + 200, " Reg Num: 0x%x\n", index);
@@ -523,7 +526,6 @@ void GR_CDECL
_FifoMakeRoom(const FxI32 blockSize, const char* fName, const int fLine)
{
#define FN_NAME "_FifoMakeRoom"
FxU32 wrapAddr = 0x00UL;
GR_BEGIN_NOFIFOCHECK(FN_NAME, 400);
GR_ASSERT(blockSize > 0);
@@ -542,11 +544,11 @@ _FifoMakeRoom(const FxI32 blockSize, const char* fName, const int fLine)
#if GDBG_INFO_ON
GDBG_INFO_MORE(gc->myLevel, ": (%s : %d)\n"
"\tfifoBlock: (0x%X : 0x%X)\n"
"\tfifoBlock: (0x%lX : 0x%X)\n"
"\tfifoRoom: (0x%X : 0x%X) : (0x%X : 0x%X)\n"
"\tfifo hw: (0x%X : 0x%X)\n",
"\tfifo hw: (0x%lX : 0x%lX)\n",
((fName == NULL) ? "Unknown" : fName), fLine,
(FxU32)gc->cmdTransportInfo.fifoPtr, blockSize,
(unsigned long)gc->cmdTransportInfo.fifoPtr, blockSize,
gc->cmdTransportInfo.roomToReadPtr, gc->cmdTransportInfo.roomToEnd,
gc->cmdTransportInfo.fifoRoom, writes,
HW_FIFO_PTR(FXTRUE), gc->cmdTransportInfo.fifoRead);
@@ -571,28 +573,28 @@ _FifoMakeRoom(const FxI32 blockSize, const char* fName, const int fLine)
again:
/* do we need to stall? */
{
FxU32 lastHwRead = gc->cmdTransportInfo.fifoRead;
unsigned long lastHwRead = gc->cmdTransportInfo.fifoRead;
FxI32 roomToReadPtr = gc->cmdTransportInfo.roomToReadPtr;
while (roomToReadPtr < blockSize) {
FxU32 curReadPtr = HW_FIFO_PTR(FXTRUE);
unsigned long curReadPtr = HW_FIFO_PTR(FXTRUE);
FxU32 curReadDist = curReadPtr - lastHwRead;
GR_ASSERT((curReadPtr >= (FxU32)gc->cmdTransportInfo.fifoStart) &&
(curReadPtr < (FxU32)gc->cmdTransportInfo.fifoEnd));
GR_ASSERT((curReadPtr >= (unsigned long)gc->cmdTransportInfo.fifoStart) &&
(curReadPtr < (unsigned long)gc->cmdTransportInfo.fifoEnd));
#if !GLIDE_INIT_HAL
/* If we're in an sli configuration then we need to make sure
* that we don't catch up to either the slave as well.
*/
if (gc->scanline_interleaved) {
const FxU32 slaveReadPtr = HW_FIFO_PTR(FXFALSE);
const unsigned long slaveReadPtr = HW_FIFO_PTR(FXFALSE);
const FxU32 slaveReadDist = (slaveReadPtr - lastHwRead);
FxI32 distSlave = (FxI32)slaveReadDist;
FxI32 distMaster = (FxI32)curReadDist;
GR_ASSERT((slaveReadPtr >= (FxU32)gc->cmdTransportInfo.fifoStart) &&
(slaveReadPtr < (FxU32)gc->cmdTransportInfo.fifoEnd));
GR_ASSERT((slaveReadPtr >= (unsigned long)gc->cmdTransportInfo.fifoStart) &&
(slaveReadPtr < (unsigned long)gc->cmdTransportInfo.fifoEnd));
/* Get the actual absolute distance to the respective fifo ptrs */
if (distSlave < 0) distSlave += (FxI32)gc->cmdTransportInfo.fifoSize - FIFO_END_ADJUST;
@@ -603,9 +605,9 @@ again:
#if GDBG_INFO_ON
{
SstRegs* slaveHw = (SstRegs*)gc->slave_ptr;
GDBG_INFO(gc->myLevel, " Wait sli: 0x%X : (0x%X : 0x%X : 0x%X)\n"
"\tMaster: 0x%X : 0x%X\n"
"\tSlave : 0x%X : 0x%X\n",
GDBG_INFO(gc->myLevel, " Wait sli: 0x%lX : (0x%X : 0x%X : 0x%X)\n"
"\tMaster: 0x%lX : 0x%X\n"
"\tSlave : 0x%lX : 0x%X\n",
HW_FIFO_PTR(FXFALSE),
GR_GET(slaveHw->cmdFifoDepth),
GR_GET(slaveHw->cmdFifoHoles),
@@ -632,23 +634,23 @@ again:
lastHwRead = curReadPtr;
}
GR_ASSERT((lastHwRead >= (FxU32)gc->cmdTransportInfo.fifoStart) &&
(lastHwRead < (FxU32)gc->cmdTransportInfo.fifoEnd));
GR_ASSERT((lastHwRead >= (unsigned long)gc->cmdTransportInfo.fifoStart) &&
(lastHwRead < (unsigned long)gc->cmdTransportInfo.fifoEnd));
/* Update cached copies */
gc->cmdTransportInfo.fifoRead = lastHwRead;
gc->cmdTransportInfo.roomToReadPtr = roomToReadPtr;
GDBG_INFO(gc->myLevel, " Wait: (0x%X : 0x%X) : 0x%X\n",
GDBG_INFO(gc->myLevel, " Wait: (0x%X : 0x%X) : 0x%lX\n",
gc->cmdTransportInfo.roomToReadPtr, gc->cmdTransportInfo.roomToEnd,
gc->cmdTransportInfo.fifoRead);
(unsigned long)gc->cmdTransportInfo.fifoRead);
}
/* Do we need to wrap to front? */
if (gc->cmdTransportInfo.roomToEnd <= blockSize) {
GDBG_INFO(gc->myLevel + 10, " Pre-Wrap: (0x%X : 0x%X) : 0x%X\n",
GDBG_INFO(gc->myLevel + 10, " Pre-Wrap: (0x%X : 0x%X) : 0x%lX\n",
gc->cmdTransportInfo.roomToReadPtr, gc->cmdTransportInfo.roomToEnd,
gc->cmdTransportInfo.fifoRead);
(unsigned long)gc->cmdTransportInfo.fifoRead);
/* Set the jsr packet.
* NB: This command must be fenced.
@@ -660,8 +662,6 @@ again:
}
FIFO_ASSERT();
wrapAddr = (FxU32)gc->cmdTransportInfo.fifoPtr;
/* Update roomXXX fields for the actual wrap */
gc->cmdTransportInfo.roomToReadPtr -= gc->cmdTransportInfo.roomToEnd;
gc->cmdTransportInfo.roomToEnd = gc->cmdTransportInfo.fifoSize - FIFO_END_ADJUST;
@@ -684,9 +684,9 @@ again:
}
#endif /* GLIDE_USE_SHADOW_FIFO */
GDBG_INFO(gc->myLevel + 10, " Post-Wrap: (0x%X : 0x%X) : 0x%X\n",
GDBG_INFO(gc->myLevel + 10, " Post-Wrap: (0x%X : 0x%X) : 0x%lX\n",
gc->cmdTransportInfo.roomToReadPtr, gc->cmdTransportInfo.roomToEnd,
gc->cmdTransportInfo.fifoRead);
(unsigned long)gc->cmdTransportInfo.fifoRead);
goto again;
}
@@ -697,10 +697,10 @@ again:
#if GDBG_INFO_ON
#if (GLIDE_PLATFORM & GLIDE_HW_CVG)
GDBG_INFO(gc->myLevel, FN_NAME"_Done:\n"
"\tfifoBlock: (0x%X : 0x%X)\n"
"\tfifoBlock: (0x%lX : 0x%X)\n"
"\tfifoRoom: (0x%X : 0x%X : 0x%X)\n"
"\tfifo hw: (0x%X : 0x%X) : (0x%X : 0x%X : 0x%X)\n",
(FxU32)gc->cmdTransportInfo.fifoPtr, blockSize,
"\tfifo hw: (0x%lX : 0x%lX) : (0x%X : 0x%X : 0x%X)\n",
(unsigned long)gc->cmdTransportInfo.fifoPtr, blockSize,
gc->cmdTransportInfo.roomToReadPtr,
gc->cmdTransportInfo.roomToEnd, gc->cmdTransportInfo.fifoRoom,
HW_FIFO_PTR(FXTRUE), gc->cmdTransportInfo.fifoRead,

View File

@@ -19,6 +19,9 @@
**
** $Header$
** $Log$
** Revision 1.1.1.1.8.12 2005/06/10 14:17:53 jwrdegoede
** Fix compilation when GL_X86 is not defined
**
** Revision 1.1.1.1.8.11 2005/06/09 18:32:08 jwrdegoede
** Fixed all warnings with gcc4 -Wall -W -Wno-unused-parameter, except for a couple I believe to be a gcc bug. This has been reported to gcc.
**
@@ -427,10 +430,8 @@
* dpc - 21 may 1997 - FixMe!
* This was yoinked from sst1/include/sst1init.h, and should be
* merged back into something if we decide that we need it later.
*/
extern FxU32 p6FenceVar;
/* dpc - 2 june 1997
*
* dpc - 2 june 1997
* Moved the fence check out to avoid empty if body warning w/ gcc.
* This only applies to systems that require the p6 fencing.
*/
@@ -1035,47 +1036,47 @@ void FX_CSTYLE _grDrawVertexList_3DNow_Clip(FxU32 pktype, FxU32 type, FxI32 mode
* xtexdl.c
*/
struct GrGC_s;
typedef void (FX_CALL* GrTexDownloadProc)(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
typedef void (FX_CALL* GrTexDownloadProc)(struct GrGC_s* gc, const unsigned long tmuBaseAddr,
const FxU32 maxS, const FxU32 minT, const FxU32 maxT,
void* texData);
typedef GrTexDownloadProc GrTexDownloadProcVector[2][4];
extern void FX_CALL _grTexDownload_Default_8_1(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
extern void FX_CALL _grTexDownload_Default_8_1(struct GrGC_s* gc, const unsigned long tmuBaseAddr,
const FxU32 maxS, const FxU32 minT, const FxU32 maxT,
void* texData);
extern void FX_CALL _grTexDownload_Default_8_2(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
extern void FX_CALL _grTexDownload_Default_8_2(struct GrGC_s* gc, const unsigned long tmuBaseAddr,
const FxU32 maxS, const FxU32 minT, const FxU32 maxT,
void* texData);
extern void FX_CALL _grTexDownload_Default_8_4(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
extern void FX_CALL _grTexDownload_Default_8_4(struct GrGC_s* gc, const unsigned long tmuBaseAddr,
const FxU32 maxS, const FxU32 minT, const FxU32 maxT,
void* texData);
extern void FX_CALL _grTexDownload_Default_8_WideS(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
extern void FX_CALL _grTexDownload_Default_8_WideS(struct GrGC_s* gc, const unsigned long tmuBaseAddr,
const FxU32 maxS, const FxU32 minT, const FxU32 maxT,
void* texData);
extern void FX_CALL _grTexDownload_Default_16_1(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
extern void FX_CALL _grTexDownload_Default_16_1(struct GrGC_s* gc, const unsigned long tmuBaseAddr,
const FxU32 maxS, const FxU32 minT, const FxU32 maxT,
void* texData);
extern void FX_CALL _grTexDownload_Default_16_2(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
extern void FX_CALL _grTexDownload_Default_16_2(struct GrGC_s* gc, const unsigned long tmuBaseAddr,
const FxU32 maxS, const FxU32 minT, const FxU32 maxT,
void* texData);
extern void FX_CALL _grTexDownload_Default_16_4(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
extern void FX_CALL _grTexDownload_Default_16_4(struct GrGC_s* gc, const unsigned long tmuBaseAddr,
const FxU32 maxS, const FxU32 minT, const FxU32 maxT,
void* texData);
extern void FX_CALL _grTexDownload_Default_16_WideS(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
extern void FX_CALL _grTexDownload_Default_16_WideS(struct GrGC_s* gc, const unsigned long tmuBaseAddr,
const FxU32 maxS, const FxU32 minT, const FxU32 maxT,
void* texData);
#if GL_AMD3D
/* xtexdl.asm */
extern void FX_CALL _grTexDownload_3DNow_MMX(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
extern void FX_CALL _grTexDownload_3DNow_MMX(struct GrGC_s* gc, const unsigned long tmuBaseAddr,
const FxU32 maxS, const FxU32 minT, const FxU32 maxT,
void* texData);
#endif /* GL_AMD3D */
#if GL_MMX
/* xtexdl.asm */
extern void FX_CALL _grTexDownload_MMX(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
extern void FX_CALL _grTexDownload_MMX(struct GrGC_s* gc, const unsigned long tmuBaseAddr,
const FxU32 maxS, const FxU32 minT, const FxU32 maxT,
void* texData);
#endif /* GL_MMX */
@@ -1164,7 +1165,7 @@ typedef struct GrGC_s
FxU32 fifoJmpHdr; /* Type0 packet for jmp to fifo start */
FxU32* fifoPtr; /* Current write pointer into fifo */
FxU32 fifoRead; /* Last known hw read ptr.
unsigned long fifoRead; /* Last known hw read ptr.
* This is the sli master, if enabled.
*/
@@ -1223,7 +1224,7 @@ typedef struct GrGC_s
* FixMe: Will this ever happen?
*/
FxU32 yTileShift; /* (0x01UL << yTileShift) is the # of lines in a
FxU32 yTileShift; /* (0x01U << yTileShift) is the # of lines in a
* tile. This is dependent on the sli-ness of the
* board.
*/
@@ -1263,7 +1264,7 @@ typedef struct GrGC_s
} hwDep;
/* lfb config */
FxU32 lockPtrs[2]; /* pointers to locked buffers */
unsigned long lockPtrs[2]; /* pointers to locked buffers */
FxU32 fbStride;
struct {
@@ -1302,7 +1303,7 @@ typedef struct GrGC_s
FxI32 expected_counter; /* the number of bytes expected to be sent */
FxU32 checkCounter;
FxU32 checkPtr;
unsigned long checkPtr;
FxVideoTimingInfo* vidTimings;/* init code overrides */
@@ -1375,15 +1376,15 @@ struct _GlideRoot_s {
#define kPackBiasG _GlideRoot.pool.fBiasHi
#define kPackBiasB _GlideRoot.pool.fBiasLo
#define kPackShiftA 16UL
#define kPackShiftR 8UL
#define kPackShiftG 0UL
#define kPackShiftB 0UL
#define kPackShiftA 16U
#define kPackShiftR 8U
#define kPackShiftG 0U
#define kPackShiftB 0U
#define kPackMaskA 0x00FF00UL
#define kPackMaskR 0x00FF00UL
#define kPackMaskG 0x00FF00UL
#define kPackMaskB 0x00FFUL
#define kPackMaskA 0x00FF00U
#define kPackMaskR 0x00FF00U
#define kPackMaskG 0x00FF00U
#define kPackMaskB 0x00FFU
float fBiasHi;
float fBiasLo;
@@ -1900,14 +1901,14 @@ _grGetCommandTransportInfo(GrCmdTransportInfo*);
*/
#if (GLIDE_PLATFORM & GLIDE_HW_CVG)
#define HW_FIFO_PTR(__masterP)\
((FxU32)gc->cmdTransportInfo.fifoStart + \
((unsigned long)gc->cmdTransportInfo.fifoStart + \
(GET(((SstRegs*)((__masterP) \
? gc->reg_ptr \
: gc->slave_ptr))->cmdFifoReadPtr) - \
gc->cmdTransportInfo.fifoOffset))
#elif (GLIDE_PLATFORM & GLIDE_HW_H3)
# define HW_FIFO_PTR(__masterP) \
((FxU32)gc->cmdTransportInfo.fifoStart +\
((unsigned long)gc->cmdTransportInfo.fifoStart +\
(GET(((SstCRegs*)(gc->hwDep.h3Dep.cRegs))->cmdFifo0.readPtrL)) - \
gc->cmdTransportInfo.fifoOffset)
#else
@@ -1923,9 +1924,9 @@ if ((gFifoCheckCount++ & kFifoCheckMask) == 0) { \
const FxU32 cmdFifoDepth = GR_GET(((SstRegs*)(gc->reg_ptr))->cmdFifoDepth); \
const FxU32 maxFifoDepth = ((gc->cmdTransportInfo.fifoSize - FIFO_END_ADJUST) >> 2); \
if(cmdFifoDepth > maxFifoDepth) { \
gdbg_printf(__FILE__"(%ld): cmdFifoDepth > size: 0x%X : 0x%X : (0x%X : 0x%X)\n", \
gdbg_printf(__FILE__"(%ld): cmdFifoDepth > size: 0x%X : 0x%X : (0x%lX : 0x%lX)\n", \
__LINE__, cmdFifoDepth, maxFifoDepth, \
HW_FIFO_PTR(FXTRUE), gc->cmdTransportInfo.fifoPtr); \
HW_FIFO_PTR(FXTRUE), (unsigned long)gc->cmdTransportInfo.fifoPtr); \
ASSERT_FAULT_IMMED(cmdFifoDepth <= maxFifoDepth); \
} else if (cmdFifoDepth + (gc->cmdTransportInfo.fifoRoom >> 2) > maxFifoDepth) { \
gdbg_printf(__FILE__"(%ld): cmdFifoDepth + fifoRoom > size: (0x%X : 0x%X) : 0x%X\n", \
@@ -1933,14 +1934,14 @@ if ((gFifoCheckCount++ & kFifoCheckMask) == 0) { \
ASSERT_FAULT_IMMED(cmdFifoDepth + (gc->cmdTransportInfo.fifoRoom >> 2) <= maxFifoDepth); \
} \
} \
ASSERT_FAULT_IMMED(HW_FIFO_PTR(FXTRUE) >= (FxU32)gc->cmdTransportInfo.fifoStart); \
ASSERT_FAULT_IMMED(HW_FIFO_PTR(FXTRUE) < (FxU32)gc->cmdTransportInfo.fifoEnd); \
ASSERT_FAULT_IMMED(HW_FIFO_PTR(FXTRUE) >= (unsigned long)gc->cmdTransportInfo.fifoStart); \
ASSERT_FAULT_IMMED(HW_FIFO_PTR(FXTRUE) < (unsigned long)gc->cmdTransportInfo.fifoEnd); \
ASSERT_FAULT_IMMED((FxU32)gc->cmdTransportInfo.fifoRoom < gc->cmdTransportInfo.fifoSize); \
ASSERT_FAULT_IMMED((FxU32)gc->cmdTransportInfo.fifoPtr < (FxU32)gc->cmdTransportInfo.fifoEnd)
ASSERT_FAULT_IMMED((unsigned long)gc->cmdTransportInfo.fifoPtr < (unsigned long)gc->cmdTransportInfo.fifoEnd)
#else /* !FIFO_ASSERT_FULL */
#define FIFO_ASSERT() \
ASSERT_FAULT_IMMED((FxU32)gc->cmdTransportInfo.fifoRoom < gc->cmdTransportInfo.fifoSize); \
ASSERT_FAULT_IMMED((FxU32)gc->cmdTransportInfo.fifoPtr < (FxU32)gc->cmdTransportInfo.fifoEnd)
ASSERT_FAULT_IMMED((unsigned long)gc->cmdTransportInfo.fifoPtr < (unsigned long)gc->cmdTransportInfo.fifoEnd)
#endif /* !FIFO_ASSERT_FULL */
void GR_CDECL
@@ -1949,7 +1950,7 @@ _FifoMakeRoom(const FxI32 blockSize, const char* fName, const int fLine);
#define GR_CHECK_FOR_ROOM(__n, __p) \
do { \
const FxU32 writeSize = (__n) + ((__p) * sizeof(FxU32)); /* Adjust for size of hdrs */ \
ASSERT(((FxU32)(gc->cmdTransportInfo.fifoPtr) & FIFO_ALIGN_MASK) == 0); /* alignment */ \
ASSERT(((unsigned long)(gc->cmdTransportInfo.fifoPtr) & FIFO_ALIGN_MASK) == 0); /* alignment */ \
ASSERT(writeSize < gc->cmdTransportInfo.fifoSize - sizeof(FxU32)); \
FIFO_ASSERT(); \
if (gc->cmdTransportInfo.fifoRoom < (FxI32)writeSize) { \
@@ -1976,23 +1977,23 @@ do { \
#if GLIDE_USE_SHADOW_FIFO
#define GR_CHECK_SHADOW_FIFO \
if ((gc != NULL) && (gc->cmdTransportInfo.fifoShadowPtr != NULL)) \
ASSERT_FAULT_IMMED((((FxU32)gc->cmdTransportInfo.fifoPtr) & (kDebugFifoSize - 1)) == \
(((FxU32)gc->cmdTransportInfo.fifoShadowPtr) & (kDebugFifoSize - 1)))
ASSERT_FAULT_IMMED((((unsigned long)gc->cmdTransportInfo.fifoPtr) & (kDebugFifoSize - 1)) == \
(((unsigned long)gc->cmdTransportInfo.fifoShadowPtr) & (kDebugFifoSize - 1)))
#else /* !GLIDE_USE_SHADOW_FIFO */
#define GR_CHECK_SHADOW_FIFO
#endif /* !GLIDE_USE_SHADOW_FIFO */
#define GR_CHECK_FIFO_PTR() \
if((FxU32)gc->cmdTransportInfo.fifoPtr != gc->checkPtr + gc->checkCounter) \
if((unsigned long)gc->cmdTransportInfo.fifoPtr != (gc->checkPtr + gc->checkCounter)) \
GDBG_ERROR("GR_ASSERT_FIFO", "(%s : %d) : " \
"fifoPtr should be 0x%X (0x%X : 0x%X) but is 0x%X\n", \
"fifoPtr should be 0x%lX (0x%lX : 0x%X) but is 0x%lX\n", \
__FILE__, __LINE__, \
gc->checkPtr + gc->checkCounter, gc->checkPtr, gc->checkCounter, \
gc->cmdTransportInfo.fifoPtr); \
(unsigned long)gc->cmdTransportInfo.fifoPtr); \
GR_CHECK_SHADOW_FIFO; \
ASSERT_FAULT_IMMED((FxU32)gc->cmdTransportInfo.fifoPtr == gc->checkPtr + gc->checkCounter)
#define GR_SET_FIFO_PTR(__n, __p) \
gc->checkPtr = (FxU32)gc->cmdTransportInfo.fifoPtr; \
gc->checkPtr = (unsigned long)gc->cmdTransportInfo.fifoPtr; \
gc->checkCounter = ((__n) + ((__p) << 2))
#else
#define GR_CHECK_FIFO_PTR()
@@ -2004,7 +2005,7 @@ do { \
GDBG_ERROR("GR_ASSERT_SIZE","byte counter should be %d but is %d\n", \
gc->expected_counter,gc->counter); \
GR_CHECK_FIFO_PTR(); \
gc->checkPtr = (FxU32)gc->cmdTransportInfo.fifoPtr; \
gc->checkPtr = (unsigned long)gc->cmdTransportInfo.fifoPtr; \
gc->checkCounter = 0; \
ASSERT(gc->counter == gc->expected_counter); \
gc->counter = gc->expected_counter = 0
@@ -2038,7 +2039,7 @@ do { \
GR_ASSERT(gc != NULL); \
GR_ASSERT(hw != NULL); \
gc->myLevel = level; \
gc->checkPtr = (FxU32)gc->cmdTransportInfo.fifoPtr; \
gc->checkPtr = (unsigned long)gc->cmdTransportInfo.fifoPtr; \
GDBG_INFO(gc->myLevel,myName); \
FXUNUSED(saveLevel); \
FXUNUSED(hw)
@@ -2076,7 +2077,11 @@ do { \
#if defined(GLIDE_SANITY_ASSERT)
#define GR_ASSERT(exp) ((void)((!(exp)) ? (_grAssert(#exp, __FILE__, __LINE__),0) : 0xFFFFFFFF))
#else
#define GR_ASSERT(exp) ((void)(0 && ((FxU32)(exp))))
# ifdef __GNUC__
# define GR_ASSERT(exp) ((void) 0)
# else
# define GR_ASSERT(exp) ((void)(0 && ((FxU32)(exp))))
# endif
#endif
#define INTERNAL_CHECK(__name, __cond, __msg, __fatalP) \
@@ -2105,12 +2110,12 @@ _grAssert(char *, char *, int);
#if USE_PACKET_FIFO
#ifdef GDBG_INFO_ON
void _grFifoWriteDebug(FxU32 addr, FxU32 val, FxU32 fifoPtr);
void _grFifoWriteDebug(FxU32 addr, FxU32 val, unsigned long fifoPtr);
#define DEBUGFIFOWRITE(a,b,c) \
_grFifoWriteDebug((FxU32) a, (FxU32) b, (FxU32) c)
void _grFifoFWriteDebug(FxU32 addr, float val, FxU32 fifoPtr);
_grFifoWriteDebug((FxU32) (a), (FxU32) (b), (unsigned long) (c))
void _grFifoFWriteDebug(FxU32 addr, float val, unsigned long fifoPtr);
#define DEBUGFIFOFWRITE(a,b,c) \
_grFifoFWriteDebug((FxU32) a, (float) b, (FxU32) c)
_grFifoFWriteDebug((FxU32) (a), (float) (b), (unsigned long) (c))
#else /* ~GDBG_INFO_ON */
#define DEBUGFIFOWRITE(a,b,c)
#define DEBUGFIFOFWRITE(a,b,c)
@@ -2166,8 +2171,8 @@ do { \
__stwbrx( *((FxU32*)&temp), (void*)&(d), 0 ); \
}
#define SET_LINEAR(d, s) SET((d), (s))
#define SET_LINEAR_16(d, s) SET((d), ((((FxU32)(s)) >> 16UL) | \
(((FxU32)(s)) << 16UL)))
#define SET_LINEAR_16(d, s) SET((d), ((((FxU32)(s)) >> 16U) | \
(((FxU32)(s)) << 16U)))
#define SET_LINEAR_8(d, s) ((d) = (s))
#else /* !defined(__MWERKS__) && POWERPC */
#error "Define byte swapped macros for GET/SET"
@@ -2175,7 +2180,7 @@ do { \
#endif /* SET_BSWAP */
#if GLIDE_USE_DEBUG_FIFO
#define kDebugFifoSize 0x1000UL
#define kDebugFifoSize 0x1000U
#endif /* GLIDE_USE_DEBUG_FIFO */
#ifndef SET_LINEAR
@@ -2188,9 +2193,9 @@ do { \
* NB: The value passed to this macro must be convertable
* into an l-value.
*/
#define kFPExpMask 0x7F800000UL
#define kFPZeroMask 0x80000000UL
#define kFPExpShift 0x17UL
#define kFPExpMask 0x7F800000U
#define kFPZeroMask 0x80000000U
#define kFPExpShift 0x17U
#define FP_FLOAT_EXP(__fpVal) ((FxU32)(((*(const FxU32*)(&(__fpVal))) & kFPExpMask) >> kFPExpShift))
#define FP_FLOAT_ZERO(__fpVal) (((*(const FxU32*)(&(__fpVal))) & ~kFPZeroMask) == 0x00)
@@ -2204,17 +2209,17 @@ do { \
* NB: This requires that the boolean value being passed in be the
* result of one of the standard relational operators.
*/
#define MaskSelect(__b, __val) (~(((FxU32)(__b)) - 1UL) & (__val))
#define MaskSelect(__b, __val) (~(((FxU32)(__b)) - 1U) & (__val))
/* Chipfield ids that glide uses. */
#define kChipFieldShift (8UL + 3UL)
#define kChipFieldShift (8U + 3U)
typedef enum {
eChipBroadcast = 0x00UL,
eChipFBI = 0x01UL,
eChipTMU0 = 0x02UL,
eChipTMU1 = 0x04UL,
eChipTMU2 = 0x08UL,
eChipAltBroadcast = 0x0FUL,
eChipBroadcast = 0x00U,
eChipFBI = 0x01U,
eChipTMU0 = 0x02U,
eChipTMU1 = 0x04U,
eChipTMU2 = 0x08U,
eChipAltBroadcast = 0x0FU,
} FifoChipField;
#if GLIDE_CHIP_BROADCAST && (GLIDE_PLATFORM & GLIDE_HW_CVG)
@@ -2239,7 +2244,7 @@ FxU32 _regBase = offsetof(SstRegs, __regBase)
{ \
const FxU32 curRegAddr = offsetof(SstRegs, __regAddr); \
const FxU32 curRegIndex = (curRegAddr - _regBase) >> 2; \
const FxU32 curRegBit = (0x01UL << curRegIndex); \
const FxU32 curRegBit = (0x01U << curRegIndex); \
const float floatVal = (const float)(__val); \
GDBG_INFO(gc->myLevel + 200, "\t(0x%X : 0x%X) : 0x%X\n", \
curRegIndex, curRegAddr, *(const FxU32*)&floatVal); \
@@ -2251,7 +2256,7 @@ FxU32 _regBase = offsetof(SstRegs, __regBase)
"Called within grLfbLock/grLfbUnlockPair"); \
GR_ASSERT((_regMask & curRegBit) == curRegBit); /* reg allocated in mask */ \
if (curRegIndex > 0) \
GR_ASSERT(((0xFFFFFFFFUL >> (32 - curRegIndex)) & _regCheckMask) == 0x00); /* All previous regs done */ \
GR_ASSERT(((0xFFFFFFFFU >> (32 - curRegIndex)) & _regCheckMask) == 0x00); /* All previous regs done */ \
_regCheckMask ^= curRegBit; /* Mark current reg */ \
}
#else /* !GDBG_INFO_ON */
@@ -2337,12 +2342,12 @@ REG_GROUP_BEGIN_INTERNAL(__chipId, __regBase, __groupNum, \
GR_DCL_GC; \
volatile FxU32* _regGroupFifoPtr = gc->cmdTransportInfo.fifoPtr; \
REG_GROUP_DCL(__groupMask, __regBase, __groupNum, __checkP); \
GR_ASSERT(((__pktHdr) & 0xE0000000UL) == 0x00UL); \
GR_ASSERT(((__pktHdr) & 0xE0000000U) == 0x00U); \
FIFO_ASSERT(); \
GDBG_INFO(120, "REG_GROUP_BEGIN: (0x%X : 0x%X) : (0x%X - 0x%X : 0x%X) : (0x%X : 0x%X)\n", \
GDBG_INFO(120, "REG_GROUP_BEGIN: (0x%X : 0x%X) : (0x%X - 0x%X : 0x%X) : (0x%lX : 0x%X)\n", \
(__pktHdr), (__groupMask), \
FIFO_REG(__chipId, __regBase), __chipId, offsetof(SstRegs, __regBase), \
(FxU32)gc->cmdTransportInfo.fifoPtr, gc->cmdTransportInfo.fifoRoom); \
(unsigned long)gc->cmdTransportInfo.fifoPtr, gc->cmdTransportInfo.fifoRoom); \
SET(*_regGroupFifoPtr++, (__pktHdr))
#define REG_GROUP_SET(__regBase, __regAddr, __val) \
@@ -2377,20 +2382,20 @@ do { \
#define REG_GROUP_NO_CHECK_END() \
ASSERT(!_checkP); \
ASSERT((((FxU32)_regGroupFifoPtr - (FxU32)gc->cmdTransportInfo.fifoPtr) >> 2) == _groupNum + 1); \
gc->cmdTransportInfo.fifoRoom -= ((FxU32)_regGroupFifoPtr - (FxU32)gc->cmdTransportInfo.fifoPtr); \
ASSERT((((unsigned long)_regGroupFifoPtr - (unsigned long)gc->cmdTransportInfo.fifoPtr) >> 2) == _groupNum + 1); \
gc->cmdTransportInfo.fifoRoom -= ((unsigned long)_regGroupFifoPtr - (unsigned long)gc->cmdTransportInfo.fifoPtr); \
gc->cmdTransportInfo.fifoPtr = (FxU32*)_regGroupFifoPtr; \
FIFO_ASSERT(); \
}
#define REG_GROUP_END() \
ASSERT(_checkP); \
ASSERT((((FxU32)_regGroupFifoPtr - (FxU32)gc->cmdTransportInfo.fifoPtr) >> 2) == _groupNum + 1); \
gc->cmdTransportInfo.fifoRoom -= ((FxU32)_regGroupFifoPtr - (FxU32)gc->cmdTransportInfo.fifoPtr); \
ASSERT((((unsigned long)_regGroupFifoPtr - (unsigned long)gc->cmdTransportInfo.fifoPtr) >> 2) == _groupNum + 1); \
gc->cmdTransportInfo.fifoRoom -= ((unsigned long)_regGroupFifoPtr - (unsigned long)gc->cmdTransportInfo.fifoPtr); \
gc->cmdTransportInfo.fifoPtr = (FxU32*)_regGroupFifoPtr; \
GDBG_INFO(gc->myLevel + 200, "\tGroupEnd: (0x%X : 0x%X) : (0x%X : 0x%X)\n", \
_regGroupFifoPtr, gc->cmdTransportInfo.fifoRoom, \
HW_FIFO_PTR(FXTRUE), gc->cmdTransportInfo.fifoPtr); \
GDBG_INFO(gc->myLevel + 200, "\tGroupEnd: (0x%lX : 0x%X) : (0x%lX : 0x%lX)\n", \
(unsigned long)_regGroupFifoPtr, gc->cmdTransportInfo.fifoRoom, \
HW_FIFO_PTR(FXTRUE), (unsigned long)gc->cmdTransportInfo.fifoPtr); \
FIFO_ASSERT(); \
} \
GR_CHECK_SIZE()
@@ -2399,7 +2404,7 @@ GR_CHECK_SIZE()
/* Send all of the triangle parameters in a single cmd fifo packet to
* the chip until the tsu is fixed.
*/
#define kNumTriParam 0x1FUL
#define kNumTriParam 0x1FU
#define TRI_NO_TSU_BEGIN(__floatP) \
GR_CHECK_COMPATABILITY(FN_NAME, \
@@ -2444,8 +2449,8 @@ do { \
} while(0)
#define TRI_NO_TSU_END() \
gc->cmdTransportInfo.fifoRoom -= ((FxU32)noTsuFifoPtr - \
(FxU32)gc->cmdTransportInfo.fifoPtr); \
gc->cmdTransportInfo.fifoRoom -= ((unsigned long)noTsuFifoPtr - \
(unsigned long)gc->cmdTransportInfo.fifoPtr); \
gc->cmdTransportInfo.fifoPtr = noTsuFifoPtr; \
FIFO_ASSERT(); \
}
@@ -2641,41 +2646,41 @@ _grCVGFifoDump_Linear(const FxU32* const linearPacketAddr);
GR_CHECK_COMPATABILITY(FN_NAME, \
(gc->cmdTransportInfo.lfbLockCount != 0), \
"Called within grLfbLock/grLfbUnlockPair"); \
GR_ASSERT(((FxU32)(tPackPtr) & FIFO_ALIGN_MASK) == 0); /* alignment */ \
GR_ASSERT(((unsigned long)(tPackPtr) & FIFO_ALIGN_MASK) == 0); /* alignment */ \
GR_ASSERT((((__nVerts) * (__vertSize)) + sizeof(FxU32)) <= (FxU32)gc->cmdTransportInfo.fifoRoom); \
GR_ASSERT((((FxU32)tPackPtr) + ((__nVerts) * (__vertSize)) + sizeof(FxU32)) < \
(FxU32)gc->cmdTransportInfo.fifoEnd); \
GR_ASSERT((((unsigned long)tPackPtr) + ((__nVerts) * (__vertSize)) + sizeof(FxU32)) < \
(unsigned long)gc->cmdTransportInfo.fifoEnd); \
GR_ASSERT(nVertex < 0x10); \
GR_ASSERT(nVertex > 0x00); \
GR_ASSERT(((__packetHdr) & 0xE0000000UL) == 0x00UL); \
GR_ASSERT(((__packetHdr) & 0xE0000000U) == 0x00U); \
FIFO_ASSERT(); \
GDBG_INFO(120, "Triangle(0x%X): (0x%X : 0x%X)\n", (__packetHdr), __nVerts, __vertSize); \
DEBUGFIFODUMP_TRI(__packetHdr)
#define CLAMP_DUMP(__val, __floatVal) \
pCount++; \
GDBG_INFO(gc->myLevel + 200, "\t(0x%X) : V#: 0x%X - P#: 0x%X - ParamVal: (%f : 0x%X)\n", \
(FxU32)tPackPtr, \
((FxU32)tPackPtr - ((FxU32)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) / sVertex, \
(((FxU32)tPackPtr - ((FxU32)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) % sVertex) >> 2, \
GDBG_INFO(gc->myLevel + 200, "\t(0x%lX) : V#: 0x%lX - P#: 0x%lX - ParamVal: (%f : 0x%X)\n", \
(unsigned long)tPackPtr, \
((unsigned long)tPackPtr - ((unsigned long)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) / sVertex, \
(((unsigned long)tPackPtr - ((unsigned long)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) % sVertex) >> 2, \
(((__val) < 786432.875) ? (__val) : ((__val) - 786432.875)), \
(__floatVal))
#define SETF_DUMP(__val) \
pCount++; \
GDBG_INFO(gc->myLevel + 200, "\t(0x%X) : V#: 0x%X - P#: 0x%X - ParamVal: %f\n", \
(FxU32)tPackPtr, \
((FxU32)tPackPtr - ((FxU32)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) / sVertex, \
(((FxU32)tPackPtr - ((FxU32)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) % sVertex) >> 2, \
GDBG_INFO(gc->myLevel + 200, "\t(0x%lX) : V#: 0x%lX - P#: 0x%lX - ParamVal: %f\n", \
(unsigned long)tPackPtr, \
((unsigned long)tPackPtr - ((unsigned long)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) / sVertex, \
(((unsigned long)tPackPtr - ((unsigned long)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) % sVertex) >> 2, \
(((__val) < 786432.875) ? (__val) : ((__val) - 786432.875)))
#define SET_DUMP(__val) \
pCount++; \
GDBG_INFO(gc->myLevel + 200, "\t(0x%X) : V#: 0x%X - P#: 0x%X - ParamVal: 0x%X\n", \
(FxU32)tPackPtr, \
((FxU32)tPackPtr - ((FxU32)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) / sVertex, \
(((FxU32)tPackPtr - ((FxU32)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) % sVertex) >> 2, \
GDBG_INFO(gc->myLevel + 200, "\t(0x%lX) : V#: 0x%lX - P#: 0x%lX - ParamVal: 0x%X\n", \
(unsigned long)tPackPtr, \
((unsigned long)tPackPtr - ((unsigned long)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) / sVertex, \
(((unsigned long)tPackPtr - ((unsigned long)gc->cmdTransportInfo.fifoPtr + sizeof(FxU32))) % sVertex) >> 2, \
(__val))
#define TRI_ASSERT() \
GR_ASSERT(pCount == (nVertex * (sVertex >> 2))); \
ASSERT(((FxU32)tPackPtr - (FxU32)gc->cmdTransportInfo.fifoPtr) == (nVertex * sVertex) + sizeof(FxU32))
ASSERT(((unsigned long)tPackPtr - (unsigned long)gc->cmdTransportInfo.fifoPtr) == (nVertex * sVertex) + sizeof(FxU32))
#else /* !GDBG_INFO_ON */
#define DEBUGFIFODUMP_TRI(__packetAddr)
#define DEBUGFIFODUMP_LINEAR(__packetAddr)
@@ -2707,9 +2712,9 @@ _grCVGFifoDump_Linear(const FxU32* const linearPacketAddr);
* Mmm..... sequence operator.
*/
#if GLIDE_FP_CLAMP
#define kFPClampThreshold 0x20UL
#define kFPClampThreshold 0x20U
#define FP_FLOAT_CLAMP(__fpVal) ((FP_FLOAT_EXP(__fpVal) < kFPClampThreshold) \
? (_GlideRoot.stats.tsuValClamp++, 0x00UL) \
? (_GlideRoot.stats.tsuValClamp++, 0x00U) \
: *(const FxU32*)(&(__fpVal)))
#define TRI_SETF_CLAMP(__val) \
@@ -2740,9 +2745,9 @@ do { \
#define TRI_END \
TRI_ASSERT(); \
gc->cmdTransportInfo.fifoRoom -= ((FxU32)tPackPtr - (FxU32)gc->cmdTransportInfo.fifoPtr); \
gc->cmdTransportInfo.fifoRoom -= ((unsigned long)tPackPtr - (unsigned long)gc->cmdTransportInfo.fifoPtr); \
gc->cmdTransportInfo.fifoPtr = tPackPtr; \
GDBG_INFO(gc->myLevel + 200, "\tTriEnd: (0x%X : 0x%X)\n", tPackPtr, gc->cmdTransportInfo.fifoRoom); \
GDBG_INFO(gc->myLevel + 200, "\tTriEnd: (0x%lX : 0x%X)\n", (unsigned long)tPackPtr, gc->cmdTransportInfo.fifoRoom); \
FIFO_ASSERT(); \
}
@@ -2755,27 +2760,27 @@ do { \
(((FxU32)(__maskWN)) << SSTCP_PKT5_BYTEN_WN_SHIFT) | \
(__writeSize << SSTCP_PKT5_NWORDS_SHIFT) | \
SSTCP_PKT5); \
const FxU32 hdr2 = ((FxU32)(__addr)) & SSTCP_PKT5_BASEADDR; \
const FxU32 hdr2 = ((FxU32)((unsigned long)(__addr))) & SSTCP_PKT5_BASEADDR; \
GR_CHECK_COMPATABILITY(FN_NAME, \
!gc->open, \
"Called before grSstWinOpen()"); \
GR_CHECK_COMPATABILITY(FN_NAME, \
(gc->cmdTransportInfo.lfbLockCount != 0), \
"Called within grLfbLock/grLfbUnlockPair"); \
GR_ASSERT(((FxU32)(packetPtr) & FIFO_ALIGN_MASK) == 0); /* alignment */ \
GR_ASSERT(((unsigned long)(packetPtr) & FIFO_ALIGN_MASK) == 0); /* alignment */ \
GR_ASSERT((__numWords) > 0); /* packet size */ \
GR_ASSERT((__numWords) < ((0x01 << 19) - 2)); \
GR_ASSERT((((__numWords) + 2) << 2) <= (FxU32)gc->cmdTransportInfo.fifoRoom); \
GR_ASSERT(((FxU32)packetPtr + (((__numWords) + 2) << 2)) < \
(FxU32)gc->cmdTransportInfo.fifoEnd); \
GR_ASSERT((hdr2 & 0xE0000000UL) == 0x00UL); \
GR_ASSERT(((unsigned long)packetPtr + (((__numWords) + 2) << 2)) < \
(unsigned long)gc->cmdTransportInfo.fifoEnd); \
GR_ASSERT((hdr2 & 0xE0000000U) == 0x00U); \
GR_ASSERT((((FxU32)(__type)) >= ((FxU32)kLinearWriteLFB)) && /* packet type */ \
(((FxU32)(__type)) <= ((FxU32)kLinearWriteTex))); \
FIFO_ASSERT(); \
GDBG_INFO(120, "LinearWrite(0x%X : 0x%X)\n", hdr1, hdr2); \
GDBG_INFO(gc->myLevel + 200, "\tFile: %s - Line: %ld\n", __f, __l); \
GDBG_INFO(gc->myLevel + 200, "\tType: 0x%X\n", (FxU32)(__type)); \
GDBG_INFO(gc->myLevel + 200, "\tAddr: 0x%X\n", (FxU32)(__addr)); \
GDBG_INFO(gc->myLevel + 200, "\tAddr: 0x%X\n", (FxU32)((unsigned long)(__addr))); \
GDBG_INFO(gc->myLevel + 200, "\tMaskW2: 0x%X\n", (FxU32)(__maskW2)); \
GDBG_INFO(gc->myLevel + 200, "\tMaskWN: 0x%X\n", (FxU32)(__maskWN)); \
GDBG_INFO(gc->myLevel + 200, "\twriteSize: 0x%X\n", __writeSize); \
@@ -2787,32 +2792,32 @@ do { \
#define FIFO_LINEAR_WRITE_SET(__val) \
do { \
GDBG_INFO(gc->myLevel + 205, "\t0x%X : 0x%X\n", packetPtr, (__val)); \
GDBG_INFO(gc->myLevel + 205, "\t0x%lX : 0x%X\n", (unsigned long)packetPtr, (__val)); \
SET_LINEAR(*packetPtr++, (__val)); \
GR_INC_SIZE(sizeof(FxU32)); \
} while(0)
#define FIFO_LINEAR_WRITE_SET_16(__val) \
do { \
GDBG_INFO(gc->myLevel + 205, "\t0x%X : 0x%X\n", packetPtr, (__val)); \
GDBG_INFO(gc->myLevel + 205, "\t0x%lX : 0x%X\n", (unsigned long)packetPtr, (__val)); \
SET_LINEAR_16(*packetPtr++, (__val)); \
GR_INC_SIZE(sizeof(FxU32)); \
} while(0)
#define FIFO_LINEAR_WRITE_SET_8(__val) \
do { \
GDBG_INFO(gc->myLevel + 205, "\t0x%X : 0x%X\n", packetPtr, (__val)); \
GDBG_INFO(gc->myLevel + 205, "\t0x%lX : 0x%X\n", (unsigned long)packetPtr, (__val)); \
SET_LINEAR_8(*packetPtr++, (__val)); \
GR_INC_SIZE(sizeof(FxU32)); \
} while(0)
#define FIFO_LINEAR_WRITE_END \
DEBUGFIFODUMP_LINEAR(gc->cmdTransportInfo.fifoPtr); \
GR_ASSERT((((FxU32)packetPtr - (FxU32)gc->cmdTransportInfo.fifoPtr) >> 2) == __writeSize + 2); \
gc->cmdTransportInfo.fifoRoom -= ((FxU32)packetPtr - (FxU32)gc->cmdTransportInfo.fifoPtr); \
GR_ASSERT((((unsigned long)packetPtr - (unsigned long)gc->cmdTransportInfo.fifoPtr) >> 2) == __writeSize + 2); \
gc->cmdTransportInfo.fifoRoom -= ((unsigned long)packetPtr - (unsigned long)gc->cmdTransportInfo.fifoPtr); \
gc->cmdTransportInfo.fifoPtr = packetPtr; \
GDBG_INFO(gc->myLevel + 200, "\tLinearEnd: (0x%X : 0x%X)\n", \
packetPtr, gc->cmdTransportInfo.fifoRoom); \
GDBG_INFO(gc->myLevel + 200, "\tLinearEnd: (0x%lX : 0x%X)\n", \
(unsigned long)packetPtr, gc->cmdTransportInfo.fifoRoom); \
FIFO_ASSERT(); \
}
@@ -2876,7 +2881,7 @@ enum {
#define LINEAR_WRITE_BEGIN(__numWords, __type, __addr, __maskW2, __maskWN) \
{ \
GR_SET_EXPECTED_SIZE(((FxU32)((__numWords) + 1UL) << 2UL), 1); \
GR_SET_EXPECTED_SIZE(((FxU32)((__numWords) + 1U) << 2U), 1); \
FIFO_LINEAR_WRITE_BEGIN(__numWords, __type, __addr, __maskW2, __maskWN, __FILE__, __LINE__)
#define LINEAR_WRITE_SET(__addr, __val) \
FIFO_LINEAR_WRITE_SET(__val)
@@ -2895,9 +2900,9 @@ enum {
* to mask of crap for the actual write.
*/
#if (GLIDE_PLATFORM & GLIDE_HW_CVG)
#define FIFO_LINEAR_EDGE_MASK_ADJUST(__mask) ((~(__mask)) & 0x0FUL)
#define FIFO_LINEAR_EDGE_SET(__val) FIFO_LINEAR_WRITE_SET((((__val) & 0xFFFF0000UL) >> 16UL) | \
(((__val) & 0x0000FFFFUL) << 16UL))
#define FIFO_LINEAR_EDGE_MASK_ADJUST(__mask) ((~(__mask)) & 0x0FU)
#define FIFO_LINEAR_EDGE_SET(__val) FIFO_LINEAR_WRITE_SET((((__val) & 0xFFFF0000U) >> 16U) | \
(((__val) & 0x0000FFFFU) << 16U))
#else
#define FIFO_LINEAR_EDGE_SET(__val) FIFO_LINEAR_WRITE_SET(__val)
#define FIFO_LINEAR_EDGE_MASK_ADJUST(__mask) (__mask)
@@ -2905,14 +2910,14 @@ enum {
#define LINEAR_WRITE_EDGE(__type, __addr, __val, __valBytes) \
do { \
const FxU32 edgeAddr = (FxU32)(((FxU32)__addr) & 0x03UL); \
const FxU32 edgeAddr = (FxU32)(((FxU32)((unsigned long)(__addr))) & 0x03U); \
GR_ASSERT((__valBytes) <= sizeof(FxU32)); \
GR_ASSERT((((FxU32)(__addr)) + (__valBytes)) <= ((((FxU32)(__addr)) & ~0x03UL) + sizeof(FxU32))); \
LINEAR_WRITE_BEGIN(1, __type, ((FxU32)__addr & ~0x03UL), \
FIFO_LINEAR_EDGE_MASK_ADJUST((0xF0UL | (0x0FUL >> (__valBytes))) >> edgeAddr), \
GR_ASSERT((((FxU32)(__addr)) + (__valBytes)) <= ((((FxU32)((unsigned long)(__addr))) & ~0x03U) + sizeof(FxU32))); \
LINEAR_WRITE_BEGIN(1, __type, ((FxU32)((unsigned long)(__addr)) & ~0x03U), \
FIFO_LINEAR_EDGE_MASK_ADJUST((0xF0U | (0x0FU >> (__valBytes))) >> edgeAddr), \
0x00); \
FIFO_LINEAR_EDGE_SET(((FxU32)(__val)) << (((sizeof(FxU32) - edgeAddr) << 3UL) - \
((__valBytes) << 3UL))); \
FIFO_LINEAR_EDGE_SET(((FxU32)(__val)) << (((sizeof(FxU32) - edgeAddr) << 3U) - \
((__valBytes) << 3U))); \
LINEAR_WRITE_END(); \
} while(0)
#else /* !USE_PACKET_FIFO */
@@ -3015,7 +3020,7 @@ GR_CHECK_SIZE()
/* Send all of the triangle parameters in a single cmd fifo packet to
* the chip until the tsu is fixed.
*/
#define kNumTriParam 0x1FUL
#define kNumTriParam 0x1FU
#define TRI_NO_TSU_BEGIN(__floatP) \
GR_CHECK_COMPATABILITY(FN_NAME, \
@@ -3063,7 +3068,7 @@ do { \
/* Offsets to 'virtual' addresses in the hw */
#if (GLIDE_PLATFORM & GLIDE_HW_CVG)
#define HW_REGISTER_OFFSET SST_3D_OFFSET
#define HW_FIFO_OFFSET 0x00200000UL
#define HW_FIFO_OFFSET 0x00200000U
#elif (GLIDE_PLATFORM & GLIDE_HW_H3)
#define HW_IO_REG_REMAP SST_IO_OFFSET
#define HW_CMD_AGP_OFFSET SST_CMDAGP_OFFSET
@@ -3074,7 +3079,7 @@ do { \
#error "Must define virtual address spaces for this hw"
#endif
#define HW_FIFO_OFFSET 0x00200000UL
#define HW_FIFO_OFFSET 0x00200000U
#define HW_LFB_OFFSET SST_LFB_OFFSET
#define HW_TEXTURE_OFFSET SST_TEX_OFFSET
@@ -3084,12 +3089,12 @@ do { \
#error "Need HW_BASE_PTR to convert hw address into board address."
#endif
#define HW_REG_PTR(__b) ((FxU32*)(((FxU32)(__b)) + HW_REGISTER_OFFSET))
#define HW_LFB_PTR(__b) ((FxU32*)(((FxU32)(__b)) + HW_LFB_OFFSET))
#define HW_TEX_PTR(__b) ((FxU32*)(((FxU32)(__b)) + HW_TEXTURE_OFFSET))
#define HW_REG_PTR(__b) ((FxU32*)(((unsigned long)(__b)) + HW_REGISTER_OFFSET))
#define HW_LFB_PTR(__b) ((FxU32*)(((unsigned long)(__b)) + HW_LFB_OFFSET))
#define HW_TEX_PTR(__b) ((FxU32*)(((unsigned long)(__b)) + HW_TEXTURE_OFFSET))
/* access a floating point array with a byte index */
#define FARRAY(p,i) (*(float *)((i)+(int)(p)))
#define FARRAY(p,i) (*(float *)((i)+(long)(p)))
#define ArraySize(__a) (sizeof(__a) / sizeof((__a)[0]))
void rle_decode_line_asm(FxU16 *tlut,FxU8 *src,FxU16 *dest);

View File

@@ -19,6 +19,9 @@
**
** $Header$
** $Log$
** Revision 1.1.1.1.8.4 2005/06/09 18:32:08 jwrdegoede
** Fixed all warnings with gcc4 -Wall -W -Wno-unused-parameter, except for a couple I believe to be a gcc bug. This has been reported to gcc.
**
** Revision 1.1.1.1.8.3 2004/10/04 09:17:16 dborca
** killed some warnings / compilation errors
**
@@ -725,7 +728,7 @@ static FxBool ReadDataLong(FILE *fp, FxU32 *data)
{
FxU8 byte[4];
if (fread(byte, 4, 1, fp) != 4)
if (fread(byte, 1, 4, fp) != 4)
return FXFALSE;
*data = (((FxU32) byte[0]) << 24) |

View File

@@ -19,6 +19,9 @@
**
** $Header$
** $Log$
** Revision 1.1.1.1.8.3 2005/06/09 18:32:08 jwrdegoede
** Fixed all warnings with gcc4 -Wall -W -Wno-unused-parameter, except for a couple I believe to be a gcc bug. This has been reported to gcc.
**
** Revision 1.1.1.1.8.2 2005/05/07 08:40:16 jwrdegoede
** lvalue cast fixes for gcc4
**
@@ -281,7 +284,7 @@ _grDrawTextureLine_Default(const void *a, const void *b)
** compute absolute deltas and draw from low Y to high Y
*/
ADY = FARRAY(b, 4) - FARRAY(a, 4);
i = *(long *)&ADY;
i = *(int *)&ADY;
if (i < 0) {
const void *tv;
tv = a; a = b; b = tv;
@@ -290,7 +293,7 @@ _grDrawTextureLine_Default(const void *a, const void *b)
}
DX = FARRAY(b, 0) - FARRAY(a, 0);
j = *(long *)&DX;
j = *(int *)&DX;
j &= 0x7fffffffL; /* abs(adx) */
/* check for zero-length lines */
@@ -437,6 +440,7 @@ GR_ENTRY(grAADrawTriangle,
FxU32
fbzMode, /* What we write to fbzMode */
fbzModeOld; /* Squirrel away current fbzMode */
float *vlist[3];
GR_BEGIN_NOFIFOCHECK(FN_NAME, 96);
GDBG_INFO_MORE(gc->myLevel,"(0x%x,0x%x,0x%x,%d,%d,%d)\n",
@@ -464,7 +468,11 @@ GR_ENTRY(grAADrawTriangle,
if ((gc->state.cull_mode != GR_CULL_DISABLE) && (((FxI32)(j.i ^ (gc->state.cull_mode << 31UL))) >= 0))
return;
}
(*gc->curArchProcs.drawTrianglesProc)(GR_VTX_PTR_ARRAY, 3, (void *)&a);
vlist[0] = (float *)a;
vlist[1] = (float *)b;
vlist[2] = (float *)c;
(*gc->curArchProcs.drawTrianglesProc)(GR_VTX_PTR_ARRAY, 3, (void *)vlist);
/* Disable depth buffer writes for edge triangles */
fbzMode = fbzModeOld;
@@ -542,7 +550,7 @@ _grAADrawPoints(FxI32 mode, FxI32 count, void *pointers)
float *e, ptX, ptY;
FxI32 i, ia;
FxU32 vsize;
FxI32 stride = mode;
FxI32 stride;
FxU32 tmp_cullStripHdr;
GDBG_INFO(94,"_grAADrawPoints(0x%x)\n",pointers);
@@ -550,8 +558,10 @@ _grAADrawPoints(FxI32 mode, FxI32 count, void *pointers)
GDBG_INFO_MORE(gc->myLevel, "(count = %d, pointers = 0x%x)\n",
count, pointers);
if (stride == 0)
if (mode == 0)
stride = gc->state.vData.vStride;
else
stride = sizeof(float *) / sizeof (float);
if (gc->state.vData.colorType == GR_FLOAT)
ia = gc->state.vData.aInfo.offset;
@@ -758,7 +768,7 @@ _grAADrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
FxU32 ia;
FxU32 vsize;
FxU32 sCount;
FxI32 stride = mode;
FxI32 stride;
FxU32 tmp_cullStripHdr;
GDBG_INFO(95,"_grAADrawLineStrip(count = %d, pointers = 0x%x)\n",
@@ -772,8 +782,11 @@ _grAADrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
ia = gc->state.vData.pargbInfo.offset;
}
if (stride == 0)
if (mode == 0)
stride = gc->state.vData.vStride;
else
stride = sizeof(float *) / sizeof (float);
if (ltype == GR_LINES)
sCount = count >> 1; /* line list */
else
@@ -1007,8 +1020,8 @@ _grAADrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
ady = -ady;
/*
if (gc->state.vData.colorType != GR_FLOAT) {
*((FxU32 *)&v1a)=*((FxU32 *)((int)v1 + ia))&0x00ffffff;
*((FxU32 *)&v2a)=*((FxU32 *)((int)v2 + ia))&0x00ffffff;
*((FxU32 *)&v1a)=*((FxU32 *)((long)v1 + ia))&0x00ffffff;
*((FxU32 *)&v2a)=*((FxU32 *)((long)v2 + ia))&0x00ffffff;
}
*/
@@ -1272,7 +1285,7 @@ _grAADrawTriangles(FxI32 mode, FxI32 ttype, FxI32 count, void *pointers)
float **lPtr = (float **)pointers;
FxI32 tCount = 3;
FxU32 fbzModeOld; /* Squirrel away current fbzMode */
FxI32 stride = mode;
FxI32 stride;
FxI32 xindex = (gc->state.vData.vertexInfo.offset >> 2);
FxI32 yindex = xindex + 1;
@@ -1289,8 +1302,10 @@ _grAADrawTriangles(FxI32 mode, FxI32 ttype, FxI32 count, void *pointers)
/* gc->state.invalid |= fbzModeBIT; */
GR_FLUSH_STATE();
if (stride == 0)
if (mode == 0)
stride = gc->state.vData.vStride;
else
stride = sizeof(float *) / sizeof (float);
/* backfaced or zero area */
while (tCount <= count) {
@@ -1584,7 +1599,7 @@ _grAAVpDrawTriangles(FxI32 mode, FxI32 ttype, FxI32 count, void *pointers)
float **lPtr = (float **)pointers;
FxI32 tCount = 3;
FxU32 fbzModeOld; /* Squirrel away current fbzMode */
FxI32 stride = mode;
FxI32 stride;
FxI32 xindex = (gc->state.vData.vertexInfo.offset >> 2);
FxI32 yindex = xindex + 1;
@@ -1601,8 +1616,10 @@ _grAAVpDrawTriangles(FxI32 mode, FxI32 ttype, FxI32 count, void *pointers)
/* gc->state.invalid |= fbzModeBIT; */
GR_FLUSH_STATE();
if (stride == 0)
if (mode == 0)
stride = gc->state.vData.vStride;
else
stride = sizeof(float *) / sizeof (float);
/* backfaced or zero area */
while (tCount <= count) {
@@ -1770,7 +1787,7 @@ _grAADrawVertexList(FxU32 type, FxI32 mode, FxI32 count, void *pointers)
float *v[3];
FxBool flip = FXFALSE;
FxU32 fbzModeOld; /* Squirrel away current fbzMode */
FxI32 stride = mode;
FxI32 stride;
if (sCount <= 2) return;
@@ -1781,8 +1798,10 @@ _grAADrawVertexList(FxU32 type, FxI32 mode, FxI32 count, void *pointers)
gc->state.fbi_config.fbzMode &= ~(SST_ZAWRMASK);
/* gc->state.invalid |= fbzModeBIT; */
GR_FLUSH_STATE();
if (stride == 0)
if (mode == 0)
stride = gc->state.vData.vStride;
else
stride = sizeof(float *) / sizeof (float);
sCount-=2;
if (type == kSetupFan) {

View File

@@ -19,6 +19,9 @@
**
** $Header$
** $Log$
** Revision 1.1.1.1.8.5 2005/06/17 14:18:49 jwrdegoede
** Fix few warnings when USE_X86=1 is not set
**
** Revision 1.1.1.1.8.4 2005/06/10 19:10:54 jwrdegoede
** Really fix cvg linking when GL_X86 is not defined
**
@@ -223,15 +226,20 @@ GR_ENTRY(grDrawPoint, void, (const void *p))
GR_ENTRY(grDrawLine, void, (const void *a, const void *b))
{
#define FN_NAME "grDrawLine"
float *vlist[2];
GR_BEGIN_NOFIFOCHECK(FN_NAME, 91);
GDBG_INFO_MORE(gc->myLevel, "(a = 0x%x, b = 0x%x)\n", a, b);
GR_FLUSH_STATE();
vlist[0] = (float *)a;
vlist[1] = (float *)b;
if (gc->state.grEnableArgs.primitive_smooth_mode & GR_AA_ORDERED_LINES_MASK)
_grAADrawLineStrip(GR_VTX_PTR_ARRAY, GR_LINES, 2, (void *)&a);
_grAADrawLineStrip(GR_VTX_PTR_ARRAY, GR_LINES, 2, (void *)vlist);
else
_grDrawLineStrip(GR_VTX_PTR_ARRAY, GR_LINES, 2, (void *)&a);
_grDrawLineStrip(GR_VTX_PTR_ARRAY, GR_LINES, 2, (void *)vlist);
#undef FN_NAME
} /* grDrawLine */
@@ -395,7 +403,7 @@ GR_DDFUNC(_grColorCombineDelta0Mode, void, (FxBool delta0mode))
GR_INC_SIZE(sizeof(FxU32))
#define DA_END \
gc->cmdTransportInfo.fifoRoom -= ((FxU32)packetPtr - (FxU32)gc->cmdTransportInfo.fifoPtr); \
gc->cmdTransportInfo.fifoRoom -= ((unsigned long)packetPtr - (unsigned long)gc->cmdTransportInfo.fifoPtr); \
gc->cmdTransportInfo.fifoPtr = packetPtr; \
FIFO_ASSERT(); \
}
@@ -420,7 +428,7 @@ _grDrawPoints(FxI32 mode, FxI32 count, void *pointers)
* except the data set up is from the pointer array and
* its data layout
*/
FxI32 stride = mode;
FxI32 stride;
/* we snap to an integer by adding a large enough number that it
* shoves all fraction bits off the right side of the mantissa.
@@ -452,8 +460,10 @@ _grDrawPoints(FxI32 mode, FxI32 count, void *pointers)
*/
#define POINTS_BUFFER 100
if (stride == 0)
if (mode == 0)
stride = gc->state.vData.vStride;
else
stride = sizeof(float *) / sizeof (float);
if (gc->state.grCoordinateSpaceArgs.coordinate_space_mode == GR_WINDOW_COORDS) {
while (count > 0) {
@@ -643,7 +653,7 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
int j;
FxI32 sCount;
FxU32 vertexParamOffset;
FxI32 stride = mode;
FxI32 stride;
#define DX _GlideRoot.pool.ftemp1
#define ADY _GlideRoot.pool.ftemp2
@@ -657,8 +667,11 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
#define LINES_BUFFER 100
if (stride == 0)
if (mode == 0)
stride = gc->state.vData.vStride;
else
stride = sizeof(float *) / sizeof (float);
if (ltype == GR_LINES)
sCount = count >> 1; /* line list */
else
@@ -686,16 +699,16 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
** compute absolute deltas and draw from low Y to high Y
*/
ADY = FARRAY(b, gc->state.vData.vertexInfo.offset+4) - FARRAY(a, gc->state.vData.vertexInfo.offset+4);
i = *(long *)&ADY;
i = *(int *)&ADY;
if (i < 0) {
float *tv;
tv = a; a = b; b = tv;
i ^= 0x80000000; /* ady = -ady; */
(*(long *)&ADY) = i;
(*(int *)&ADY) = i;
}
DX = FARRAY(b, gc->state.vData.vertexInfo.offset) - FARRAY(a, gc->state.vData.vertexInfo.offset);
j = *(long *)&DX;
j = *(int *)&DX;
if (j < 0) {
j ^= 0x80000000; /* adx = -adx; */
}
@@ -857,7 +870,7 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
** compute absolute deltas and draw from low Y to high Y
*/
ADY = tmp2 - tmp1;
i = *(long *)&ADY;
i = *(int *)&ADY;
if (i < 0) {
float *tv;
owa = oowb; owb = oowa;
@@ -865,7 +878,7 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
fby = tmp1;
tv = a; a = b; b = tv;
i ^= 0x80000000; /* ady = -ady; */
(*(long *)&ADY) = i;
(*(int *)&ADY) = i;
}
fax = FARRAY(a, gc->state.vData.vertexInfo.offset)
*owa*gc->state.Viewport.hwidth+gc->state.Viewport.ox;
@@ -873,7 +886,7 @@ _grDrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
*owb*gc->state.Viewport.hwidth+gc->state.Viewport.ox;
DX = fbx - fax;
j = *(long *)&DX;
j = *(int *)&DX;
if (j < 0) {
j ^= 0x80000000; /* adx = -adx; */
}
@@ -964,7 +977,7 @@ _grDrawTriangles_Default(FxI32 mode, FxI32 count, void *pointers)
FxI32
k;
FxI32 stride = mode;
FxI32 stride;
float *vPtr;
GR_BEGIN_NOFIFOCHECK(FN_NAME, 90);
@@ -980,8 +993,10 @@ _grDrawTriangles_Default(FxI32 mode, FxI32 count, void *pointers)
GDBG_INFO(110, "%s: paramMask = 0x%x\n", FN_NAME, gc->cmdTransportInfo.paramMask);
#endif
if (stride == 0)
if (mode == 0)
stride = gc->state.vData.vStride;
else
stride = sizeof(float *) / sizeof (float);
#if defined(__MSC__)
{

View File

@@ -19,6 +19,9 @@
**
** $Header$
** $Log$
** Revision 1.1.1.1.8.1 2005/06/09 18:32:08 jwrdegoede
** Fixed all warnings with gcc4 -Wall -W -Wno-unused-parameter, except for a couple I believe to be a gcc bug. This has been reported to gcc.
**
** Revision 1.1.1.1 1999/12/07 21:42:32 joseph
** Initial checkin into SourceForge.
**
@@ -800,7 +803,7 @@ _grLfbWriteRegion(FxBool pixPipelineP,
* start of the lfb so we don't need to add it in here.
*/
#if USE_PACKET_FIFO
dstData = (FxU32*)(dst_y * info.strideInBytes);
dstData = (FxU32*)((unsigned long)(dst_y * info.strideInBytes));
#else
dstData = (FxU32*)(((FxU8*)info.lfbPtr) + (dst_y * info.strideInBytes));
#endif
@@ -816,19 +819,19 @@ _grLfbWriteRegion(FxBool pixPipelineP,
case GR_LFB_SRC_FMT_ZA16:
dstData = (FxU32*)(((FxU16*)dstData) + dst_x);
length = src_width * 2;
aligned = !((int)dstData & 0x2);
aligned = !((unsigned long)dstData & 0x2);
srcJump = src_stride - length;
dstJump = info.strideInBytes - length;
if (aligned) {
while(scanline--) {
GR_ASSERT(((FxU32)dstData & 0x03UL) == 0);
GR_ASSERT(((unsigned long)dstData & 0x03UL) == 0);
end = (FxU32*)((char*)srcData + length - 2);
if (srcData < end) {
LINEAR_WRITE_BEGIN(length >> 2, kLinearWriteLFB, dstData, 0x00, 0x00);
while(srcData < end) {
LINEAR_WRITE_SET_16((FxU32)dstData, srcData[0]);
LINEAR_WRITE_SET_16(dstData, srcData[0]);
dstData++;
srcData++;
}
@@ -846,7 +849,7 @@ _grLfbWriteRegion(FxBool pixPipelineP,
}
} else {
while(scanline--) {
GR_ASSERT(((FxU32)dstData & 0x03UL) != 0);
GR_ASSERT(((unsigned long)dstData & 0x03UL) != 0);
end = (FxU32*)((char*)srcData + length);
LINEAR_WRITE_EDGE(kLinearWriteLFB, dstData,
@@ -855,12 +858,12 @@ _grLfbWriteRegion(FxBool pixPipelineP,
srcData = (FxU32*)(((FxU16*)srcData) + 1);
if (srcData < end) {
const FxU32 numWords = (((FxU32)end - (FxU32)srcData) >> 2);
const FxU32 numWords = (((unsigned long)end - (unsigned long)srcData) >> 2);
FxU32 i;
LINEAR_WRITE_BEGIN(numWords, kLinearWriteLFB, dstData, 0x00, 0x00);
for(i = 0; i < numWords; i++) {
LINEAR_WRITE_SET_16((FxU32)dstData, srcData[0]);
LINEAR_WRITE_SET_16(dstData, srcData[0]);
dstData++;
srcData++;
}
@@ -895,10 +898,10 @@ _grLfbWriteRegion(FxBool pixPipelineP,
LINEAR_WRITE_BEGIN(src_width,
kLinearWriteLFB,
(FxU32)dstData,
dstData,
0x00, 0x00);
while(srcData < end) {
LINEAR_WRITE_SET((FxU32)dstData, srcData[0]);
LINEAR_WRITE_SET(dstData, srcData[0]);
dstData++;
srcData++;
}
@@ -1055,20 +1058,20 @@ GR_ENTRY(grLfbReadRegion, FxBool, (GrBuffer_t src_buffer,
const FxU32* tileEndAlign;
/* Leading slop up to the start of a logical 0 tile */
if (((FxU32)srcData & kPageMask) != 0) {
FxU32 tileSlopMask = 0xFFFFFFFFUL;
if (((unsigned long)srcData & kPageMask) != 0) {
unsigned long tileSlopMask = -1UL;
FxU32 tileSlopAdjust = kTileSize;
/* Do we have a partial 0 tile? */
if (((FxU32)srcData & kTileSize) == 0) {
tilePtr = (const FxU32*)((FxU32)srcData + kTileSize);
tileEnd = (const FxU32*)(((FxU32)end <= ((FxU32)tilePtr & ~kTileMask))
? ((FxU32)end + kTileSize)
: (((FxU32)tilePtr + kTileSize) & ~kTileMask));
tileEndAlign = (const FxU32*)((FxU32)tileEnd & ~0x03UL);
if (((unsigned long)srcData & kTileSize) == 0) {
tilePtr = (const FxU32*)((unsigned long)srcData + kTileSize);
tileEnd = (const FxU32*)(((unsigned long)end <= ((unsigned long)tilePtr & ~kTileMask))
? ((unsigned long)end + kTileSize)
: (((unsigned long)tilePtr + kTileSize) & ~kTileMask));
tileEndAlign = (const FxU32*)((unsigned long)tileEnd & ~0x03UL);
/* Are we aligned in the hw lfb? */
if (((FxU32)tilePtr & 0x03UL) != 0) {
if (((unsigned long)tilePtr & 0x03UL) != 0) {
*(FxU16*)dstData = GR_GET16(*tilePtr);
dstData = (FxU32*)((FxU8*)dstData + sizeof(FxU16));
tilePtr = (const FxU32*)((FxU8*)tilePtr + sizeof(FxU16));
@@ -1086,14 +1089,14 @@ GR_ENTRY(grLfbReadRegion, FxBool, (GrBuffer_t src_buffer,
* 'backwards' in physical memory if there was no logical
* 0 tile in the current read.
*/
tilePtr = (const FxU32*)(((FxU32)srcData - tileSlopAdjust) & tileSlopMask);
tileEnd = (const FxU32*)MIN((((FxU32)tilePtr + kTileSize) & ~kTileMask),
(FxU32)end - kTileSize - sizeof(FxU16));
tileEndAlign = (const FxU32*)((FxU32)tileEnd & ~0x03UL);
tilePtr = (const FxU32*)(((unsigned long)srcData - tileSlopAdjust) & tileSlopMask);
tileEnd = (const FxU32*)MIN((((unsigned long)tilePtr + kTileSize) & ~kTileMask),
(unsigned long)end - kTileSize - sizeof(FxU16));
tileEndAlign = (const FxU32*)((unsigned long)tileEnd & ~0x03UL);
if (tilePtr < tileEnd) {
/* Are we aligned in the hw lfb? */
if (((FxU32)tilePtr & 0x03UL) != 0) {
if (((unsigned long)tilePtr & 0x03UL) != 0) {
*(FxU16*)dstData = GR_GET16(*tilePtr);
dstData = (FxU32*)((FxU8*)dstData + sizeof(FxU16));
tilePtr = (const FxU32*)((FxU8*)tilePtr + sizeof(FxU16));
@@ -1105,20 +1108,20 @@ GR_ENTRY(grLfbReadRegion, FxBool, (GrBuffer_t src_buffer,
*(FxU16*)dstData = GR_GET16(*tilePtr);
}
srcData = (const FxU32*)(((FxU32)srcData + (kTileSize << 1)) & ~kPageMask);
srcData = (const FxU32*)(((unsigned long)srcData + (kTileSize << 1)) & ~kPageMask);
}
/* Loop over complete logical 01 tile groups */
{
const FxU32* endTileAddr = (const FxU32*)((FxU32)end & ~kPageMask);
const FxU32* endTileAddr = (const FxU32*)((unsigned long)end & ~kPageMask);
while(srcData < endTileAddr) {
tilePtr = (const FxU32*)((FxU32)srcData + kTileSize);
tileEnd = (const FxU32*)((FxU32)tilePtr + kTileSize);
tilePtr = (const FxU32*)((unsigned long)srcData + kTileSize);
tileEnd = (const FxU32*)((unsigned long)tilePtr + kTileSize);
while(tilePtr < tileEnd) *dstData++ = GR_GET(*tilePtr++);
tilePtr = srcData;
tileEnd = (const FxU32*)((FxU32)tilePtr + kTileSize);
tileEnd = (const FxU32*)((unsigned long)tilePtr + kTileSize);
while(tilePtr < tileEnd) *dstData++ = GR_GET(*tilePtr++);
srcData = (const FxU32*)((FxU8*)srcData + (kTileSize << 1));
@@ -1127,12 +1130,12 @@ GR_ENTRY(grLfbReadRegion, FxBool, (GrBuffer_t src_buffer,
/* Slop 01 tile group */
if (srcData < end) {
const FxU32* startTileAddr = (const FxU32*)((FxU32)srcData + kTileSize);
const FxU32* startTileAddr = (const FxU32*)((unsigned long)srcData + kTileSize);
tilePtr = startTileAddr;
tileEnd = (const FxU32*)((FxU32)startTileAddr +
MIN(kTileSize, ((FxU32)end - (FxU32)srcData)));
tileEndAlign = (const FxU32*)((FxU32)tileEnd & ~0x3);
tileEnd = (const FxU32*)((unsigned long)startTileAddr +
MIN(kTileSize, ((unsigned long)end - (unsigned long)srcData)));
tileEndAlign = (const FxU32*)((unsigned long)tileEnd & ~0x3);
while(tilePtr < tileEndAlign) *dstData++ = GR_GET(*tilePtr++);
if (tileEnd != tileEndAlign)
@@ -1141,8 +1144,8 @@ GR_ENTRY(grLfbReadRegion, FxBool, (GrBuffer_t src_buffer,
if (startTileAddr < end) {
tilePtr = srcData;
tileEnd = (const FxU32*)((FxU8*)tilePtr + kTileSize -
((FxU32)tileEndAlign - (FxU32)end));
tileEndAlign = (const FxU32*)((FxU32)tileEnd & ~0x3);
((unsigned long)tileEndAlign - (unsigned long)end));
tileEndAlign = (const FxU32*)((unsigned long)tileEnd & ~0x3);
while(tilePtr < tileEndAlign) *dstData++ = GR_GET(*tilePtr++);
if (tileEnd != tileEndAlign)
@@ -1157,7 +1160,7 @@ GR_ENTRY(grLfbReadRegion, FxBool, (GrBuffer_t src_buffer,
} else
#endif /* (GLIDE_PLATFORM & GLIDE_HW_CVG) */
/* If the source data is aligned for 4 byte pci reads */
if (((FxU32)srcData & 0x02UL) == 0) {
if (((unsigned long)srcData & 0x02UL) == 0) {
while(scanline--) {
const FxU32* end = (const FxU32*)((char*)srcData + length - 2);

View File

@@ -54,7 +54,7 @@ typedef FxU8 GrAlpha_t;
typedef FxU32 GrMipMapId_t;
typedef FxU32 GrStipplePattern_t;
typedef FxU8 GrFog_t;
typedef FxU32 GrContext_t;
typedef unsigned long GrContext_t;
typedef int (FX_CALL *GrProc)();
/*

View File

@@ -19,6 +19,9 @@
**
** $Header$
** $Log$
** Revision 1.1.1.1.8.7 2005/06/10 18:59:00 jwrdegoede
** Fix linking when GL_X86 is not defined
**
** Revision 1.1.1.1.8.6 2005/05/25 08:51:49 jwrdegoede
** Add #ifdef GL_X86 around x86 specific code
**
@@ -563,7 +566,7 @@ _grSstDetectResources(void)
fxHalShutdown(devRegs);
#else /* !GLIDE_INIT_HAL */
sst1InitCaching((FxU32*)devRegs, FXFALSE);
pciUnmapPhysical((FxU32)devRegs, 0x1000000UL);
pciUnmapPhysical((unsigned long)devRegs, 0x1000000UL);
#endif /* !GLIDE_INIT_HAL */
}
}

View File

@@ -19,6 +19,9 @@
**
** $Header$
** $Log$
** Revision 1.1.1.1.8.7 2005/06/09 18:32:08 jwrdegoede
** Fixed all warnings with gcc4 -Wall -W -Wno-unused-parameter, except for a couple I believe to be a gcc bug. This has been reported to gcc.
**
** Revision 1.1.1.1.8.6 2005/01/13 16:02:32 koolsmoky
** Restict calls to pciOpen() pciClose() when compiled with DIRECTX option. this fixes problems with the win32 miniport opened in exclusive mode.
**
@@ -1247,13 +1250,13 @@ __errSliExit:
#endif
#else /* !GLIDE_INIT_HAL */
{
/* NB: This is a dummy since fifoStart is always hwBase +
* HW_FIFO_OFFSET (0x200000)
*/
FxU32 fifoStart = 0;
/* NB: This is a dummy since we always use sstbase +
cmdTransportInfo.fifoOffset, so we don't need a direct
virtual address for the cmdfifo. */
unsigned long fifoVirtAddr = 0;
rv = sst1InitCmdFifo(gc->reg_ptr, FXTRUE,
&fifoStart,
&fifoVirtAddr,
&gc->cmdTransportInfo.fifoOffset,
&fifoSize,
_grSet32);
@@ -1303,12 +1306,12 @@ __errSliExit:
{
#if (GLIDE_PLATFORM & GLIDE_HW_H3)
/* dpc - 12 nov 1997 - WTF!?!?!? */
gc->cmdTransportInfo.fifoStart = (FxU32 *) ((FxU32) gc->base_ptr + 0x3c0000);
gc->cmdTransportInfo.fifoStart = (FxU32 *) ((unsigned long) gc->base_ptr + 0x3c0000);
#else
gc->cmdTransportInfo.fifoStart = (FxU32*)((FxU32)gc->base_ptr + HW_FIFO_OFFSET);
gc->cmdTransportInfo.fifoStart = (FxU32*)((unsigned long)gc->base_ptr + HW_FIFO_OFFSET);
#endif
gc->cmdTransportInfo.fifoEnd =
(FxU32*)((FxU32)gc->cmdTransportInfo.fifoStart + fifoSize);
(FxU32*)((unsigned long)gc->cmdTransportInfo.fifoStart + fifoSize);
gc->cmdTransportInfo.fifoSize = fifoSize;
/* Adjust room values.
@@ -1338,14 +1341,14 @@ __errSliExit:
gc->cmdTransportInfo.lfbLockCount = 0;
GDBG_INFO(1, "Fifo Parameters:\n"
"\tStart: 0x%X\n"
"\tHW Read: 0x%X\n"
"\tStart: 0x%lX\n"
"\tHW Read: 0x%lX\n"
"\tHW Offset: 0x%X\n"
"\tSW Write: 0x%X\n",
gc->cmdTransportInfo.fifoStart,
gc->cmdTransportInfo.fifoRead,
"\tSW Write: 0x%lX\n",
(unsigned long)gc->cmdTransportInfo.fifoStart,
(unsigned long)gc->cmdTransportInfo.fifoRead,
gc->cmdTransportInfo.fifoOffset,
gc->cmdTransportInfo.fifoPtr);
(unsigned long)gc->cmdTransportInfo.fifoPtr);
#undef MB2B
}

View File

@@ -19,6 +19,9 @@
**
** $Header$
** $Log$
** Revision 1.1.1.1.8.1 2005/05/07 08:40:18 jwrdegoede
** lvalue cast fixes for gcc4
**
** Revision 1.1.1.1 1999/12/07 21:42:33 joseph
** Initial checkin into SourceForge.
**
@@ -151,7 +154,7 @@ _grDrawVertexList(FxU32 pktype, FxU32 type, FxI32 mode, FxI32 count, void *point
** simplified code
*/
FxU32 vSize;
FxI32 stride = mode;
FxI32 stride;
GR_BEGIN_NOFIFOCHECK(FN_NAME, 90);
@@ -161,8 +164,10 @@ _grDrawVertexList(FxU32 pktype, FxU32 type, FxI32 mode, FxI32 count, void *point
GR_FLUSH_STATE();
vSize = gc->state.vData.vSize;
if (stride == 0)
if (mode == 0)
stride = gc->state.vData.vStride;
else
stride = sizeof(float *) / sizeof (float);
/* Draw the first (or possibly only) set. This is necessary because
the packet is 3_BDDDDDD, and in the next set, the packet is

View File

@@ -19,6 +19,9 @@
**
** $Header$
** $Log$
** Revision 1.1.1.1.8.4 2004/09/27 08:51:05 dborca
** reorg brackets
**
** Revision 1.1.1.1.8.3 2004/01/13 09:22:51 dborca
** compilation errors (mainly for DEBUG mode)
**
@@ -889,12 +892,12 @@ GR_ENTRY(grTexDownloadMipMapLevelPartial,
{
const FxU32
width = _grMipMapHostWH[aspectRatio][thisLod][0],
formatSel = (format >= GR_TEXFMT_16BIT),
tmuBaseAddr = ((FxU32)gc->tex_ptr +
(((FxU32)tmu) << 21UL) +
(((FxU32)thisLod) << 17UL));
formatSel = (format >= GR_TEXFMT_16BIT);
const unsigned long tmuBaseAddr = ((unsigned long)gc->tex_ptr +
(((FxU32)tmu) << 21U) +
(((FxU32)thisLod) << 17U));
FxU32
widthSel = (width >> 0x01UL),
widthSel = (width >> 0x01U),
max_s = width >> (formatSel
? 1 /* 16-bit texture */
: 2); /* 8-bit texture */

View File

@@ -286,8 +286,8 @@ xdraw2_def.lo: xdraw2_def.o
$(CP) $< $@
xdraw3_def.lo: xdraw3_def.o
$(CP) $< $@
xtexdl_def.lo: xtexdl_def.o
$(CP) $< $@
xtexdl_def.lo: xtexdl.c
$(CC) -o $@ $(CFLAGS) -DPIC -fPIC -c $<
xdraw2_3dnow.lo: xdraw2_3dnow.o
$(CP) $< $@
xdraw3_3dnow.lo: xdraw3_3dnow.o

View File

@@ -19,6 +19,9 @@
**
** $Header$
** $Log$
** Revision 1.1.1.1 1999/12/07 21:42:38 joseph
** Initial checkin into SourceForge.
**
**
** 1 10/08/98 11:30a Brent
**
@@ -37,21 +40,22 @@
#include "fxglide.h"
void FX_CSTYLE
_grTexDownload_Default_8_1(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
_grTexDownload_Default_8_1(struct GrGC_s* gc, const unsigned long tmuBaseAddr,
const FxU32 maxS, const FxU32 minT, const FxU32 maxT,
void* texData)
{
#define FN_NAME "_grTexDownload_Default_8_1"
FxU32
t = minT,
t = minT;
unsigned long
tex_address = tmuBaseAddr + TEX_ROW_ADDR_INCR(t);
const FxU8
*src8 = (const FxU8*)texData;
for (; t <= maxT; t++) {
LINEAR_WRITE_BEGIN(1, kLinearWriteTex,
(FxU32)tex_address - (FxU32)gc->tex_ptr,
0x00UL, 0x00UL);
tex_address - (unsigned long)gc->tex_ptr,
0x00U, 0x00U);
LINEAR_WRITE_SET_8(tex_address, (const FxU32)*(const FxU8*)src8);
LINEAR_WRITE_END();
@@ -62,21 +66,22 @@ _grTexDownload_Default_8_1(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
}
void FX_CSTYLE
_grTexDownload_Default_8_2(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
_grTexDownload_Default_8_2(struct GrGC_s* gc, const unsigned long tmuBaseAddr,
const FxU32 maxS, const FxU32 minT, const FxU32 maxT,
void* texData)
{
#define FN_NAME "_grTexDownload_Default_8_2"
FxU32
t = minT,
t = minT;
unsigned long
tex_address = tmuBaseAddr + TEX_ROW_ADDR_INCR(t);
const FxU8
*src8 = (const FxU8*)texData;
for (; t <= maxT; t++) {
LINEAR_WRITE_BEGIN(1, kLinearWriteTex,
(FxU32)tex_address - (FxU32)gc->tex_ptr,
0x00UL, 0x00UL);
tex_address - (unsigned long)gc->tex_ptr,
0x00U, 0x00U);
LINEAR_WRITE_SET_8(tex_address, (const FxU32)*(const FxU16*)src8);
LINEAR_WRITE_END();
@@ -87,21 +92,22 @@ _grTexDownload_Default_8_2(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
}
void FX_CSTYLE
_grTexDownload_Default_8_4(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
_grTexDownload_Default_8_4(struct GrGC_s* gc, const unsigned long tmuBaseAddr,
const FxU32 maxS, const FxU32 minT, const FxU32 maxT,
void* texData)
{
#define FN_NAME "_grTexDownload_Default_8_4"
FxU32
t = minT,
t = minT;
unsigned long
tex_address = tmuBaseAddr + TEX_ROW_ADDR_INCR(t);
const FxU8
*src8 = (const FxU8*)texData;
for (; t <= maxT; t++) {
LINEAR_WRITE_BEGIN(1, kLinearWriteTex,
(FxU32)tex_address - (FxU32)gc->tex_ptr,
0x00UL, 0x00UL);
tex_address - (unsigned long)gc->tex_ptr,
0x00U, 0x00U);
LINEAR_WRITE_SET_8(tex_address, *(const FxU32*)src8);
LINEAR_WRITE_END();
@@ -112,13 +118,14 @@ _grTexDownload_Default_8_4(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
}
void FX_CSTYLE
_grTexDownload_Default_8_WideS(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
_grTexDownload_Default_8_WideS(struct GrGC_s* gc, const unsigned long tmuBaseAddr,
const FxU32 maxS, const FxU32 minT, const FxU32 maxT,
void* texData)
{
#define FN_NAME "_grTexDownload_Default_8_WideS"
FxU32
t = minT,
t = minT;
unsigned long
tex_address;
const FxU8
*src8 = (const FxU8*)texData;
@@ -127,8 +134,8 @@ _grTexDownload_Default_8_WideS(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
tex_address = tmuBaseAddr + TEX_ROW_ADDR_INCR(t);
LINEAR_WRITE_BEGIN(maxS, kLinearWriteTex,
(FxU32)tex_address - (FxU32)gc->tex_ptr,
0x00UL, 0x00UL);
tex_address - (unsigned long)gc->tex_ptr,
0x00U, 0x00U);
{
FxU32 s;
@@ -149,21 +156,22 @@ _grTexDownload_Default_8_WideS(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
}
extern void FX_CSTYLE
_grTexDownload_Default_16_1(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
_grTexDownload_Default_16_1(struct GrGC_s* gc, const unsigned long tmuBaseAddr,
const FxU32 maxS, const FxU32 minT, const FxU32 maxT,
void* texData)
{
#define FN_NAME "_grTexDownload_Default_16_1"
FxU32
t = minT,
t = minT;
unsigned long
tex_address = tmuBaseAddr + TEX_ROW_ADDR_INCR(t);
const FxU16
*src16 = (const FxU16*)texData;
for (; t <= maxT; t++) {
LINEAR_WRITE_BEGIN(1, kLinearWriteTex,
(FxU32)tex_address - (FxU32)gc->tex_ptr,
0x00UL, 0x00UL);
tex_address - (unsigned long)gc->tex_ptr,
0x00U, 0x00U);
LINEAR_WRITE_SET_16(tex_address, (const FxU32)*(const FxU16*)src16);
LINEAR_WRITE_END();
@@ -174,21 +182,22 @@ _grTexDownload_Default_16_1(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
}
extern void FX_CSTYLE
_grTexDownload_Default_16_2(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
_grTexDownload_Default_16_2(struct GrGC_s* gc, const unsigned long tmuBaseAddr,
const FxU32 maxS, const FxU32 minT, const FxU32 maxT,
void* texData)
{
#define FN_NAME "_grTexDownload_Default_16_2"
FxU32
t = minT,
t = minT;
unsigned long
tex_address = tmuBaseAddr + TEX_ROW_ADDR_INCR(t);
const FxU16
*src16 = (const FxU16*)texData;
for (; t <= maxT; t++) {
LINEAR_WRITE_BEGIN(1, kLinearWriteTex,
(FxU32)tex_address - (FxU32)gc->tex_ptr,
0x00UL, 0x00UL);
tex_address - (unsigned long)gc->tex_ptr,
0x00U, 0x00U);
LINEAR_WRITE_SET_16(tex_address, *(const FxU32*)src16);
LINEAR_WRITE_END();
@@ -199,13 +208,14 @@ _grTexDownload_Default_16_2(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
}
extern void FX_CSTYLE
_grTexDownload_Default_16_WideS(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
_grTexDownload_Default_16_WideS(struct GrGC_s* gc, const unsigned long tmuBaseAddr,
const FxU32 maxS, const FxU32 minT, const FxU32 maxT,
void* texData)
{
#define FN_NAME "_grTexDownload_Default_16_WideS"
FxU32
t = minT,
t = minT;
unsigned long
tex_address;
const FxU16
*src16 = (const FxU16*)texData;
@@ -215,8 +225,8 @@ _grTexDownload_Default_16_WideS(struct GrGC_s* gc, const FxU32 tmuBaseAddr,
/* Loop unrolled to process 2 dwords per iteration */
LINEAR_WRITE_BEGIN(maxS, kLinearWriteTex,
(FxU32)tex_address - (FxU32)gc->tex_ptr,
0x00UL, 0x00UL);
tex_address - (unsigned long)gc->tex_ptr,
0x00U, 0x00U);
{
FxU32 s;

Binary file not shown.

View File

@@ -41,7 +41,7 @@ void main( int argc, char **argv) {
char filename[256];
FxU8 subframe = 0;
unsigned long chromaColor;
unsigned int chromaColor;
/* Initialize Glide */
grGlideInit();

View File

@@ -216,7 +216,7 @@ void main( int argc, char **argv) {
return;
}
static unsigned long randx = 1;
static unsigned int randx = 1;
static unsigned int iRandom (unsigned int maxr)
{

View File

@@ -37,11 +37,11 @@ void main( int argc, char **argv) {
int frames = -1;
TlTexture baseTexture;
unsigned long baseTextureAddr;
unsigned int baseTextureAddr;
TlTexture lightTexture;
unsigned long lightTextureAddr;
unsigned int lightTextureAddr;
TlTexture detailTexture;
unsigned long detailTextureAddr;
unsigned int detailTextureAddr;
TlVertex3D srcVerts[4];
float distance, dDelta;

View File

@@ -35,9 +35,9 @@ void main( int argc, char **argv) {
int frames = -1;
TlTexture baseTexture;
unsigned long baseTextureAddr;
unsigned int baseTextureAddr;
TlTexture lightTexture;
unsigned long lightTextureAddr;
unsigned int lightTextureAddr;
int ftsize = 0;
GrFog_t *fogtable = NULL;

View File

@@ -236,7 +236,7 @@ void main( int argc, char **argv) {
return;
}
static unsigned long randx = 1;
static unsigned int randx = 1;
static unsigned int iRandom (unsigned int maxr)
{

View File

@@ -235,7 +235,7 @@ void main( int argc, char **argv) {
return;
}
static unsigned long randx = 1;
static unsigned int randx = 1;
static unsigned int iRandom (unsigned int maxr)
{

View File

@@ -164,7 +164,7 @@ doNothing:
return;
}
static unsigned long randx = 1;
static unsigned int randx = 1;
static unsigned int iRandom (unsigned int maxr)
{

View File

@@ -50,7 +50,7 @@ void main( int argc, char **argv) {
GrFog_t *fogtable = NULL;
TlTexture baseTexture;
unsigned long baseTextureAddr;
unsigned int baseTextureAddr;
FogVertex vtxA, vtxB, vtxC, vtxD;
TlVertex3D srcVerts[4];
TlVertex3D xfVerts[4];

View File

@@ -38,7 +38,7 @@ void main( int argc, char **argv) {
int ftsize = 0;
TlTexture baseTexture;
unsigned long baseTextureAddr;
unsigned int baseTextureAddr;
GrVertex vtxA, vtxB, vtxC, vtxD;
GrTexChromakeyMode_t texchroma = GR_TEXCHROMA_DISABLE_EXT;
char *extstr;

View File

@@ -35,7 +35,7 @@ void main( int argc, char **argv) {
iFailures = 0, iStatusAt = 0,
viewport[4];
GrContext_t context;
unsigned long hWndMain = tlGethWnd();
unsigned int hWndMain = tlGethWnd();
printf ( "Test36 - Glide resolution checker. All output goes to the console.\n\n" );
tlGetCH ();

View File

@@ -50,14 +50,14 @@
#define CORRECT_GR_VIEWPORT_WIDTH 640
#define CORRECT_GR_VIEWPORT_HEIGHT 480
void TestGet(char * getvalstr, int getval, int memcount , long * memval, int * failures);
void TestGet(char * getvalstr, int getval, int memcount , int * memval, int * failures);
void TestGetString(char * getvalstr, int getval, int * failures);
int hwconfig;
static const char *version;
static const char *extension;
extern unsigned long hWndMain;
extern unsigned int hWndMain;
void
main( int argc, char **argv)
@@ -65,9 +65,9 @@ main( int argc, char **argv)
GrScreenResolution_t resolution = GR_RESOLUTION_640x480;
float scrWidth = 640.0f;
float scrHeight = 480.0f;
long val4[4];
long * histbuffer;
long histsize;
int val4[4];
int * histbuffer;
int histsize;
const char * str;
int ret;
int i;
@@ -245,10 +245,10 @@ main( int argc, char **argv)
ret = grGet(GR_NUM_SWAP_HISTORY_BUFFER, sizeof(histsize), &histsize );
if(ret==sizeof(histsize)) {
histbuffer = malloc(histsize*sizeof(long));
histbuffer = malloc(histsize*sizeof(int));
ret = grGet(GR_SWAP_HISTORY, histsize*sizeof(long), histbuffer );
if(ret==(int)(histsize*sizeof(long)))
ret = grGet(GR_SWAP_HISTORY, histsize*sizeof(int), histbuffer );
if(ret==(int)(histsize*sizeof(int)))
printf("Success(%d) - ",ret);
else {
printf("Failed (%d) - ", ret);
@@ -321,7 +321,7 @@ main( int argc, char **argv)
void
TestGet(char * getvalstr, int getval, int memcount , long * memval, int * failures)
TestGet(char * getvalstr, int getval, int memcount , int * memval, int * failures)
{
int ret;
int i;
@@ -332,7 +332,7 @@ TestGet(char * getvalstr, int getval, int memcount , long * memval, int * failur
for(i=0;i<4;i++) /*Clear Memory to some unique Pattern*/
memval[i] =0xdeadbeef;
ret = grGet(getval, memcount*sizeof(long), memval ); /*Do the Get*/
ret = grGet(getval, memcount*sizeof(int), memval ); /*Do the Get*/
for(i=0;i<memcount;i++)
/*if pattern still exists, then we have a problem*/
@@ -340,7 +340,7 @@ TestGet(char * getvalstr, int getval, int memcount , long * memval, int * failur
correct=FXFALSE;
/* if Number of bytes returned is wrong, then we have a problem*/
if(ret!=(int)(memcount*sizeof(long)))
if(ret!=(int)(memcount*sizeof(int)))
correct=FXFALSE;
if(correct) /*print the results*/

View File

@@ -39,7 +39,7 @@ static const char name[] = "test38";
static const char purpose[] = "Test the guGammaCorrectionRGB(..) function.";
static const char usage[] = "-n <frames> -r <res> -d <filename>";
extern unsigned long hWndMain;
extern unsigned int hWndMain;
void main( int argc, char **argv)
{

View File

@@ -148,7 +148,7 @@ static ResToRes resTable[] = {
{ "400x300", GR_RESOLUTION_400x300, 400.0f, 300.0f } /* 0xF */
};
static long resTableSize = sizeof( resTable ) / sizeof( ResToRes );
static int resTableSize = sizeof( resTable ) / sizeof( ResToRes );
void
tlGetDimsByConst(const int resConst, float *w, float *h)
@@ -378,7 +378,7 @@ float tlScaleY( float coord ) {
-------------------------------------------------------------------*/
static unsigned char fontTable[128][2];
static GrTexInfo fontInfo;
static unsigned long fontAddress;
static unsigned int fontAddress;
static const char fontString[] = "ABCDEFGHIJKLMN"
"OPQRSTUVWXYZ01"
"23456789.,;:*-"
@@ -1662,7 +1662,7 @@ static int qhead = 0;
static int qtail = 0;
static int queue[256] = {0};
long FAR PASCAL
int FAR PASCAL
MainWndproc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
PAINTSTRUCT ps;

View File

@@ -195,7 +195,7 @@
// end up looking like twos complement numbers (they carry out from the '1')
#define FLOAT_FIX(f,fracbits) ((f)+(float)(3<<(22-(fracbits))))
#define SST_FLOAT(f,scale,shift) (unsigned long)((f)*((scale)*(float)(1<<shift)))
#define SST_FLOAT(f,scale,shift) (unsigned int)((f)*((scale)*(float)(1<<shift)))
#define SST_TLOD_MINMAX(lodmin,lodmax) \
(((lodmin) << (SST_LODMIN_SHIFT)) | \
((lodmax) << (SST_LODMAX_SHIFT)))
@@ -208,10 +208,10 @@
#define FLOAT_ISNEG(f) ((*(int *)(&(f))) < 0)
// these crazy macros returns the sign of a number (1 if >= 0; -1 if < 0)
#define ISIGN(x) (((x) | 0x40000000L) >> 30)
#define FSIGN(f) ISIGN(*(long *)&f)
#define ISIGN(x) (((x) | 0x40000000) >> 30)
#define FSIGN(f) ISIGN(*(int *)&f)
#define BIT(n) (1UL<<(n))
#define BIT(n) (1U<<(n))
#define SST_MASK(n) (0xFFFFFFFFL >> (32-(n)))
#define SST_MASK64(n) FX_MASK64(n)
@@ -899,9 +899,9 @@
//----------------- useful addressing macros -----------------------
// return pointer to SST at specified WRAP, CHIP, or TREX
#define SST_WRAP(sst,n) ((SstRegs *)((n)*0x4000+(FxI32)(sst)))
#define SST_CHIP(sst,n) ((SstRegs *)((n)*0x400+(FxI32)(sst)))
#define SST_TMU(sst,n) ((SstRegs *)((0x800<<(n))+(FxI32)(sst)))
#define SST_WRAP(sst,n) ((SstRegs *)((n)*0x4000+(unsigned long)(sst)))
#define SST_CHIP(sst,n) ((SstRegs *)((n)*0x400+(unsigned long)(sst)))
#define SST_TMU(sst,n) ((SstRegs *)((0x800<<(n))+(unsigned long)(sst)))
#define SST_TREX(sst,n) SST_TMU(sst,n)
#define SST_BYTESWAP_BIT BIT(20)
@@ -917,8 +917,8 @@
#define SST_TEX_OFFSET SST_TEX_ADDR
// return byte addresses of LFB and TEX spaces
#define SST_LFB_ADDRESS(sst) (SST_LFB_BIT+(FxI32)(sst))
#define SST_TEX_ADDRESS(sst) (SST_TEX_BIT+(FxI32)(sst))
#define SST_LFB_ADDRESS(sst) (SST_LFB_BIT+(unsigned long)(sst))
#define SST_TEX_ADDRESS(sst) (SST_TEX_BIT+(unsigned long)(sst))
// SET macros for FBI

View File

@@ -27,7 +27,7 @@
#if defined(__unix__) && ! defined(__CVGREGS_H__)
// basic data types
#define FxU32 unsigned long
#define FxU32 unsigned int
#define FxBool int
// defn of registers not reqd, treat (SstRegs *) as (void *)
typedef void SstRegs;

View File

@@ -28,8 +28,8 @@
//----------------- SST chip 3D layout -------------------------
// registers are in groups of 8 for easy decode
typedef struct vertex_Rec {
unsigned long x; // 12.4 format
unsigned long y; // 12.4
FxU32 x; // 12.4 format
FxU32 y; // 12.4
} vtxRec;
typedef volatile struct sstregs { // THE 3D CHIP
@@ -40,87 +40,87 @@ typedef volatile struct sstregs { // THE 3D CHIP
vtxRec vB;
vtxRec vC;
long r; // 12.12 Parameters
long g; // 12.12
long b; // 12.12
long z; // 20.12
long a; // 12.12
long s; // 14.18
long t; // 14.18
long w; // 2.30
FxI32 r; // 12.12 Parameters
FxI32 g; // 12.12
FxI32 b; // 12.12
FxI32 z; // 20.12
FxI32 a; // 12.12
FxI32 s; // 14.18
FxI32 t; // 14.18
FxI32 w; // 2.30
long drdx; // X Gradients
long dgdx;
long dbdx;
long dzdx;
long dadx;
long dsdx;
long dtdx;
long dwdx;
FxI32 drdx; // X Gradients
FxI32 dgdx;
FxI32 dbdx;
FxI32 dzdx;
FxI32 dadx;
FxI32 dsdx;
FxI32 dtdx;
FxI32 dwdx;
long drdy; // Y Gradients
long dgdy;
long dbdy;
long dzdy;
long dady;
long dsdy;
long dtdy;
long dwdy;
FxI32 drdy; // Y Gradients
FxI32 dgdy;
FxI32 dbdy;
FxI32 dzdy;
FxI32 dady;
FxI32 dsdy;
FxI32 dtdy;
FxI32 dwdy;
unsigned long triangleCMD; // execute a triangle command (float)
unsigned long reservedA;
FxU32 triangleCMD; // execute a triangle command (float)
FxU32 reservedA;
vtxRec FvA; // floating point version
vtxRec FvB;
vtxRec FvC;
long Fr; // floating point version
long Fg;
long Fb;
long Fz;
long Fa;
long Fs;
long Ft;
long Fw;
FxI32 Fr; // floating point version
FxI32 Fg;
FxI32 Fb;
FxI32 Fz;
FxI32 Fa;
FxI32 Fs;
FxI32 Ft;
FxI32 Fw;
long Fdrdx;
long Fdgdx;
long Fdbdx;
long Fdzdx;
long Fdadx;
long Fdsdx;
long Fdtdx;
long Fdwdx;
FxI32 Fdrdx;
FxI32 Fdgdx;
FxI32 Fdbdx;
FxI32 Fdzdx;
FxI32 Fdadx;
FxI32 Fdsdx;
FxI32 Fdtdx;
FxI32 Fdwdx;
long Fdrdy;
long Fdgdy;
long Fdbdy;
long Fdzdy;
long Fdady;
long Fdsdy;
long Fdtdy;
long Fdwdy;
FxI32 Fdrdy;
FxI32 Fdgdy;
FxI32 Fdbdy;
FxI32 Fdzdy;
FxI32 Fdady;
FxI32 Fdsdy;
FxI32 Fdtdy;
FxI32 Fdwdy;
unsigned long FtriangleCMD; // execute a triangle command
unsigned long fbzColorPath; // color select and combine
unsigned long fogMode; // fog Mode
unsigned long alphaMode; // alpha Mode
unsigned long fbzMode; // framebuffer and Z mode
unsigned long lfbMode; // linear framebuffer Mode
unsigned long clipLeftRight; // (6)10(6)10
unsigned long clipBottomTop; // (6)10(6)10
FxU32 FtriangleCMD; // execute a triangle command
FxU32 fbzColorPath; // color select and combine
FxU32 fogMode; // fog Mode
FxU32 alphaMode; // alpha Mode
FxU32 fbzMode; // framebuffer and Z mode
FxU32 lfbMode; // linear framebuffer Mode
FxU32 clipLeftRight; // (6)10(6)10
FxU32 clipBottomTop; // (6)10(6)10
unsigned long nopCMD; // execute a nop command
unsigned long fastfillCMD; // execute a fast fill command
unsigned long swapbufferCMD;// execute a swapbuffer command
unsigned long fogColor; // (8)888
unsigned long zaColor; // 8(8)16
unsigned long chromaKey; // (8)888
unsigned long chromaRange;
unsigned long reservedB;
FxU32 nopCMD; // execute a nop command
FxU32 fastfillCMD; // execute a fast fill command
FxU32 swapbufferCMD;// execute a swapbuffer command
FxU32 fogColor; // (8)888
FxU32 zaColor; // 8(8)16
FxU32 chromaKey; // (8)888
FxU32 chromaRange;
FxU32 reservedB;
unsigned long stipple; // 32 bits, MSB masks pixels
unsigned long c0; // 8.8.8.8 (ARGB)
unsigned long c1; // 8.8.8.8 (ARGB)
FxU32 stipple; // 32 bits, MSB masks pixels
FxU32 c0; // 8.8.8.8 (ARGB)
FxU32 c1; // 8.8.8.8 (ARGB)
struct { // statistic gathering variables
unsigned int fbiPixelsIn;
unsigned int fbiChromaFail;
@@ -129,7 +129,7 @@ typedef volatile struct sstregs { // THE 3D CHIP
unsigned int fbiPixelsOut;
} stats;
unsigned long fogTable[32]; // 64 entries, 2 per word, 2 bytes each
FxU32 fogTable[32]; // 64 entries, 2 per word, 2 bytes each
FxU32 cmdFifoBase; // beginning of CMDFIFO area
FxU32 cmdFifoBump; // number of words to bump (write only)
@@ -138,22 +138,22 @@ typedef volatile struct sstregs { // THE 3D CHIP
FxU32 cmdFifoAmax; // highest address written (not visible)
FxU32 cmdFifoDepth; // number of valid sequential words
FxU32 cmdFifoHoles; // number of current holes
unsigned long reservedC;
FxU32 reservedC;
unsigned long fbiInit4;
unsigned long vRetrace;
unsigned long backPorch;
unsigned long videoDimensions;
unsigned long fbiInit0;
unsigned long fbiInit1;
unsigned long fbiInit2;
unsigned long fbiInit3;
FxU32 fbiInit4;
FxU32 vRetrace;
FxU32 backPorch;
FxU32 videoDimensions;
FxU32 fbiInit0;
FxU32 fbiInit1;
FxU32 fbiInit2;
FxU32 fbiInit3;
unsigned long hSync;
unsigned long vSync;
unsigned long clutData;
unsigned long dacData;
unsigned long videoFilterRgbThreshold;
FxU32 hSync;
FxU32 vSync;
FxU32 clutData;
FxU32 dacData;
FxU32 videoFilterRgbThreshold;
FxU32 hBorder;
FxU32 vBorder;
FxU32 borderColor;
@@ -162,7 +162,7 @@ typedef volatile struct sstregs { // THE 3D CHIP
FxU32 fbiInit5;
FxU32 fbiInit6;
FxU32 fbiInit7;
unsigned long reservedD[2];
FxU32 reservedD[2];
FxU32 fbiSwapHistory;
FxU32 fbiTrianglesOut; // triangles out counter
@@ -186,7 +186,7 @@ typedef volatile struct sstregs { // THE 3D CHIP
FxU32 sDrawTriCMD;
FxU32 sBeginTriCMD;
unsigned long reservedE[6];
FxU32 reservedE[6];
FxU32 bltSrcBaseAddr;
FxU32 bltDstBaseAddr;
@@ -206,18 +206,18 @@ typedef volatile struct sstregs { // THE 3D CHIP
FxU32 bltCommand;
FxU32 bltData;
unsigned long textureMode; // texture Mode
unsigned long tLOD; // texture LOD settings
unsigned long tDetail; // texture detail settings
unsigned long texBaseAddr; // current texture base address
unsigned long texBaseAddr1;
unsigned long texBaseAddr2;
unsigned long texBaseAddr38;
unsigned long trexInit0; // hardware init bits
FxU32 textureMode; // texture Mode
FxU32 tLOD; // texture LOD settings
FxU32 tDetail; // texture detail settings
FxU32 texBaseAddr; // current texture base address
FxU32 texBaseAddr1;
FxU32 texBaseAddr2;
FxU32 texBaseAddr38;
FxU32 trexInit0; // hardware init bits
unsigned long trexInit1; // hardware init bits
unsigned long nccTable0[12]; // NCC decode tables, bits are packed
unsigned long nccTable1[12]; // 4 words Y, 4 words I, 4 words Q
FxU32 trexInit1; // hardware init bits
FxU32 nccTable0[12]; // NCC decode tables, bits are packed
FxU32 nccTable1[12]; // 4 words Y, 4 words I, 4 words Q
FxU32 tchromaKey; // texture chromakey
FxU32 tchromaRange; // texture chromarange
FxU32 reservedH[5];

View File

@@ -95,12 +95,12 @@ sst1InitComputeClkParamsATT_Int(FFLOAT dwFreq, sst1ClkTimingStruct *clkTiming)
lBestErr = 99999999;
sNBest = 0;
sMBest = 0;
lRatio = (unsigned long)((dwFreq*10l)/(FI/100l)) * lPDiv; // lRatio in [1/1000]
lRatio = (unsigned int)((dwFreq*10l)/(FI/100l)) * lPDiv; // lRatio in [1/1000]
for ( sN= (NMID-NDELTA); sN <= (NMID+NDELTA); sN++ ) {
sM = (unsigned short)((lRatio * sN + 500) / 1000l);
if (sM > MMAX) sM = MMAX;
lActual = (unsigned long)((FI * sM) / (sN * lPDiv));
lActual = (unsigned int)((FI * sM) / (sN * lPDiv));
lError = (lActual > dwFreq) ? (lActual - dwFreq) : (dwFreq - lActual);
if ( lError < lBestErr ) {
sNBest = sN;
@@ -113,7 +113,7 @@ sst1InitComputeClkParamsATT_Int(FFLOAT dwFreq, sst1ClkTimingStruct *clkTiming)
sM++;
if (sM > MMAX) sM = MMAX;
lActual = (unsigned long)((FI * sM) / (sN * lPDiv));
lActual = (unsigned int)((FI * sM) / (sN * lPDiv));
lError = (lActual > dwFreq) ? (lActual - dwFreq) : (dwFreq - lActual);
if ( lError < lBestErr) {
sNBest = sN;

View File

@@ -29,8 +29,8 @@
// if we use FFLOAT as an integer, we need to handle clocks in Hz
#define CLOCK_MULTIPLIER 1000000L
typedef unsigned long FFLOAT;
typedef unsigned long DDOUBLE;
typedef unsigned int FFLOAT;
/* HDG: unused: typedef unsigned int DDOUBLE; */
/* FixMe!! Is this right? */
#define CANOPUS_ID 0x10UL

View File

@@ -41,15 +41,15 @@ FxBool FindHole(RangeStruct *conflict);
FxU32 SnapToDecentAddress(FxU32 address,RangeStruct *conflict);
FxBool fits_in_hole(RangeStruct *begin,FxU32 end,RangeStruct *hole,RangeStruct *conflict);
FxBool fits_under(RangeStruct *first,FxU32 minimum,RangeStruct *hole,RangeStruct *conflict);
FxU32 pciGetType(long i);
FxU32 pciGetType(int i);
void pciGetRange(PciRegister reg,FxU32 device_number,FxU32 *data);
FxBool pciGetAddress(PciRegister reg,FxU32 device_number,FxU32 *data);
void ForceCleanUp(void);
FxBool FindNecessaryCards(void);
void ProcessCommandLine(char **argv,int argc);
FxBool IsCardVoodoo(long i);
FxBool IsCardS3(long i);
FxBool IsCardVoodoo(int i);
FxBool IsCardS3(int i);
FxBool ReadHex(char *string,FxU32 *num);
void AddMapEntry(FxU32 address,FxU32 range,FxU32 id,FxBool VoodooCard,FxBool S3Card);
void HandleMemoryOverlap(void);
@@ -74,12 +74,10 @@ RangeStruct test_data[6]= {{0xF0000000,0x100000,1,0,0,0,0},
RangeStruct map[80];
RangeStruct hole[80];
long num_holes=0;
RangeStruct *first_entry;
RangeStruct *last_entry;
long entries=0;
static int entries=0;
RangeStruct master_hole;
long voodoo_loc;
FxU32 conflicts_found=0;
void fxremap_dowork(int argc,char **argv,int doit_silently)
@@ -176,7 +174,7 @@ void GetMemoryMap(void)
{
FxU32 temp,temp2;
FxU32 type;
long devNum;
int devNum;
int fn; /* function number iterator */
int maxFnNumber;
int multi_fn = 0;
@@ -323,13 +321,13 @@ void AddMapEntry(FxU32 address,FxU32 range,FxU32 id,FxBool VoodooCard,FxBool S3C
RangeStruct *temp,*cur,*next;
//jcochrane@3dfx.com
long entry=0;
int entry=0;
FxU32 tmp_address=0;
//END
#if 0
static long test_entry=0;
static int test_entry=0;
address=test_data[test_entry].address;
range=~(test_data[test_entry++].range - 0x1);
@@ -624,7 +622,7 @@ void ForceCleanUp(void)
FxBool FindNecessaryCards(void)
{
FxBool voodoo_found=FXFALSE;
long i;
int i;
for (i=0;i<MAX_PCI_DEVICES;i++)
{
@@ -649,7 +647,7 @@ FxBool FindNecessaryCards(void)
void ProcessCommandLine(char **argv,int argc)
{
long i;
int i;
FxU32 temp,temp2;
FxU32 address,range;
char *hex_ptr;
@@ -756,7 +754,7 @@ void ProcessCommandLine(char **argv,int argc)
}
}
FxU32 pciGetType(long i)
FxU32 pciGetType(int i)
{
FxU32 header_type;
@@ -765,7 +763,7 @@ FxU32 pciGetType(long i)
return header_type;
}
FxBool IsCardVoodoo(long i)
FxBool IsCardVoodoo(int i)
{
FxU32 vendor,dev_id;
FxU32 fn_num = (i >> 13) & 0x7;
@@ -796,7 +794,7 @@ FxBool IsCardVoodoo(long i)
return FXFALSE;
}
FxBool IsCardS3(long i)
FxBool IsCardS3(int i)
{
FxU32 vendor,dev_id;
@@ -810,9 +808,9 @@ FxBool IsCardS3(long i)
FxBool ReadHex(char *string,FxU32 *num)
{
long i=0;
int i=0;
FxU32 temp=0,temp2;
long num_count=0;
int num_count=0;
/* bypass leading spaces */
while((string[i])&&(string[i]==' '))

View File

@@ -68,7 +68,7 @@ EngDebugPrint(
static char *gdbg_myname = "gd"; // default library name
static char gdbg_debuglevel[GDBG_MAX_LEVELS]; // array of debuglevel controls
static long gdbg_errors = 0;
static int gdbg_errors = 0;
#ifdef KERNEL

View File

@@ -397,8 +397,8 @@ FX_EXPORT FxU32 * FX_CSTYLE sst1InitMapBoardDirect(FxU32 BoardNumber,
if(!(sstbase = (FxU32 *) sst1BoardInfo[BoardNumber].virtAddr[0]))
return (NULL);
INIT_PRINTF(("sst1InitMapBoard(): vAddr:0x%x pAddr:0x%x Dev:0x%x Board:%d\n",
(FxU32) sst1BoardInfo[BoardNumber].virtAddr[0],
INIT_PRINTF(("sst1InitMapBoard(): vAddr:0x%lx pAddr:0x%x Dev:0x%x Board:%d\n",
(unsigned long) sst1BoardInfo[BoardNumber].virtAddr[0],
(FxU32) sst1BoardInfo[BoardNumber].physAddr[0],
(FxU32) sst1BoardInfo[BoardNumber].deviceNumber, BoardNumber));

View File

@@ -703,7 +703,7 @@ FX_ENTRY sst1VideoTimingStruct* FX_CALL
sst1InitFindVideoTimingStruct(GrScreenResolution_t, GrScreenRefresh_t);
FX_ENTRY FxU32 FX_CALL sst1InitMeasureSiProcess(FxU32 *, FxU32);
FX_ENTRY FxBool FX_CALL sst1InitCmdFifo(FxU32 *, FxBool, FxU32 *, FxU32 *,
FX_ENTRY FxBool FX_CALL sst1InitCmdFifo(FxU32 *, FxBool, unsigned long *, FxU32 *,
FxU32 *, FxSet32Proc);
FX_ENTRY FxBool FX_CALL sst1InitCmdFifoDirect(FxU32 *, FxU32, FxU32, FxU32,
FxBool, FxBool, FxSet32Proc);

View File

@@ -479,7 +479,7 @@ FX_EXPORT FxBool FX_CSTYLE sst1InitResetTmus(FxU32 *sstbase)
// Fix problem where first Texture downloads to TMU weren't being
// received properly
ISET(*(long *) (0xf00000 + (long) sstbase), 0xdeadbeef);
ISET(*(int *) (0xf00000 + (long) sstbase), 0xdeadbeef);
sst1InitIdle(sstbase);
return(FXTRUE);
@@ -559,7 +559,7 @@ FX_EXPORT void FX_CSTYLE sst1InitWrite32(FxU32 *addr, FxU32 data)
* the command fifo, and, inconveniently, these are not contiguously
* allocated.
*/
const FxU32 addrOffset = ((const FxU32)addr - (const FxU32)sst1CurrentBoard->virtAddr[0]);
const FxU32 addrOffset = ((const unsigned long)addr - (const unsigned long)sst1CurrentBoard->virtAddr[0]);
FxBool directWriteP = ((sst1CurrentBoard == NULL) ||
(sst1CurrentBoard->set32 == NULL) ||
sst1CurrentBoard->fbiLfbLocked ||
@@ -610,7 +610,7 @@ FX_EXPORT FxU32 FX_CSTYLE sst1InitRead32(FxU32 *addr)
**
*/
FX_ENTRY FxBool FX_CALL sst1InitCmdFifo(FxU32 *sstbase, FxBool enable,
FxU32 *virtAddrStart, FxU32 *memAddrStart, FxU32 *size, FxSet32Proc set32Proc)
unsigned long *virtAddrStart, FxU32 *memAddrStart, FxU32 *size, FxSet32Proc set32Proc)
{
SstRegs *sst = (SstRegs *) sstbase;
FxU32 fbiInit, fifoStart, fifoSize;
@@ -681,7 +681,7 @@ FX_ENTRY FxBool FX_CALL sst1InitCmdFifo(FxU32 *sstbase, FxBool enable,
if(fifoSize > (256<<10))
fifoSize = (256<<10);
*virtAddrStart = (FxU32) (((FxU32) sstbase) + SST_CMDFIFO_ADDR);
*virtAddrStart = ((unsigned long) sstbase) + SST_CMDFIFO_ADDR;
*memAddrStart = fifoStart;
*size = fifoSize;
@@ -742,8 +742,8 @@ FX_ENTRY FxBool FX_CALL sst1InitCmdFifoDirect(FxU32 *sstbase, FxU32 which,
directExec, disableHoles));
INIT_PRINTF(("sst1InitCmdFifoDirect(): pageStart:%d, pageEnd:%d\n",
pageStart, pageEnd));
INIT_PRINTF(("sst1InitCmdFifoDirect(): set32Proc: 0x%X\n",
(FxU32)set32Proc));
INIT_PRINTF(("sst1InitCmdFifoDirect(): set32Proc: 0x%lX\n",
(unsigned long)set32Proc));
if(sst1CurrentBoard->fbiCmdFifoEn || (IGET(sst->fbiInit7) & SST_EN_CMDFIFO))
sst1InitIdleNoNOP(sstbase);

View File

@@ -19,6 +19,9 @@
**
** $Header$
** $Log$
** Revision 1.1.1.1.6.4 2005/06/09 18:32:28 jwrdegoede
** Fixed all warnings with gcc4 -Wall -W -Wno-unused-parameter, except for a couple I believe to be a gcc bug. This has been reported to gcc.
**
** Revision 1.1.1.1.6.3 2004/01/20 14:04:10 dborca
** compilation and some other minor fixes to aid in debugging
**
@@ -730,7 +733,7 @@ static FxBool ReadDataLong(FILE *fp, FxU32 *data)
{
FxU8 byte[4];
if (fread(byte, 4, 1, fp) != 4)
if (fread(byte, 1, 4, fp) != 4)
return FXFALSE;
*data = (((FxU32) byte[0]) << 24) |

View File

@@ -19,6 +19,9 @@
**
** $Header$
** $Log$
** Revision 1.1.1.1.6.5 2005/06/09 18:32:28 jwrdegoede
** Fixed all warnings with gcc4 -Wall -W -Wno-unused-parameter, except for a couple I believe to be a gcc bug. This has been reported to gcc.
**
** Revision 1.1.1.1.6.4 2005/05/25 08:56:23 jwrdegoede
** Make h5 and h3 tree 64 bit clean. This is ported over from the non-devel branch so this might be incomplete
**
@@ -464,7 +467,7 @@ GR_ENTRY(grAADrawTriangle,
if ((gc->state.cull_mode != GR_CULL_DISABLE) && (((FxI32)(j.i ^ (gc->state.cull_mode << 31UL))) >= 0))
return;
}
#if __POWERPC__
#if !defined(__MSC__)
{
const void *verts[3];
verts[0] = a;
@@ -472,11 +475,9 @@ GR_ENTRY(grAADrawTriangle,
verts[2] = c;
(*gc->archDispatchProcs.drawTrianglesProc)(GR_VTX_PTR_ARRAY, 3, verts);
}
#elif defined(__MSC__)
grDrawTriangle(a, b, c);
#else
(*gc->archDispatchProcs.drawTrianglesProc)(GR_VTX_PTR_ARRAY, 3, (void*)&a);
#endif
grDrawTriangle(a, b, c);
#endif
/* Disable depth buffer writes for edge triangles */
fbzMode = fbzModeOld;
fbzMode &= ~(SST_ZAWRMASK);
@@ -595,7 +596,7 @@ _grAADrawPoints(FxI32 mode, FxI32 count, void *pointers)
float *e, ptX, ptY;
FxI32 i, ia;
FxU32 vsize;
FxI32 stride = mode;
FxI32 stride;
FxU32 tmp_cullStripHdr;
GDBG_INFO(94,"_grAADrawPoints(0x%x)\n",pointers);
@@ -603,8 +604,10 @@ _grAADrawPoints(FxI32 mode, FxI32 count, void *pointers)
GDBG_INFO_MORE(gc->myLevel, "(count = %d, pointers = 0x%x)\n",
count, pointers);
if (stride == 0)
if (mode == 0)
stride = gc->state.vData.vStride;
else
stride = sizeof(float *) / sizeof (float);
GR_FLUSH_STATE();
@@ -816,7 +819,7 @@ _grAADrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
FxU32 ia;
FxU32 vsize;
FxU32 sCount;
FxI32 stride = mode;
FxI32 stride;
FxU32 tmp_cullStripHdr;
GDBG_INFO(95,"_grAADrawLineStrip(count = %d, pointers = 0x%x)\n",
@@ -829,8 +832,11 @@ _grAADrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
GR_FLUSH_STATE();
if (stride == 0)
if (mode == 0)
stride = gc->state.vData.vStride;
else
stride = sizeof(float *) / sizeof (float);
if (ltype == GR_LINES)
sCount = count >> 1; /* line list */
else
@@ -1344,7 +1350,7 @@ _grAADrawTriangles(FxI32 mode, FxI32 ttype, FxI32 count, void *pointers)
float **lPtr = (float **)pointers;
FxI32 tCount = 3;
FxU32 fbzModeOld; /* Squirrel away current fbzMode */
FxI32 stride = mode;
FxI32 stride;
FxI32 xindex = (gc->state.vData.vertexInfo.offset >> 2);
FxI32 yindex = xindex + 1;
@@ -1361,8 +1367,10 @@ _grAADrawTriangles(FxI32 mode, FxI32 ttype, FxI32 count, void *pointers)
/* gc->state.invalid |= fbzModeBIT; */
GR_FLUSH_STATE();
if (stride == 0)
if (mode == 0)
stride = gc->state.vData.vStride;
else
stride = sizeof(float *) / sizeof (float);
/* backfaced or zero area */
while (tCount <= count) {
@@ -1517,7 +1525,7 @@ _grAAVpDrawTriangles(FxI32 mode, FxI32 ttype, FxI32 count, void *pointers)
float **lPtr = (float **)pointers;
FxI32 tCount = 3;
FxU32 fbzModeOld; /* Squirrel away current fbzMode */
FxI32 stride = mode;
FxI32 stride;
FxI32 xindex = (gc->state.vData.vertexInfo.offset >> 2);
FxI32 yindex = xindex + 1;
@@ -1534,8 +1542,10 @@ _grAAVpDrawTriangles(FxI32 mode, FxI32 ttype, FxI32 count, void *pointers)
/* gc->state.invalid |= fbzModeBIT; */
GR_FLUSH_STATE();
if (stride == 0)
if (mode == 0)
stride = gc->state.vData.vStride;
else
stride = sizeof(float *) / sizeof (float);
/* backfaced or zero area */
while (tCount <= count) {
@@ -1703,7 +1713,7 @@ _grAADrawVertexList(FxU32 type, FxI32 mode, FxI32 count, void *pointers)
float *v[3];
FxBool flip = FXFALSE;
FxU32 fbzModeOld; /* Squirrel away current fbzMode */
FxI32 stride = mode;
FxI32 stride;
if (sCount <= 2) return;
@@ -1714,8 +1724,10 @@ _grAADrawVertexList(FxU32 type, FxI32 mode, FxI32 count, void *pointers)
gc->state.shadow.fbzMode &= ~(SST_ZAWRMASK);
/* gc->state.invalid |= fbzModeBIT; */
GR_FLUSH_STATE();
if (stride == 0)
if (mode == 0)
stride = gc->state.vData.vStride;
else
stride = sizeof(float *) / sizeof (float);
sCount-=2;
if (type == kSetupFan) {

View File

@@ -19,6 +19,9 @@
**
** $Header$
** $Log$
** Revision 1.1.1.1.6.1 2005/05/07 08:40:29 jwrdegoede
** lvalue cast fixes for gcc4
**
** Revision 1.1.1.1 1999/11/24 21:44:57 joseph
** Initial checkin for SourceForge
**
@@ -149,7 +152,7 @@ _grDrawVertexList(FxU32 pktype, FxU32 type, FxI32 mode, FxI32 count, void *point
** simplified code
*/
FxU32 vSize;
FxI32 stride = mode;
FxI32 stride;
GR_BEGIN_NOFIFOCHECK(FN_NAME, 90);
@@ -159,8 +162,10 @@ _grDrawVertexList(FxU32 pktype, FxU32 type, FxI32 mode, FxI32 count, void *point
GR_FLUSH_STATE();
vSize = gc->state.vData.vSize;
if (stride == 0)
if (mode == 0)
stride = gc->state.vData.vStride;
else
stride = sizeof(float *) / sizeof (float);
/* Draw the first (or possibly only) set. This is necessary because
the packet is 3_BDDDDDD, and in the next set, the packet is

View File

@@ -793,7 +793,7 @@ _FifoFlush( void )
#undef FN_NAME
} /* _FifoFlush */
FxU32 _grHwFifoPtrSlave(FxU32 slave, FxBool ignored);
unsigned long _grHwFifoPtrSlave(FxU32 slave, FxBool ignored);
void FX_CALL
_grCommandTransportMakeRoom(const FxI32 blockSize, const char* fName, const int fLine)
@@ -1009,11 +1009,11 @@ _grCommandTransportMakeRoom(const FxI32 blockSize, const char* fName, const int
again:
/* do we need to stall? */
{
FxU32 lastHwRead = gc->cmdTransportInfo.fifoRead;
unsigned long lastHwRead = gc->cmdTransportInfo.fifoRead;
FxI32 roomToReadPtr = gc->cmdTransportInfo.roomToReadPtr;
while (roomToReadPtr < blockSize) {
FxU32 curReadPtr = HW_FIFO_PTR(FXTRUE);
unsigned long curReadPtr = HW_FIFO_PTR(FXTRUE);
FxU32 curReadDist = curReadPtr - lastHwRead;
/* Handle slave chips. This code lifted from cvg and modified
@@ -1021,13 +1021,13 @@ _grCommandTransportMakeRoom(const FxI32 blockSize, const char* fName, const int
if(gc->chipCount > 1) {
FxU32 slave;
for(slave = 1; slave < gc->chipCount; slave++) {
const FxU32 slaveReadPtr = _grHwFifoPtrSlave(slave, 0);
const unsigned long slaveReadPtr = _grHwFifoPtrSlave(slave, 0);
const FxU32 slaveReadDist = (slaveReadPtr - lastHwRead);
FxI32 distSlave = (FxI32)slaveReadDist;
FxI32 distMaster = (FxI32)curReadDist;
GR_ASSERT((slaveReadPtr >= (FxU32)gc->cmdTransportInfo.fifoStart) &&
(slaveReadPtr < (FxU32)gc->cmdTransportInfo.fifoEnd));
GR_ASSERT((slaveReadPtr >= (unsigned long)gc->cmdTransportInfo.fifoStart) &&
(slaveReadPtr < (unsigned long)gc->cmdTransportInfo.fifoEnd));
/* Get the actual absolute distance to the respective fifo ptrs */
if (distSlave < 0) distSlave += (FxI32)gc->cmdTransportInfo.fifoSize - FIFO_END_ADJUST;
@@ -1103,8 +1103,8 @@ _grCommandTransportMakeRoom(const FxI32 blockSize, const char* fName, const int
checks = 0;
}
#endif /* GLIDE_DEBUG */
GR_ASSERT((curReadPtr >= (FxU32)gc->cmdTransportInfo.fifoStart) &&
(curReadPtr < (FxU32)gc->cmdTransportInfo.fifoEnd));
GR_ASSERT((curReadPtr >= (unsigned long)gc->cmdTransportInfo.fifoStart) &&
(curReadPtr < (unsigned long)gc->cmdTransportInfo.fifoEnd));
roomToReadPtr += curReadDist;
@@ -1314,11 +1314,9 @@ _grHwFifoPtr(FxBool ignored)
} /* _grHwFifoPtr */
FxU32
unsigned long
_grHwFifoPtrSlave(FxU32 slave, FxBool ignored)
{
FxU32 rVal = 0;
FxU32 status, readPtrL1, readPtrL2;
GR_DCL_GC;
@@ -1332,11 +1330,8 @@ _grHwFifoPtrSlave(FxU32 slave, FxBool ignored)
readPtrL2 = GET(gc->slaveCRegs[slave-1]->cmdFifo0.readPtrL);
} while (readPtrL1 != readPtrL2);
rVal = (((FxU32)gc->cmdTransportInfo.fifoStart) +
readPtrL2 -
(FxU32)gc->cmdTransportInfo.fifoOffset);
return rVal;
return (((unsigned long)gc->cmdTransportInfo.fifoStart) +
readPtrL2 - gc->cmdTransportInfo.fifoOffset);
} /* _grHwFifoPtr */

View File

@@ -1315,7 +1315,7 @@ static FxBool ReadDataLong(FILE *fp, FxU32 *data)
{
FxU8 byte[4];
if (fread(byte, 4, 1, fp) != 4)
if (fread(byte, 1, 4, fp) != 4)
return FXFALSE;
*data = (((FxU32) byte[0]) << 24) |

View File

@@ -595,7 +595,7 @@ _grAADrawPoints(FxI32 mode, FxI32 count, void *pointers)
float *e, ptX, ptY;
FxI32 i, ia;
FxU32 vsize;
FxI32 stride = mode;
FxI32 stride;
FxU32 tmp_cullStripHdr;
GDBG_INFO(94,"_grAADrawPoints(0x%x, %d, 0x%x)\n", mode, count, pointers);
@@ -603,8 +603,10 @@ _grAADrawPoints(FxI32 mode, FxI32 count, void *pointers)
GDBG_INFO_MORE(gc->myLevel, "(count = %d, pointers = 0x%x)\n",
count, pointers);
if (stride == 0)
if (mode == 0)
stride = gc->state.vData.vStride;
else
stride = sizeof(float *) / sizeof (float);
GR_FLUSH_STATE();
@@ -818,7 +820,7 @@ _grAADrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
FxU32 ia;
FxU32 vsize;
FxU32 sCount;
FxI32 stride = mode;
FxI32 stride;
FxU32 tmp_cullStripHdr;
GDBG_INFO(95,"_grAADrawLineStrip(count = %d, pointers = 0x%x)\n",
@@ -831,8 +833,11 @@ _grAADrawLineStrip(FxI32 mode, FxI32 ltype, FxI32 count, void *pointers)
GR_FLUSH_STATE();
if (stride == 0)
if (mode == 0)
stride = gc->state.vData.vStride;
else
stride = sizeof(float *) / sizeof (float);
if (ltype == GR_LINES)
sCount = count >> 1; /* line list */
else
@@ -1350,7 +1355,7 @@ _grAADrawTriangles(FxI32 mode, FxI32 ttype, FxI32 count, void *pointers)
float **lPtr = (float **)pointers;
FxI32 tCount = 3;
FxU32 fbzModeOld; /* Squirrel away current fbzMode */
FxI32 stride = mode;
FxI32 stride;
FxI32 xindex = (gc->state.vData.vertexInfo.offset >> 2);
FxI32 yindex = xindex + 1;
@@ -1367,8 +1372,10 @@ _grAADrawTriangles(FxI32 mode, FxI32 ttype, FxI32 count, void *pointers)
/* gc->state.invalid |= fbzModeBIT; */
GR_FLUSH_STATE();
if (stride == 0)
if (mode == 0)
stride = gc->state.vData.vStride;
else
stride = sizeof(float *) / sizeof (float);
/* backfaced or zero area */
while (tCount <= count) {
@@ -1523,7 +1530,7 @@ _grAAVpDrawTriangles(FxI32 mode, FxI32 ttype, FxI32 count, void *pointers)
float **lPtr = (float **)pointers;
FxI32 tCount = 3;
FxU32 fbzModeOld; /* Squirrel away current fbzMode */
FxI32 stride = mode;
FxI32 stride;
FxI32 xindex = (gc->state.vData.vertexInfo.offset >> 2);
FxI32 yindex = xindex + 1;
@@ -1540,8 +1547,10 @@ _grAAVpDrawTriangles(FxI32 mode, FxI32 ttype, FxI32 count, void *pointers)
/* gc->state.invalid |= fbzModeBIT; */
GR_FLUSH_STATE();
if (stride == 0)
if (mode == 0)
stride = gc->state.vData.vStride;
else
stride = sizeof(float *) / sizeof (float);
/* backfaced or zero area */
while (tCount <= count) {
@@ -1709,7 +1718,7 @@ _grAADrawVertexList(FxU32 type, FxI32 mode, FxI32 count, void *pointers)
float *v[3];
FxBool flip = FXFALSE;
FxU32 fbzModeOld; /* Squirrel away current fbzMode */
FxI32 stride = mode;
FxI32 stride;
if (sCount <= 2) return;
@@ -1720,8 +1729,10 @@ _grAADrawVertexList(FxU32 type, FxI32 mode, FxI32 count, void *pointers)
gc->state.shadow.fbzMode &= ~(SST_ZAWRMASK);
/* gc->state.invalid |= fbzModeBIT; */
GR_FLUSH_STATE();
if (stride == 0)
if (mode == 0)
stride = gc->state.vData.vStride;
else
stride = sizeof(float *) / sizeof (float);
sCount-=2;
if (type == kSetupFan) {

View File

@@ -223,7 +223,7 @@
#define OUTBOUNDS(a) (OUTBOUNDSX(a) || OUTBOUNDSY(a))
/* access an array of four-byte opaque datums with a byte index */
#define ARRAY(p,i) (*(int *)((i)+(int)(p)))
#define ARRAY(p,i) (*(int *)((i)+(long)(p)))
/*---------------------------------------------------------------------------
** grDrawPoint
@@ -275,34 +275,17 @@ GR_ENTRY(grDrawPoint, void, (const void *p))
GR_ENTRY(grDrawLine, void, (const void *a, const void *b))
{
const void *verts[2];
#define FN_NAME "grDrawLine"
GR_BEGIN_NOFIFOCHECK(FN_NAME, 91);
GDBG_INFO_MORE(gc->myLevel, "(a = 0x%x, b = 0x%x)\n", a, b);
#if defined (__POWERPC__) || defined(__ia64__)
{
const void *verts[2];
verts[0] = a; verts[1] = b;
if (gc->state.grEnableArgs.primitive_smooth_mode & GR_AA_ORDERED_LINES_MASK)
_grAADrawLineStrip(GR_VTX_PTR_ARRAY, GR_LINES, 2, verts);
else
_grDrawLineStrip(GR_VTX_PTR_ARRAY, GR_LINES, 2, verts);
}
#else /* WARNING: this makes assumptions about the stack layout */
#ifdef __GNUC__
if (gc->state.grEnableArgs.primitive_smooth_mode & GR_AA_ORDERED_LINES_MASK)
_grAADrawLineStrip(GR_VTX_PTR_ARRAY, GR_LINES, 2, (void *)&a);
else
_grDrawLineStrip(GR_VTX_PTR_ARRAY, GR_LINES, 2, (void *)&a);
#else /* __GNUC__ */
if (gc->state.grEnableArgs.primitive_smooth_mode & GR_AA_ORDERED_LINES_MASK)
_grAADrawLineStrip(GR_VTX_PTR_ARRAY, GR_LINES, 2, &(void *)a);
else
_grDrawLineStrip(GR_VTX_PTR_ARRAY, GR_LINES, 2, &(void *)a);
#endif /* __GNUC__ */
#endif
#undef FN_NAME
} /* grDrawLine */

View File

@@ -19,6 +19,9 @@
**
** $Header$
** $Log$
** Revision 1.7.4.23 2005/06/09 18:32:32 jwrdegoede
** Fixed all warnings with gcc4 -Wall -W -Wno-unused-parameter, except for a couple I believe to be a gcc bug. This has been reported to gcc.
**
** Revision 1.7.4.22 2005/05/25 08:56:26 jwrdegoede
** Make h5 and h3 tree 64 bit clean. This is ported over from the non-devel branch so this might be incomplete
**
@@ -1640,7 +1643,7 @@ static FxBool _grLfbLock (GrLock_t type, GrBuffer_t buffer,
if(gc->textureBuffer.on &&
(buffer == GR_BUFFER_TEXTUREBUFFER_EXT || buffer == GR_BUFFER_TEXTUREAUXBUFFER_EXT)) {
if(type == GR_LFB_READ_ONLY) {
info->lfbPtr = (void *)((FxU32)gc->rawLfb + gc->textureBuffer.addr);
info->lfbPtr = (void *)((unsigned long)gc->rawLfb + gc->textureBuffer.addr);
info->strideInBytes = gc->textureBuffer.stride;
#if __POWERPC__
if(IS_NAPALM(gc->bInfo->pciInfo.deviceID)) {
@@ -1662,7 +1665,7 @@ static FxBool _grLfbLock (GrLock_t type, GrBuffer_t buffer,
(!pixelPipeline) &&
/* Origin must be upper left since we will return raw lfb */
(origin != GR_ORIGIN_LOWER_LEFT)) {
info->lfbPtr = (void *)((FxU32)gc->rawLfb + gc->textureBuffer.addr);
info->lfbPtr = (void *)((unsigned long)gc->rawLfb + gc->textureBuffer.addr);
info->strideInBytes = gc->textureBuffer.stride;
}
#endif
@@ -2240,7 +2243,7 @@ _grLfbWriteRegion(FxBool pixPipelineP,
info.size = sizeof(info);
#define SET_LFB_STRAIGHT (!HAL_CSIM && !SET_SWIZZLEHACK && !SET_BSWAP) /* Hack alert: more tests? */
#define SET_LFB_STRAIGHT (!HAL_CSIM && !SET_SWIZZLEHACK && !SET_BSWAP && GL_X86) /* Hack alert: more tests? */
if (_grLfbLock(GR_LFB_WRITE_ONLY_EXPLICIT_EXT,
dst_buffer,
writeMode,
@@ -2270,7 +2273,6 @@ _grLfbWriteRegion(FxBool pixPipelineP,
case GR_LFB_SRC_FMT_ZA16:
dstData = (FxU32*)(((FxU16*)dstData) + dst_x);
#if SET_LFB_STRAIGHT
#if GL_X86
if (_GlideRoot.CPUType.os_support & _CPU_FEATURE_MMX) {
do {
MMX_DSTLINE2(srcData, dstData, src_width);
@@ -2282,7 +2284,6 @@ _grLfbWriteRegion(FxBool pixPipelineP,
break;
}
else
#endif
{
do {
FPU_DSTLINE2(srcData, dstData, src_width);
@@ -2354,7 +2355,6 @@ _grLfbWriteRegion(FxBool pixPipelineP,
case GR_LFBWRITEMODE_Z32:
dstData = ((FxU32*)dstData) + dst_x;
#if SET_LFB_STRAIGHT
#if GL_X86
if (_GlideRoot.CPUType.os_support & _CPU_FEATURE_MMX) {
do {
MMX_DSTLINE4(srcData, dstData, src_width);
@@ -2366,7 +2366,6 @@ _grLfbWriteRegion(FxBool pixPipelineP,
break;
}
else
#endif
{
do {
FPU_DSTLINE4(srcData, dstData, src_width);
@@ -2521,19 +2520,12 @@ static FxBool grLfbReadRegionOrigin (GrBuffer_t src_buffer, GrOriginLocation_t o
GR_ORIGIN_UPPER_LEFT,
FXFALSE,
&info)) {
FxU32 *src;
FxI32 len;
#if 0
FxU32 *dst;
FxU32 src_adjust,dst_adjust,tmp;
#endif
src=(FxU32 *) (((char*)info.lfbPtr)+
FxU32 *src=(FxU32 *) (((char*)info.lfbPtr)+
(src_y*info.strideInBytes) + (src_x * bpp));
len = src_width * bpp;
FxI32 len = src_width * bpp;
if(!gc->state.forced32BPP) {
#if GL_X86
if(!gc->state.forced32BPP) {
if(_GlideRoot.CPUType.os_support & _CPU_FEATURE_MMX) {
do {
MMX_SRCLINE(src, dst_data, len);
@@ -2544,7 +2536,6 @@ static FxBool grLfbReadRegionOrigin (GrBuffer_t src_buffer, GrOriginLocation_t o
MMX_RESET();
}
else
#endif
{
do {
FPU_SRCLINE(src, dst_data, len);
@@ -2553,14 +2544,13 @@ static FxBool grLfbReadRegionOrigin (GrBuffer_t src_buffer, GrOriginLocation_t o
dst_data = (FxU32 *)((FxU8 *)dst_data + dst_stride);
} while (--src_height);
}
goto okay;
}
#if 0
dst=dst_data;
#else
FxU32 *dst=dst_data;
FxU32 src_adjust,dst_adjust,tmp;
/* set length - alignment fix*/
tmp=(((FxU32)src)&2);
tmp=((unsigned long)src)&2;
len -= tmp;
src_adjust=info.strideInBytes - tmp;
dst_adjust=dst_stride - tmp;
@@ -2571,7 +2561,7 @@ static FxBool grLfbReadRegionOrigin (GrBuffer_t src_buffer, GrOriginLocation_t o
if(!gc->state.forced32BPP) {
while(src_height--) {
/* adjust starting alignment */
if (((FxU32)src)&3) {
if (((unsigned long)src)&3) {
/* Old code: *((FxU16 *)dst)++ = *((FxU16 *)src)++; */
FxU16 *p = (FxU16 *)dst;
*p = *((FxU16 *)src);
@@ -2586,12 +2576,12 @@ static FxBool grLfbReadRegionOrigin (GrBuffer_t src_buffer, GrOriginLocation_t o
/* copies aligned dwords */
do {
*((FxU32 *)(((FxU32)dst) + byte_index))=*((FxU32 *)(((FxU32)src) + byte_index));
*((FxU32 *)(((unsigned long)dst) + byte_index))=*((FxU32 *)(((unsigned long)src) + byte_index));
} while((byte_index+=4)<aligned);
/* handle backend misalignment */
if(byte_index!=(FxU32)len) {
*((FxU16 *)(((FxU32)dst) + byte_index))=*((FxU16 *)(((FxU32)src) + byte_index));
*((FxU16 *)(((unsigned long)dst) + byte_index))=*((FxU16 *)(((unsigned long)src) + byte_index));
}
}
/* adjust for next line */
@@ -2611,11 +2601,11 @@ static FxBool grLfbReadRegionOrigin (GrBuffer_t src_buffer, GrOriginLocation_t o
/* copies aligned dwords */
do {
FxU32 s =*((FxU32 *)(((FxU32)src) + byte_index));
FxU32 s =*((FxU32 *)(((unsigned long)src) + byte_index));
FxU16 d = (FxU16) (s & 0xF8) >> 3;
d |= (s & 0xFC00) >> 5;
d |= (s & 0xF80000) >> 8;
*((FxU16 *)(((FxU32)dst_data) + (byte_index2))) = d;
*((FxU16 *)(((unsigned long)dst_data) + (byte_index2))) = d;
byte_index +=4;
} while((byte_index2+=2)<(src_width*2));
}
@@ -2633,11 +2623,11 @@ static FxBool grLfbReadRegionOrigin (GrBuffer_t src_buffer, GrOriginLocation_t o
/* copies aligned dwords */
do {
FxU32 s =*((FxU32 *)(((FxU32)src) + byte_index));
FxU32 s =*((FxU32 *)(((unsigned long)src) + byte_index));
FxU16 d = (FxU16) (s & 0xF8) >> 3;
d |= (s & 0xF800) >> 6;
d |= (s & 0xF80000) >> 9;
*((FxU16 *)(((FxU32)dst_data) + (byte_index2))) = d;
*((FxU16 *)(((unsigned long)dst_data) + (byte_index2))) = d;
byte_index +=4;
} while((byte_index2+=2)<(src_width*2));
}
@@ -2647,8 +2637,6 @@ static FxBool grLfbReadRegionOrigin (GrBuffer_t src_buffer, GrOriginLocation_t o
dst_data = (FxU32 *)((FxU8 *)dst_data + dst_stride);
}
}
okay:
rv=FXTRUE;
/* unlock buffer */
_grLfbUnlock(GR_LFB_READ_ONLY,src_buffer);
@@ -2804,4 +2792,16 @@ GR_ENTRY(grLfbReadRegion, FxBool, (GrBuffer_t src_buffer,
GR_RETURN(rv);
#undef FN_NAME
}/* grLfbReadRegion */
/* grLfbReadRegionOrigin, just call grLfbReadRegion, ignoring the origin
argument, since it is ignored by the X86 version too. */
static FxBool grLfbReadRegionOrigin (GrBuffer_t src_buffer, GrOriginLocation_t origin,
FxU32 src_x, FxU32 src_y,
FxU32 src_width, FxU32 src_height,
FxU32 dst_stride, void *dst_data)
{
return grLfbReadRegion(src_buffer, src_x, src_y, src_width, src_height,
dst_stride, dst_data);
}
#endif /* if __POWERPC__ */

View File

@@ -173,7 +173,7 @@ _grDrawVertexList(FxU32 pktype, FxU32 type, FxI32 mode, FxI32 count, void *point
** simplified code
*/
FxU32 vSize;
FxI32 stride = mode;
FxI32 stride;
GR_BEGIN_NOFIFOCHECK(FN_NAME, 90);
@@ -183,8 +183,10 @@ _grDrawVertexList(FxU32 pktype, FxU32 type, FxI32 mode, FxI32 count, void *point
GR_FLUSH_STATE();
vSize = gc->state.vData.vSize;
if (stride == 0)
if (mode == 0)
stride = gc->state.vData.vStride;
else
stride = sizeof(float *) / sizeof (float);
/* Draw the first (or possibly only) set. This is necessary because
the packet is 3_BDDDDDD, and in the next set, the packet is

View File

@@ -349,8 +349,9 @@ typedef struct hwcFifoInfo_s {
FxBool
agpFifo,
initialized;
unsigned long
agpVirtAddr;
FxU32
agpVirtAddr,
agpPhysAddr,
agpSize,
fifoStart, /* Beg of fifo (offset from base) */

View File

@@ -32,7 +32,7 @@
# DEBUG=1 enable debugging checks and messages
# target = sst1, sst96, cvg, h3, h5
# default = no
# USE_X86=1 use assembler triangle specializations; req by CVG
# USE_X86=1 use assembler triangle specializations
# target = sst1, sst96, cvg, h3, h5
# default = no
# USE_3DNOW=1 allow 3DNow! specializations. However, the true CPU

View File

@@ -19,6 +19,9 @@
**
** $Header$
** $Log$
** Revision 1.1.2.3 2005/06/09 18:32:35 jwrdegoede
** Fixed all warnings with gcc4 -Wall -W -Wno-unused-parameter, except for a couple I believe to be a gcc bug. This has been reported to gcc.
**
** Revision 1.1.2.2 2004/10/04 09:35:59 dborca
** second cut at Glide3x for Voodoo1/Rush (massive update):
** delayed validation, vertex snapping, clip coordinates, strip/fan_continue, bugfixes.
@@ -623,7 +626,7 @@ static FxBool ReadDataLong(FILE *fp, FxU32 *data)
{
FxU8 byte[4];
if (fread(byte, 4, 1, fp) != 4)
if (fread(byte, 1, 4, fp) != 4)
return FXFALSE;
*data = (((FxU32) byte[0]) << 24) |

View File

@@ -53,7 +53,7 @@ typedef struct { float r, g, b, a; } FxColor4;
** helper macros
*/
#define FXUNUSED( a ) ((void)(a))
#define FXBIT( i ) ( 1L << (i) )
#define FXBIT( i ) ( 1 << (i) )
/*
** export macros

View File

@@ -56,7 +56,7 @@ static struct {
struct {
FxBool
mapped;
FxU32
unsigned long
addr;
} addrList[MAX_PCI_BASEADDRESSES];
} linearAddressMapList[MAX_PCI_DEVICES];
@@ -280,15 +280,17 @@ _pciUpdateRegister( FxU32 offset, FxU32 data, FxU32 size_in_bytes,
return;
} /* _pciUpdateRegister */
static FxU32
static unsigned long
find_mapped_address(FxU32 device_bus_func_number, FxU32 addrNum)
{
FxU32
i,
i;
unsigned long
retVal = 0x00UL;
for(i = 0; i < MAX_PCI_DEVICES; i++) {
if (linearAddressMapList[i].device_bus_func_number == device_bus_func_number) {
if ((linearAddressMapList[i].device_bus_func_number == device_bus_func_number) &&
linearAddressMapList[i].addrList[addrNum].mapped) {
retVal = linearAddressMapList[i].addrList[addrNum].addr;
break;
@@ -299,7 +301,7 @@ find_mapped_address(FxU32 device_bus_func_number, FxU32 addrNum)
}
static void
set_mapped_address(FxU32 device_bus_func_number, FxU32 addrNum, FxU32 value)
set_mapped_address(FxU32 device_bus_func_number, FxU32 addrNum, unsigned long value)
{
FxU32 i;

View File

@@ -158,12 +158,12 @@ _txImgDequantizeRGB332(FxU32 *out, FxU8 *in, int w, int h)
}
static void
_txImgDequantizeYIQ422(FxU32 *out, FxU8 *in, int w, int h, const long *yabTable)
_txImgDequantizeYIQ422(FxU32 *out, FxU8 *in, int w, int h, const int *yabTable)
{
int n = w * h;
FxU32 pal[256];
txYABtoPal256((long *)pal, (long *)yabTable);
txYABtoPal256((int *)pal, (int *)yabTable);
out += n;
in += n;
while (n--) *--out = pal[*--in] | 0xff000000;
@@ -221,10 +221,10 @@ _txImgDequantizeARGB8332(FxU32 *out, FxU16 *in, int w, int h)
}
static void
_txImgDequantizeAYIQ8422(FxU32 *out, FxU16 *in, int w, int h, const long *yab)
_txImgDequantizeAYIQ8422(FxU32 *out, FxU16 *in, int w, int h, const int *yab)
{
int n = w * h;
long pal[256];
int pal[256];
txYABtoPal256(pal, yab);
out += n;
@@ -341,10 +341,10 @@ _txImgDequantizeRGB888(FxU32 *out, FxU32 *in_, int w, int h)
}
static void
_txCalcRGBFromYUV(unsigned long y, unsigned long u, unsigned long v, FxU32 *rgb)
_txCalcRGBFromYUV(unsigned int y, unsigned int u, unsigned int v, FxU32 *rgb)
{
FxI32 r, g, b;
long y16, u128, v128;
int y16, u128, v128;
y16 = y - 16;
u128 = u - 128;
@@ -388,7 +388,7 @@ void
_txImgDequantizeYUV(FxU32 *out, FxU16 *in, int w, int h, FxU32 format)
{
int i, j, k;
unsigned long Y[2], UV[2];
unsigned int Y[2], UV[2];
k = w * h;
@@ -432,7 +432,7 @@ void
_txImgDequantizeAYUV(FxU32 *out, FxU32 *in, int w, int h)
{
int i, k;
unsigned long y, u, v;
unsigned int y, u, v;
k = w * h;
@@ -489,13 +489,13 @@ txMipDequantize(TxMip *txMip, TxMip *pxMip)
switch(pxMip->format) {
case GR_TEXFMT_RGB_332: _txImgDequantizeRGB332(dst, src, w, h); break;
case GR_TEXFMT_YIQ_422: _txImgDequantizeYIQ422(dst, src, w, h, (long *)pxMip->pal); break;
case GR_TEXFMT_YIQ_422: _txImgDequantizeYIQ422(dst, src, w, h, (int *)pxMip->pal); break;
case GR_TEXFMT_A_8: _txImgDequantizeA8(dst, src, w, h); break;
case GR_TEXFMT_I_8: _txImgDequantizeI8(dst, src, w, h); break;
case GR_TEXFMT_AI_44: _txImgDequantizeAI44(dst, src, w, h); break;
case GR_TEXFMT_P_8: _txImgDequantizeP8(dst, src, w, h, pxMip->pal); break;
case GR_TEXFMT_ARGB_8332: _txImgDequantizeARGB8332(dst, src, w, h); break;
case GR_TEXFMT_AYIQ_8422: _txImgDequantizeAYIQ8422(dst, src, w, h, (long *)pxMip->pal); break;
case GR_TEXFMT_AYIQ_8422: _txImgDequantizeAYIQ8422(dst, src, w, h, (int *)pxMip->pal); break;
case GR_TEXFMT_RGB_565: _txImgDequantizeRGB565(dst, src, w, h); break;
case GR_TEXFMT_ARGB_1555: _txImgDequantizeARGB1555(dst, src, w, h); break;
case GR_TEXFMT_ARGB_4444: _txImgDequantizeARGB4444(dst, src, w, h); break;

View File

@@ -32,7 +32,7 @@
#define B3(x) ((x>>0)&0xFF)
static void
_txImgHalve(long *outdata, int width, int height, long *indata)
_txImgHalve(int *outdata, int width, int height, int *indata)
{
unsigned int i,j,k;
unsigned int w,h, *p,sum,*q;

View File

@@ -39,7 +39,7 @@ static struct {
} ncc;
static int
_txPixQuantize_YIQ422 (unsigned long argb, int x, int y, int w)
_txPixQuantize_YIQ422 (unsigned int argb, int x, int y, int w)
{
int r, g, b;
int iy, ii, iq;
@@ -76,7 +76,7 @@ _txPixQuantize_YIQ422 (unsigned long argb, int x, int y, int w)
static int
_txPixQuantize_YIQ422_D4x4 (unsigned long argb, int x, int y, int w)
_txPixQuantize_YIQ422_D4x4 (unsigned int argb, int x, int y, int w)
{
int r, g, b;
int iy, ii, iq;
@@ -121,10 +121,10 @@ _txPixQuantize_YIQ422_D4x4 (unsigned long argb, int x, int y, int w)
}
static void
_txImgNcc(char *odata, unsigned long *idata, int w, int h, int format,
_txImgNcc(char *odata, unsigned int *idata, int w, int h, int format,
int dither)
{
int (*quantizer)(unsigned long argb, int x, int y, int w);
int (*quantizer)(unsigned int argb, int x, int y, int w);
int x, y, pixsize;
quantizer = (dither) ? _txPixQuantize_YIQ422_D4x4 : _txPixQuantize_YIQ422;
@@ -305,7 +305,7 @@ txMipNcc(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 compression
if ((dither & TX_DITHER_MASK) == TX_DITHER_ERR) {
txYABtoPal256((long *)pxMip->pal, (long *) &ncc.y[0]);
txYABtoPal256((int *)pxMip->pal, (int *) &ncc.y[0]);
txDiffuseIndex(pxMip, txMip, pixsize, pxMip->pal, 256);
}
else {

View File

@@ -85,19 +85,19 @@
#define MAX_NEURONS 256
typedef struct _weight {
long r, g, b; // fixed point, SUBPIXEL precision bits
int r, g, b; // fixed point, SUBPIXEL precision bits
int ir, ig, ib; // pure integers, maybe -256 to 255.
} Weight;
typedef struct _vector {
Weight *py, *pa, *pb;
long r, g, b; // pure integers, 0 to 255.
int r, g, b; // pure integers, 0 to 255.
} Neuron;
static Weight Y[16], A[4], B[4];
static Neuron N[MAX_NEURONS];
static long errR, errG, errB, errMax;
static long totR, totG, totB;
static int errR, errG, errB, errMax;
static int totR, totG, totB;
#define SUBPIXEL 22
@@ -111,12 +111,12 @@ static long totR, totG, totB;
x = ((256 << SUBPIXEL) -1)
static int
_nn_modifyNeurons(long ir, long ig, long ib)
_nn_modifyNeurons(int ir, int ig, int ib)
{
int i;
int d0, d1; // closest & next closest distance to input
int p0, p1; // index into the 256 color table.
long d, dr, dg, db;
int d, dr, dg, db;
Weight *py, *pa, *pb;
Neuron *n;
@@ -219,7 +219,7 @@ _nn_initTables()
// Intensity ramp
for (i=0; i<16; i++) {
Y[i].r = ((long) ((255.0f * i)/15.0f)) << SUBPIXEL;
Y[i].r = ((int) ((255.0f * i)/15.0f)) << SUBPIXEL;
Y[i].ir = INT(Y[i].r);
}
@@ -265,10 +265,10 @@ static void
txMapPal256toYAB(FxU32 *YAB, FxU8 *map, int nsamples, FxU32 *samples)
{
int i;
long bstR, bstG, bstB, bstMax;
int bstR, bstG, bstB, bstMax;
int iterations; // track how many inputs have been fed to NN
int drySpells; // how many inputs since last best case.
long yab2pal[256];
int yab2pal[256];
_nn_initTables();
/*
@@ -364,7 +364,7 @@ txMapPal256toYAB(FxU32 *YAB, FxU8 *map, int nsamples, FxU32 *samples)
* Replace MSB of samples with index to be used with YAB table.
*/
txYABtoPal256((long*)yab2pal, (long*)YAB);
txYABtoPal256((int*)yab2pal, (int*)YAB);
for (i=0; i<nsamples; i++) {
int ir, ig, ib;
@@ -385,7 +385,7 @@ txMipNccNNet(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 comp)
int i, w, h;
int ncolors;
int pixsize = (pxMip->format == GR_TEXFMT_YIQ_422) ? 1 : 2;
long yabTable[16+12+12];
int yabTable[16+12+12];
FxU8 map[256];
@@ -409,7 +409,7 @@ txMipNccNNet(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 comp)
txMapPal256toYAB((FxU32 *)yabTable, (FxU8 *)map, ncolors, (FxU32 *)pxMip->pal);
if( txVerbose )
{
printf("eMax=(%3ld%3ld%3ld)...eAvg=(%3ld%3ld%3ld)\n",
printf("eMax=(%3d%3d%3d)...eAvg=(%3d%3d%3d)\n",
errG, errR, errB,
totG/ncolors, totR/ncolors, totB/ncolors
);
@@ -422,7 +422,7 @@ txMipNccNNet(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 comp)
* the 256 color palette generated from the YAB table. This will be
* useful for error diffusion dithering.
*/
txYABtoPal256((long *)pxMip->pal, (long *)yabTable);
txYABtoPal256((int *)pxMip->pal, (int *)yabTable);
txDiffuseIndex(pxMip, txMip, pixsize, pxMip->pal, 256);
}
else {

View File

@@ -52,7 +52,7 @@
unsigned char inverse_pal[1<<INVERSE_PAL_TOTAL_BITS];
#endif
typedef unsigned long ulong;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned short ushort;
@@ -81,20 +81,20 @@ typedef unsigned short ushort;
typedef struct {
float weightedvar; /* weighted variance */
ulong mean[3]; /* centroid */
ulong weight; /* # of pixels in box */
ulong freq[3][MAXCOLORS]; /* Projected frequencies */
uint mean[3]; /* centroid */
uint weight; /* # of pixels in box */
uint freq[3][MAXCOLORS]; /* Projected frequencies */
int low[3], high[3]; /* Box extent */
} Box;
#define COLORMAXI ( 1 << NBITS )
#if 0
static ulong *Histogram; /* image histogram */
static uint *Histogram; /* image histogram */
#else
static ulong Histogram[COLORMAXI*COLORMAXI*COLORMAXI * sizeof(long)];
static uint Histogram[COLORMAXI*COLORMAXI*COLORMAXI * sizeof(int)];
#endif
static ulong SumPixels; /* total # of pixels */
static ulong ColormaxI; /* # of colors, 2^Bits */
static uint SumPixels; /* total # of pixels */
static uint ColormaxI; /* # of colors, 2^Bits */
static Box _Boxes[MAXCOLORS];
static Box *Boxes; /* Array of color boxes. */
@@ -106,7 +106,7 @@ static int CutBox(Box *box, Box *newbox);
static void BoxStats(Box *box);
static int GreatestVariance(Box *boxes, int n);
static int CutBoxes(Box *boxes, int colors);
static void QuantHistogram(ulong *pixels, int npixels, Box *box);
static void QuantHistogram(uint *pixels, int npixels, Box *box);
/*
* Perform variance-based color quantization on a 24-bit image.
@@ -133,17 +133,17 @@ txMipPal256(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 compress
Boxes = _Boxes;
#if 0
Histogram = (ulong *) txMalloc(ColormaxI*ColormaxI*ColormaxI * sizeof(long));
Histogram = (uint *) txMalloc(ColormaxI*ColormaxI*ColormaxI * sizeof(int));
rgbmap = txMalloc((1<<NBITS)*(1<<NBITS)*(1<<NBITS));
#endif
/*
* Zero-out the projected frequency arrays of the largest box.
*/
bzero(Boxes->freq[0], ColormaxI * sizeof(ulong));
bzero(Boxes->freq[1], ColormaxI * sizeof(ulong));
bzero(Boxes->freq[2], ColormaxI * sizeof(ulong));
bzero(Histogram, ColormaxI * ColormaxI * ColormaxI * sizeof(long));
bzero(Boxes->freq[0], ColormaxI * sizeof(uint));
bzero(Boxes->freq[1], ColormaxI * sizeof(uint));
bzero(Boxes->freq[2], ColormaxI * sizeof(uint));
bzero(Histogram, ColormaxI * ColormaxI * ColormaxI * sizeof(int));
/* Feed all bitmaps & generate histogram */
SumPixels = 0;
@@ -151,7 +151,7 @@ txMipPal256(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 compress
h = txMip->height;
for (i=0; i< txMip->depth; i++) {
SumPixels += w * h;
QuantHistogram((ulong *)txMip->data[i], w * h, &Boxes[0]);
QuantHistogram((uint *)txMip->data[i], w * h, &Boxes[0]);
if (w > 1) w >>= 1;
if (h > 1) h >>= 1;
}
@@ -164,10 +164,10 @@ txMipPal256(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 compress
* from their 'prequantized' range to 0-FULLINTENSITY.
*/
for (i = 0; i < OutColors; i++) {
ulong r, g, b;
r = (ulong)(Boxes[i].mean[REDI] * Cfactor + 0.5);
g = (ulong)(Boxes[i].mean[GREENI] * Cfactor + 0.5);
b = (ulong)(Boxes[i].mean[BLUEI] * Cfactor + 0.5);
uint r, g, b;
r = (uint)(Boxes[i].mean[REDI] * Cfactor + 0.5);
g = (uint)(Boxes[i].mean[GREENI] * Cfactor + 0.5);
b = (uint)(Boxes[i].mean[BLUEI] * Cfactor + 0.5);
/*
r &= 0xff;
@@ -196,11 +196,11 @@ txMipPal256(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 compress
h = txMip->height;
for (i=0; i< txMip->depth; i++) {
ulong *src;
uint *src;
uchar *dst;
int n;
src = (ulong *) txMip->data[i];
src = (uint *) txMip->data[i];
dst = (uchar *) pxMip->data[i];
n = w * h;
while (n--) {
@@ -240,9 +240,9 @@ txMipPal256(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 compress
* arrays for the first world-encompassing box.
*/
static void
QuantHistogram(ulong *pixels, int npixels, Box *box)
QuantHistogram(uint *pixels, int npixels, Box *box)
{
ulong *rf, *gf, *bf;
uint *rf, *gf, *bf;
uchar rr, gg, bb;
int i;
@@ -320,7 +320,7 @@ static void
BoxStats(Box *box)
{
int i, color;
ulong *freq;
uint *freq;
float mean, var;
if(box->weight == 0) {
@@ -337,7 +337,7 @@ BoxStats(Box *box)
mean += (float) i * *freq;
var += (float) i*i* *freq;
}
box->mean[color] = (unsigned long) (mean / (float)box->weight);
box->mean[color] = (unsigned int) (mean / (float)box->weight);
box->weightedvar += var - box->mean[color]*box->mean[color]*
(float)box->weight;
}
@@ -405,7 +405,7 @@ FindCutpoint(Box *box, int color, Box *newbox1, Box *newbox2)
{
float u, v, max;
int i, maxindex, minindex, cutpoint;
ulong optweight, curweight;
uint optweight, curweight;
if (box->low[color] + 1 == box->high[color])
return FALSE; /* Cannot be cut. */
@@ -455,13 +455,13 @@ FindCutpoint(Box *box, int color, Box *newbox1, Box *newbox2)
static void
UpdateFrequencies(Box *box1, Box *box2)
{
ulong myfreq, *h;
uint myfreq, *h;
int b, g, r;
int roff;
bzero(box1->freq[0], ColormaxI * sizeof(ulong));
bzero(box1->freq[1], ColormaxI * sizeof(ulong));
bzero(box1->freq[2], ColormaxI * sizeof(ulong));
bzero(box1->freq[0], ColormaxI * sizeof(uint));
bzero(box1->freq[1], ColormaxI * sizeof(uint));
bzero(box1->freq[2], ColormaxI * sizeof(uint));
for (r = box1->low[0]; r < box1->high[0]; r++) {
roff = r << NBITS;
@@ -525,25 +525,25 @@ SetRGBmap(int boxnum, Box *box, uchar *rgbmap)
unsigned char _txPixTrueToFixedPal( void *pix, const FxU32 *pal )
{
int i;
long min_dist;
int min_dist;
int min_index;
long r, g, b;
int r, g, b;
min_dist = 256 * 256 + 256 * 256 + 256 * 256;
min_index = -1;
/* 0 1 2 */
r = ( long )( ( unsigned char * )pix )[2];
g = ( long )( ( unsigned char * )pix )[1];
b = ( long )( ( unsigned char * )pix )[0];
r = ( int )( ( unsigned char * )pix )[2];
g = ( int )( ( unsigned char * )pix )[1];
b = ( int )( ( unsigned char * )pix )[0];
for( i = 0; i < 256; i++ )
{
long palr, palg, palb, dist;
long dr, dg, db;
int palr, palg, palb, dist;
int dr, dg, db;
palr = ( long )( ( pal[i] & 0x00ff0000 ) >> 16 );
palg = ( long )( ( pal[i] & 0x0000ff00 ) >> 8 );
palb = ( long )( pal[i] & 0x000000ff );
palr = ( int )( ( pal[i] & 0x00ff0000 ) >> 16 );
palg = ( int )( ( pal[i] & 0x0000ff00 ) >> 8 );
palb = ( int )( pal[i] & 0x000000ff );
dr = palr - r;
dg = palg - g;
db = palb - b;
@@ -565,18 +565,18 @@ unsigned char _txPixTrueToFixedPal( void *pix, const FxU32 *pal )
void _txImgTrueToFixedPal( unsigned char *dst, unsigned char *src, const FxU32 *pal,
int w, int h, FxU32 flags )
{
long i;
int i;
for( i = 0; i < w * h; i++ )
{
if( flags == TX_FIXED_PAL_QUANT_TABLE )
{
unsigned long index;
unsigned long r_index, g_index, b_index;
unsigned int index;
unsigned int r_index, g_index, b_index;
r_index = ( ( ( unsigned long )src[i*4+2] ) >> ( 8 - INVERSE_PAL_R_BITS ) );
g_index = ( ( ( unsigned long )src[i*4+1] ) >> ( 8 - INVERSE_PAL_G_BITS ) );
b_index = ( ( ( unsigned long )src[i*4+0] ) >> ( 8 - INVERSE_PAL_B_BITS ) );
r_index = ( ( ( unsigned int )src[i*4+2] ) >> ( 8 - INVERSE_PAL_R_BITS ) );
g_index = ( ( ( unsigned int )src[i*4+1] ) >> ( 8 - INVERSE_PAL_G_BITS ) );
b_index = ( ( ( unsigned int )src[i*4+0] ) >> ( 8 - INVERSE_PAL_B_BITS ) );
index =
( r_index << ( INVERSE_PAL_G_BITS + INVERSE_PAL_B_BITS ) ) |
( g_index << INVERSE_PAL_B_BITS ) |
@@ -592,8 +592,8 @@ void _txImgTrueToFixedPal( unsigned char *dst, unsigned char *src, const FxU32 *
void _CreateInversePal( const FxU32 *pal )
{
long r, g, b;
long index = 0;
int r, g, b;
int index = 0;
unsigned char true_color[4];
true_color[3] = 0;

View File

@@ -40,7 +40,7 @@
#include "texusint.h"
typedef unsigned long ulong;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned short ushort;
@@ -82,9 +82,9 @@ typedef unsigned short ushort;
typedef struct {
float weightedvar; /* weighted variance */
ulong mean[NCOMP]; /* centroid */
ulong weight; /* # of pixels in box */
ulong freq[NCOMP][MAXCOLORS]; /* Projected frequencies */
uint mean[NCOMP]; /* centroid */
uint weight; /* # of pixels in box */
uint freq[NCOMP][MAXCOLORS]; /* Projected frequencies */
int low[NCOMP], high[NCOMP]; /* Box extent */
} Box;
@@ -94,12 +94,12 @@ static uchar inverse_pal[INVERSE_PAL_SIZE];
#define COLORMAXI ( 1 << NBITS )
#if 0
static ulong *Histogram; /* image histogram */
static uint *Histogram; /* image histogram */
#else
static ulong Histogram[1<<INVERSE_PAL_TOTAL_BITS];
static uint Histogram[1<<INVERSE_PAL_TOTAL_BITS];
#endif
static ulong SumPixels; /* total # of pixels */
static ulong ColormaxI; /* # of colors, 2^Bits */
static uint SumPixels; /* total # of pixels */
static uint ColormaxI; /* # of colors, 2^Bits */
static Box _Boxes[MAXCOLORS];
static Box *Boxes; /* Array of color boxes. */
@@ -111,7 +111,7 @@ static int CutBox(Box *box, Box *newbox);
static void BoxStats(Box *box);
static int GreatestVariance(Box *boxes, int n);
static int CutBoxes(Box *boxes, int colors);
static void QuantHistogram(ulong *pixels, int npixels, Box *box);
static void QuantHistogram(uint *pixels, int npixels, Box *box);
/*
* Perform variance-based color quantization on a 32-bit image.
@@ -138,7 +138,7 @@ txMipPal6666(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 compres
Boxes = _Boxes;
#if 0
Histogram = (ulong *) txMalloc(INVERSE_PAL_SIZE * sizeof(long));
Histogram = (uint *) txMalloc(INVERSE_PAL_SIZE * sizeof(int));
argbmap = txMalloc(INVERSE_PAL_SIZE);
#endif
@@ -146,12 +146,12 @@ txMipPal6666(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 compres
* Zero-out the projected frequency arrays of the largest box.
*/
bzero(Boxes->freq[ALPHAI], ColormaxI * sizeof(ulong));
bzero(Boxes->freq[REDI], ColormaxI * sizeof(ulong));
bzero(Boxes->freq[GREENI], ColormaxI * sizeof(ulong));
bzero(Boxes->freq[BLUEI], ColormaxI * sizeof(ulong));
bzero(Boxes->freq[ALPHAI], ColormaxI * sizeof(uint));
bzero(Boxes->freq[REDI], ColormaxI * sizeof(uint));
bzero(Boxes->freq[GREENI], ColormaxI * sizeof(uint));
bzero(Boxes->freq[BLUEI], ColormaxI * sizeof(uint));
bzero(Histogram, INVERSE_PAL_SIZE * sizeof(long));
bzero(Histogram, INVERSE_PAL_SIZE * sizeof(int));
/* Feed all bitmaps & generate histogram */
SumPixels = 0;
@@ -159,7 +159,7 @@ txMipPal6666(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 compres
h = txMip->height;
for (i=0; i< txMip->depth; i++) {
SumPixels += w * h;
QuantHistogram((ulong *)txMip->data[i], w * h, &Boxes[0]);
QuantHistogram((uint *)txMip->data[i], w * h, &Boxes[0]);
if (w > 1) w >>= 1;
if (h > 1) h >>= 1;
}
@@ -173,12 +173,12 @@ txMipPal6666(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 compres
*/
for (i = 0; i < OutColors; i++) {
ulong a, r, g, b;
uint a, r, g, b;
a = (ulong)(Boxes[i].mean[ALPHAI] * Cfactor + 0.5);
r = (ulong)(Boxes[i].mean[REDI] * Cfactor + 0.5);
g = (ulong)(Boxes[i].mean[GREENI] * Cfactor + 0.5);
b = (ulong)(Boxes[i].mean[BLUEI] * Cfactor + 0.5);
a = (uint)(Boxes[i].mean[ALPHAI] * Cfactor + 0.5);
r = (uint)(Boxes[i].mean[REDI] * Cfactor + 0.5);
g = (uint)(Boxes[i].mean[GREENI] * Cfactor + 0.5);
b = (uint)(Boxes[i].mean[BLUEI] * Cfactor + 0.5);
if (a > 255) a = 255;
if (r > 255) r = 255;
@@ -203,11 +203,11 @@ txMipPal6666(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 compres
h = txMip->height;
for (i=0; i< txMip->depth; i++) {
ulong *src;
uint *src;
uchar *dst;
int n;
src = (ulong *) txMip->data[i];
src = (uint *) txMip->data[i];
dst = (uchar *) pxMip->data[i];
n = w * h;
while (n--) {
@@ -248,9 +248,9 @@ txMipPal6666(TxMip *pxMip, TxMip *txMip, int format, FxU32 dither, FxU32 compres
* arrays for the first world-encompassing box.
*/
static void
QuantHistogram(ulong *pixels, int npixels, Box *box)
QuantHistogram(uint *pixels, int npixels, Box *box)
{
ulong *af, *rf, *gf, *bf;
uint *af, *rf, *gf, *bf;
uchar aa, rr, gg, bb;
int i;
@@ -329,7 +329,7 @@ static void
BoxStats(Box *box)
{
int i, color;
ulong *freq;
uint *freq;
float mean, var;
if(box->weight == 0) {
@@ -346,7 +346,7 @@ BoxStats(Box *box)
mean += (float) i * *freq;
var += (float) i*i* *freq;
}
box->mean[color] = (unsigned long) (mean / (float)box->weight);
box->mean[color] = (unsigned int) (mean / (float)box->weight);
box->weightedvar += var - box->mean[color]*box->mean[color]*
(float)box->weight;
}
@@ -419,7 +419,7 @@ FindCutpoint(Box *box, int color, Box *newbox1, Box *newbox2)
{
float u, v, max;
int i, maxindex, minindex, cutpoint;
ulong optweight, curweight;
uint optweight, curweight;
if (box->low[color] + 1 == box->high[color])
return FALSE; /* Cannot be cut. */
@@ -469,13 +469,13 @@ FindCutpoint(Box *box, int color, Box *newbox1, Box *newbox2)
static void
UpdateFrequencies(Box *box1, Box *box2)
{
ulong myfreq, *h;
uint myfreq, *h;
int b, g, r, a;
bzero(box1->freq[ALPHAI], ColormaxI * sizeof(ulong));
bzero(box1->freq[REDI], ColormaxI * sizeof(ulong));
bzero(box1->freq[GREENI], ColormaxI * sizeof(ulong));
bzero(box1->freq[BLUEI], ColormaxI * sizeof(ulong));
bzero(box1->freq[ALPHAI], ColormaxI * sizeof(uint));
bzero(box1->freq[REDI], ColormaxI * sizeof(uint));
bzero(box1->freq[GREENI], ColormaxI * sizeof(uint));
bzero(box1->freq[BLUEI], ColormaxI * sizeof(uint));
for (a = box1->low[ALPHAI]; a < box1->high[ALPHAI]; a++) {
for (r = box1->low[REDI]; r < box1->high[REDI]; r++) {
@@ -544,27 +544,27 @@ SetARGBmap(int boxnum, Box *box, uchar *argbmap)
static unsigned char _txPixTrueToFixedPal( void *pix, const FxU32 *pal )
{
int i;
long min_dist;
int min_dist;
int min_index;
long a, r, g, b;
int a, r, g, b;
min_dist = 256 * 256 + 256 * 256 + 256 * 256 + 256 * 256;
min_index = -1;
/* 0 1 2 3 */
a = ( long )( ( uchar * )pix )[3];
r = ( long )( ( uchar * )pix )[2];
g = ( long )( ( uchar * )pix )[1];
b = ( long )( ( uchar * )pix )[0];
a = ( int )( ( uchar * )pix )[3];
r = ( int )( ( uchar * )pix )[2];
g = ( int )( ( uchar * )pix )[1];
b = ( int )( ( uchar * )pix )[0];
for( i = 0; i < 256; i++ )
{
long pala, palr, palg, palb, dist;
long da, dr, dg, db;
int pala, palr, palg, palb, dist;
int da, dr, dg, db;
pala = ( long )( ( pal[i] & 0xff000000 ) >> 24 );
palr = ( long )( ( pal[i] & 0x00ff0000 ) >> 16 );
palg = ( long )( ( pal[i] & 0x0000ff00 ) >> 8 );
palb = ( long )( pal[i] & 0x000000ff );
pala = ( int )( ( pal[i] & 0xff000000 ) >> 24 );
palr = ( int )( ( pal[i] & 0x00ff0000 ) >> 16 );
palg = ( int )( ( pal[i] & 0x0000ff00 ) >> 8 );
palb = ( int )( pal[i] & 0x000000ff );
da = pala - a;
dr = palr - r;
dg = palg - g;
@@ -587,19 +587,19 @@ static unsigned char _txPixTrueToFixedPal( void *pix, const FxU32 *pal )
static void _txImgTrueToFixedPal( unsigned char *dst, unsigned char *src, const FxU32 *pal,
int w, int h, FxU32 flags )
{
long i;
int i;
for( i = 0; i < w * h; i++ )
{
if( flags == TX_FIXED_PAL_QUANT_TABLE )
{
ulong index;
ulong a_index, r_index, g_index, b_index;
uint index;
uint a_index, r_index, g_index, b_index;
a_index = ( ( ( ulong )src[i*4+3] ) >> ( 8 - INVERSE_PAL_A_BITS ) );
r_index = ( ( ( ulong )src[i*4+2] ) >> ( 8 - INVERSE_PAL_R_BITS ) );
g_index = ( ( ( ulong )src[i*4+1] ) >> ( 8 - INVERSE_PAL_G_BITS ) );
b_index = ( ( ( ulong )src[i*4+0] ) >> ( 8 - INVERSE_PAL_B_BITS ) );
a_index = ( ( ( uint )src[i*4+3] ) >> ( 8 - INVERSE_PAL_A_BITS ) );
r_index = ( ( ( uint )src[i*4+2] ) >> ( 8 - INVERSE_PAL_R_BITS ) );
g_index = ( ( ( uint )src[i*4+1] ) >> ( 8 - INVERSE_PAL_G_BITS ) );
b_index = ( ( ( uint )src[i*4+0] ) >> ( 8 - INVERSE_PAL_B_BITS ) );
index = MKIDX(a_index, r_index, g_index, b_index);
dst[i] = inverse_pal[index];
}
@@ -612,8 +612,8 @@ static void _txImgTrueToFixedPal( unsigned char *dst, unsigned char *src, const
static void _CreateInversePal( const FxU32 *pal )
{
long a, r, g, b;
long index = 0;
int a, r, g, b;
int index = 0;
uchar true_color[NCOMP];
for( a = 0; a < ( 1 << INVERSE_PAL_A_BITS ); a++ )

View File

@@ -67,7 +67,7 @@ _txDuplicateData(const FxU32 *src, int *wp, int *hp, int lbw, int lbh)
}
static int
_txPixQuantize_RGB332( unsigned long argb, int x, int y, int w)
_txPixQuantize_RGB332( unsigned int argb, int x, int y, int w)
{
return (
(((argb>>16) & 0xE0) |
@@ -76,7 +76,7 @@ _txPixQuantize_RGB332( unsigned long argb, int x, int y, int w)
}
static int
_txPixQuantize_RGB332_D4x4( unsigned long argb, int x, int y, int w)
_txPixQuantize_RGB332_D4x4( unsigned int argb, int x, int y, int w)
{
int d = dithmat[y&3][x&3];
int n, t;
@@ -91,7 +91,7 @@ _txPixQuantize_RGB332_D4x4( unsigned long argb, int x, int y, int w)
}
static int
_txPixQuantize_RGB332_DErr( unsigned long argb, int x, int y, int w)
_txPixQuantize_RGB332_DErr( unsigned int argb, int x, int y, int w)
{
static unsigned char a3[] = {0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff};
static unsigned char a2[] = {0x00,0x55,0xaa,0xff};
@@ -148,13 +148,13 @@ _txPixQuantize_RGB332_DErr( unsigned long argb, int x, int y, int w)
/* YIQ422 done elsewhere */
static int
_txPixQuantize_A8( unsigned long argb, int x, int y, int w)
_txPixQuantize_A8( unsigned int argb, int x, int y, int w)
{
return (argb >> 24);
}
static int
_txPixQuantize_I8( unsigned long argb, int x, int y, int w)
_txPixQuantize_I8( unsigned int argb, int x, int y, int w)
{
return (
((int) (((argb >>16) & 0xFF) * .30F +
@@ -163,7 +163,7 @@ _txPixQuantize_I8( unsigned long argb, int x, int y, int w)
}
static int
_txPixQuantize_AI44( unsigned long argb, int x, int y, int w)
_txPixQuantize_AI44( unsigned int argb, int x, int y, int w)
{
return(
(int) (( ((argb>>16) & 0xFF) * .30F +
@@ -173,7 +173,7 @@ _txPixQuantize_AI44( unsigned long argb, int x, int y, int w)
}
static int
_txPixQuantize_AI44_D4x4( unsigned long argb, int x, int y, int w)
_txPixQuantize_AI44_D4x4( unsigned int argb, int x, int y, int w)
{
int d = dithmat[y&3][x&3];
int n, t;
@@ -191,7 +191,7 @@ _txPixQuantize_AI44_D4x4( unsigned long argb, int x, int y, int w)
}
static int
_txPixQuantize_AI44_DErr( unsigned long argb, int x, int y, int w)
_txPixQuantize_AI44_DErr( unsigned int argb, int x, int y, int w)
{
int ii, t;
static int qi;
@@ -226,7 +226,7 @@ _txPixQuantize_AI44_DErr( unsigned long argb, int x, int y, int w)
static int
_txPixQuantize_ARGB8332 ( unsigned long argb, int x, int y, int w)
_txPixQuantize_ARGB8332 ( unsigned int argb, int x, int y, int w)
{
return (
((argb>>16) & 0xE0) |
@@ -237,7 +237,7 @@ _txPixQuantize_ARGB8332 ( unsigned long argb, int x, int y, int w)
static int
_txPixQuantize_ARGB8332_D4x4( unsigned long argb, int x, int y, int w)
_txPixQuantize_ARGB8332_D4x4( unsigned int argb, int x, int y, int w)
{
int d = dithmat[y&3][x&3];
int n, t;
@@ -253,7 +253,7 @@ _txPixQuantize_ARGB8332_D4x4( unsigned long argb, int x, int y, int w)
}
static int
_txPixQuantize_ARGB8332_DErr( unsigned long argb, int x, int y, int w)
_txPixQuantize_ARGB8332_DErr( unsigned int argb, int x, int y, int w)
{
int t;
@@ -265,7 +265,7 @@ _txPixQuantize_ARGB8332_DErr( unsigned long argb, int x, int y, int w)
/* AYIQ8422 done elsewhere */
static int
_txPixQuantize_RGB565( unsigned long argb, int x, int y, int w)
_txPixQuantize_RGB565( unsigned int argb, int x, int y, int w)
{
return (
((argb >> 8) & 0xF800) |
@@ -274,7 +274,7 @@ _txPixQuantize_RGB565( unsigned long argb, int x, int y, int w)
}
static int
_txPixQuantize_RGB565_D4x4 ( unsigned long argb, int x, int y, int w)
_txPixQuantize_RGB565_D4x4 ( unsigned int argb, int x, int y, int w)
{
int d = dithmat[y&3][x&3];
int n, t;
@@ -290,7 +290,7 @@ _txPixQuantize_RGB565_D4x4 ( unsigned long argb, int x, int y, int w)
static int
_txPixQuantize_RGB565_DErr ( unsigned long argb, int x, int y, int w)
_txPixQuantize_RGB565_DErr ( unsigned int argb, int x, int y, int w)
{
static int qr, qg, qb; // quantized incoming values.
int ir, ig, ib; // incoming values.
@@ -346,7 +346,7 @@ _txPixQuantize_RGB565_DErr ( unsigned long argb, int x, int y, int w)
}
static int
_txPixQuantize_ARGB1555( unsigned long argb, int x, int y, int w)
_txPixQuantize_ARGB1555( unsigned int argb, int x, int y, int w)
{
return (
((argb >> 9) & 0x7C00) |
@@ -356,7 +356,7 @@ _txPixQuantize_ARGB1555( unsigned long argb, int x, int y, int w)
}
static int
_txPixQuantize_ARGB1555_D4x4 ( unsigned long argb, int x, int y, int w)
_txPixQuantize_ARGB1555_D4x4 ( unsigned int argb, int x, int y, int w)
{
int d = dithmat[y&3][x&3];
int n, t;
@@ -372,7 +372,7 @@ _txPixQuantize_ARGB1555_D4x4 ( unsigned long argb, int x, int y, int w)
}
static int
_txPixQuantize_ARGB1555_DErr ( unsigned long argb, int x, int y, int w)
_txPixQuantize_ARGB1555_DErr ( unsigned int argb, int x, int y, int w)
{
static int qr, qg, qb; // quantized incoming values.
int ir, ig, ib; // incoming values.
@@ -429,7 +429,7 @@ _txPixQuantize_ARGB1555_DErr ( unsigned long argb, int x, int y, int w)
}
static int
_txPixQuantize_ARGB4444 (unsigned long argb, int x, int y, int w)
_txPixQuantize_ARGB4444 (unsigned int argb, int x, int y, int w)
{
return (
((argb >> 12) & 0x0F00) |
@@ -439,7 +439,7 @@ _txPixQuantize_ARGB4444 (unsigned long argb, int x, int y, int w)
}
static int
_txPixQuantize_ARGB4444_D4x4 (unsigned long argb, int x, int y, int w)
_txPixQuantize_ARGB4444_D4x4 (unsigned int argb, int x, int y, int w)
{
int d = dithmat[y&3][x&3];
int n, t;
@@ -455,7 +455,7 @@ _txPixQuantize_ARGB4444_D4x4 (unsigned long argb, int x, int y, int w)
}
static int
_txPixQuantize_ARGB4444_DErr (unsigned long argb, int x, int y, int w)
_txPixQuantize_ARGB4444_DErr (unsigned int argb, int x, int y, int w)
{
static int qr, qg, qb; // quantized incoming values.
int ir, ig, ib; // incoming values.
@@ -512,7 +512,7 @@ _txPixQuantize_ARGB4444_DErr (unsigned long argb, int x, int y, int w)
}
static int
_txPixQuantize_AI88( unsigned long argb, int x, int y, int w)
_txPixQuantize_AI88( unsigned int argb, int x, int y, int w)
{
return (
(((int) (((argb >>16) & 0xFF) * .30F +
@@ -523,7 +523,7 @@ _txPixQuantize_AI88( unsigned long argb, int x, int y, int w)
}
static void
_txCalcYUVFromRGB(FxU32 argb, long *y, long *u, long *v)
_txCalcYUVFromRGB(FxU32 argb, int *y, int *u, int *v)
{
float red, green, blue;
@@ -535,22 +535,22 @@ _txCalcYUVFromRGB(FxU32 argb, long *y, long *u, long *v)
// ImageMagick method
/*
*y = (long)( 0.29900 * red + 0.58700 * green + 0.11400 * blue );
*u = (long)(-0.14740 * red - 0.28950 * green + 0.43690 * blue + 128.5);
*v = (long)( 0.61500 * red - 0.51500 * green - 0.10000 * blue + 128.5);
*y = (int)( 0.29900 * red + 0.58700 * green + 0.11400 * blue );
*u = (int)(-0.14740 * red - 0.28950 * green + 0.43690 * blue + 128.5);
*v = (int)( 0.61500 * red - 0.51500 * green - 0.10000 * blue + 128.5);
*/
// MWP method
/*
*y = (long)((77.0 / 256.0) * red + (150.0 / 256.0) * green + (29.0 / 256.0) * blue + 0.5);
*u = (long)(128 - (44.0 / 256.0) * red - (87.0 / 256.0) * green + (131.0 / 256.0) * blue + 0.5);
*v = (long)(128 + (131.0 / 256.0) * red - (110.0 / 256.0) * green - (21.0 / 256.0) * blue + 0.5);
*y = (int)((77.0 / 256.0) * red + (150.0 / 256.0) * green + (29.0 / 256.0) * blue + 0.5);
*u = (int)(128 - (44.0 / 256.0) * red - (87.0 / 256.0) * green + (131.0 / 256.0) * blue + 0.5);
*v = (int)(128 + (131.0 / 256.0) * red - (110.0 / 256.0) * green - (21.0 / 256.0) * blue + 0.5);
*/
// Method from solving dequantizer equations
*y = (long)( .25695 * red + .50442 * green + .09773 * blue + 16.5);
*u = (long)(-.14821 * red - .29095 * green + .43917 * blue + 128.5);
*v = (long)( .43917 * red - .36788 * green - .07128 * blue + 128.5);
*y = (int)( .25695 * red + .50442 * green + .09773 * blue + 16.5);
*u = (int)(-.14821 * red - .29095 * green + .43917 * blue + 128.5);
*v = (int)( .43917 * red - .36788 * green - .07128 * blue + 128.5);
// Clamp YUV
@@ -587,9 +587,9 @@ _txImgQuantizeYUV(FxU16 *dst, const FxU32 *src, int w, int h, FxU32 format)
{
int k = w * h;
int i, j;
unsigned long Y[2], U[2], V[2];
unsigned long avgU, avgV;
long tmpY, tmpU, tmpV;
unsigned int Y[2], U[2], V[2];
unsigned int avgU, avgV;
int tmpY, tmpU, tmpV;
const FxU32 *localSrc = NULL;
/* surface size must be a multiple of the 2x1 block size */
@@ -607,13 +607,13 @@ _txImgQuantizeYUV(FxU16 *dst, const FxU32 *src, int w, int h, FxU32 format)
src++;
Y[j] = (unsigned long) tmpY;
U[j] = (unsigned long) tmpU;
V[j] = (unsigned long) tmpV;
Y[j] = (unsigned int) tmpY;
U[j] = (unsigned int) tmpU;
V[j] = (unsigned int) tmpV;
}
avgU = (unsigned long) ((U[0] + U[1] + 1) / 2.0); // add 1 to round
avgV = (unsigned long) ((V[0] + V[1] + 1) / 2.0); // add 1 to round
avgU = (unsigned int) ((U[0] + U[1] + 1) / 2.0); // add 1 to round
avgV = (unsigned int) ((V[0] + V[1] + 1) / 2.0); // add 1 to round
if ( format == GR_TEXFMT_YUYV_422 )
{
@@ -647,7 +647,7 @@ void
_txImgQuantizeAYUV(FxU32 *dst, FxU32 *src, int w, int h)
{
int i, k;
long y, u, v;
int y, u, v;
k = w * h;
@@ -1370,7 +1370,7 @@ txImgQuantize(char *dst, char *src,
int w, int h,
FxU32 format, FxU32 dither)
{
int (*quantizer)(unsigned long argb, int x, int y, int w) = NULL;
int (*quantizer)(unsigned int argb, int x, int y, int w) = NULL;
int x, y;
dither &= TX_DITHER_MASK;
@@ -1474,7 +1474,7 @@ txImgQuantize(char *dst, char *src,
case GR_TEXFMT_ALPHA_INTENSITY_44:
for (y=0; y<h; y++) {
for (x=0; x<w; x++) {
*dst++ = (*quantizer)(*(unsigned long *)src, x, y, w);
*dst++ = (*quantizer)(*(unsigned int *)src, x, y, w);
src += 4;
}
}
@@ -1494,7 +1494,7 @@ txImgQuantize(char *dst, char *src,
for (y=0; y<h; y++) {
for (x=0; x<w; x++) {
*dst16++ = (*quantizer)(*(unsigned long *)src, x, y, w);
*dst16++ = (*quantizer)(*(unsigned int *)src, x, y, w);
src += 4;
}
}

View File

@@ -49,7 +49,7 @@ typedef struct _rgtHeader{
static void swapShorts(unsigned short *array, long length)
static void swapShorts(unsigned short *array, int length)
{
unsigned short s;
while (length--) {
@@ -59,7 +59,7 @@ static void swapShorts(unsigned short *array, long length)
}
#if 0 /* not used */
static void swapLongs(unsigned int *array, long length)
static void swapLongs(unsigned int *array, int length)
{
unsigned int s;
while (length--) {
@@ -71,7 +71,7 @@ static void swapLongs(unsigned int *array, long length)
#endif
// just swap RGB into BGR (leave MSB undefined)
static void swapRGB(unsigned int *array, long length)
static void swapRGB(unsigned int *array, int length)
{
unsigned int s;
while (length--) {
@@ -163,7 +163,7 @@ _txReadRGTData( FILE *stream, TxMip *info)
#if 1
if (swap) {
swapRGB((unsigned int *)data32, (long)info->width);
swapRGB((unsigned int *)data32, (int)info->width);
}
#endif

View File

@@ -38,8 +38,8 @@ extern "C" {
typedef unsigned char FxU8;
typedef unsigned short FxU16;
typedef short FxI16;
typedef unsigned long FxU32;
typedef long FxI32;
typedef unsigned int FxU32;
typedef int FxI32;
typedef int FxBool;
/*

View File

@@ -73,7 +73,7 @@ int txGCD(int a, int b);
int txAspectRatio(int w, int h);
void txPanic(char *);
void txError(char *);
void txYABtoPal256(long *palette, const long* yabTable);
void txYABtoPal256(int *palette, const int* yabTable);
void txRectCopy(FxU8 *dst, int dstStride, const FxU8 *src, int srcStride,
int width, int height);
FxBool txMipAlloc(TxMip *txMip);
@@ -96,7 +96,7 @@ extern int *explode3;
void txDiffuseIndex(TxMip *pxMip, TxMip *txMip, int pixsize,
const FxU32 *palette, int ncolors);
int txNearestColor(long ir, long ig, long ib, const FxU32 *pal, int npal);
int txNearestColor(int ir, int ig, int ib, const FxU32 *pal, int npal);
FxBool _txReadTGAHeader( FILE *stream, FxU32 cookie, TxMip *info);
FxBool _txReadTGAData( FILE *stream, TxMip *info);

View File

@@ -254,7 +254,7 @@ size_t txInit3dfInfoFromFile( FILE *file,
int *destWidth, int *destHeight,
int mipLevels, FxU32 flags )
{
long file_start_position;
int file_start_position;
size_t size_retval;
int input_format;
TxMip txMip;
@@ -403,7 +403,7 @@ size_t txInit3dfInfo( Gu3dfInfo *info, GrTextureFormat_t destFormat,
FxBool txConvertFromFile( FILE *file, Gu3dfInfo *info,
FxU32 flags, const void *palNcc )
{
long file_start_position;
int file_start_position;
FxBool retval;
TxMip txMip;

View File

@@ -335,7 +335,7 @@ _txReadTGAData( FILE *stream, TxMip *info)
int i, stride;
int bpp; // bytesPerPixel
FxU8* data;
long BigEndian = 0xff000000;
int BigEndian = 0xff000000;
// printf("TxREAD TGA DATA\n");
tgaRLEcount = 0;

View File

@@ -156,14 +156,14 @@ txGCD(int a, int b)
}
void
txYABtoPal256(long *palette, const long* yabTable)
txYABtoPal256(int *palette, const int* yabTable)
{
// Convert YAB table to a 256 color palette
// Assume yabTable[] has first 16Y's, 12 A's, 12 B's
const long *Y = yabTable;
const long *A = yabTable + 16;
const long *B = yabTable + 16 + 12;
const int *Y = yabTable;
const int *A = yabTable + 16;
const int *B = yabTable + 16 + 12;
int i;
for (i=0; i<256; i++) {
@@ -288,7 +288,7 @@ int _explode3[255+256] = {
int *explode3 = &_explode3[255];
int
txNearestColor(long ir, long ig, long ib, const FxU32 *pal, int ncolors)
txNearestColor(int ir, int ig, int ib, const FxU32 *pal, int ncolors)
{
int i, d;
int mindist, minpos; // closest distance to input