Merge pull request #612 from GarageGames/platform-type-consistency

Platform type consistency
This commit is contained in:
Daniel Buckmaster 2014-05-10 11:40:40 +10:00
commit 1702573b78
210 changed files with 896 additions and 896 deletions

View file

@ -54,8 +54,8 @@ extern _D3DTEXTUREOP GFXD3D9TextureOp[GFXTOP_COUNT];
extern _D3DDECLTYPE GFXD3D9DeclType[GFXDeclType_COUNT];
#define GFXREVERSE_LOOKUP( tablearray, enumprefix, val ) \
for( int i = enumprefix##_FIRST; i < enumprefix##_COUNT; i++ ) \
if( (int)tablearray##[i] == val ) \
for( S32 i = enumprefix##_FIRST; i < enumprefix##_COUNT; i++ ) \
if( (S32)tablearray##[i] == val ) \
{ \
val = i; \
break; \

View file

@ -259,7 +259,7 @@ void GFXD3D9TextureManager::_innerCreateTexture( GFXD3D9TextureObject *retTex,
retTex->mTextureSize.set(probeDesc.Width, probeDesc.Height, 0);
int fmt = probeDesc.Format;
S32 fmt = probeDesc.Format;
#if !defined(TORQUE_OS_XENON)
GFXREVERSE_LOOKUP( GFXD3D9TextureFormat, GFXFormat, fmt );
@ -568,7 +568,7 @@ bool GFXD3D9TextureManager::_loadTexture(GFXTextureObject *aTexture, DDSFile *dd
GFXD3D9TextureObject *texture = static_cast<GFXD3D9TextureObject*>(aTexture);
// Fill the texture...
for( int i = 0; i < aTexture->mMipLevels; i++ )
for( S32 i = 0; i < aTexture->mMipLevels; i++ )
{
PROFILE_SCOPE(GFXD3DTexMan_loadSurface);

View file

@ -242,9 +242,9 @@ bool GFXD3D9TextureObject::copyToBmp(GBitmap* bmp)
PROFILE_START(GFXD3D9TextureObject_copyToBmp_pixCopy);
// copy data into bitmap
for (int row = 0; row < height; ++row)
for (S32 row = 0; row < height; ++row)
{
for (int col = 0; col < width; ++col)
for (S32 col = 0; col < width; ++col)
{
destPtr[0] = srcPtr[2]; // red
destPtr[1] = srcPtr[1]; // green

View file

@ -46,14 +46,14 @@ _D3DDECLTYPE GFXD3D9DeclType[GFXDeclType_COUNT];
//------------------------------------------------------------------------------
#define INIT_LOOKUPTABLE( tablearray, enumprefix, type ) \
for( int i = enumprefix##_FIRST; i < enumprefix##_COUNT; i++ ) \
for( S32 i = enumprefix##_FIRST; i < enumprefix##_COUNT; i++ ) \
tablearray##[i] = (##type##)GFX_UNINIT_VAL;
#define VALIDATE_LOOKUPTABLE( tablearray, enumprefix ) \
for( int i = enumprefix##_FIRST; i < enumprefix##_COUNT; i++ ) \
if( (int)tablearray##[i] == GFX_UNINIT_VAL ) \
for( S32 i = enumprefix##_FIRST; i < enumprefix##_COUNT; i++ ) \
if( (S32)tablearray##[i] == GFX_UNINIT_VAL ) \
Con::warnf( "GFXD3D9EnumTranslate: Unassigned value in " #tablearray ": %i", i ); \
else if( (int)tablearray##[i] == GFX_UNSUPPORTED_VAL ) \
else if( (S32)tablearray##[i] == GFX_UNSUPPORTED_VAL ) \
Con::warnf( "GFXD3D9EnumTranslate: Unsupported value in " #tablearray ": %i", i );
//------------------------------------------------------------------------------

View file

@ -330,7 +330,7 @@ void GFXPCD3D9TextureTarget::resolveTo( GFXTextureObject *tex )
void GFXPCD3D9TextureTarget::zombify()
{
for(int i = 0; i < MaxRenderSlotId; i++)
for(S32 i = 0; i < MaxRenderSlotId; i++)
attachTexture(RenderSlot(i), NULL);
}

View file

@ -883,7 +883,7 @@ DDSFile *DDSFile::createDDSFileFromGBitmap( const GBitmap *gbmp )
ret->mSurfaces.push_back( new SurfaceData() );
// Load the mips
for( int i = 0; i < ret->mMipMapCount; i++ )
for( S32 i = 0; i < ret->mMipMapCount; i++ )
{
const U32 mipSz = ret->getSurfaceSize(i);
ret->mSurfaces.last()->mMips.push_back( new U8[mipSz] );
@ -898,7 +898,7 @@ DDSFile *DDSFile::createDDSFileFromGBitmap( const GBitmap *gbmp )
// Assumption:
AssertFatal( gbmp->getBytesPerPixel() + 1 == ret->mBytesPerPixel, "Assumption failed, not 24->32 bit straight convert." );
for( int pxl = 0; pxl < gbmp->getWidth(i) * gbmp->getHeight(i); pxl++ )
for( S32 pxl = 0; pxl < gbmp->getWidth(i) * gbmp->getHeight(i); pxl++ )
{
U8 *dst = &mipMem[pxl * ret->mBytesPerPixel];
const U8 *src = &gbmp->getBits(i)[pxl * gbmp->getBytesPerPixel()];

View file

@ -77,7 +77,7 @@ bool DDSUtil::squishDDS( DDSFile *srcDDS, const GFXFormat dxtFormat )
// are done, we can discard the old surface, and replace it with this one.
DDSFile::SurfaceData *newSurface = new DDSFile::SurfaceData();
for( int i = 0; i < srcDDS->mMipMapCount; i++ )
for( S32 i = 0; i < srcDDS->mMipMapCount; i++ )
{
const U8 *srcBits = srcSurface->mMips[i];
@ -106,7 +106,7 @@ bool DDSUtil::squishDDS( DDSFile *srcDDS, const GFXFormat dxtFormat )
void DDSUtil::swizzleDDS( DDSFile *srcDDS, const Swizzle<U8, 4> &swizzle )
{
for( int i = 0; i < srcDDS->mMipMapCount; i++ )
for( S32 i = 0; i < srcDDS->mMipMapCount; i++ )
{
swizzle.InPlace( srcDDS->mSurfaces.last()->mMips[i], srcDDS->getSurfaceSize( i ) );
}

View file

@ -796,11 +796,11 @@ bool GBitmap::combine( const GBitmap *bitmapA, const GBitmap *bitmapB, const GFX
const U8 *aBits = bitmapA->getBits();
const U8 *bBits = bitmapB->getBits();
for( int y = 0; y < getHeight(); y++ )
for( S32 y = 0; y < getHeight(); y++ )
{
for( int x = 0; x < getWidth(); x++ )
for( S32 x = 0; x < getWidth(); x++ )
{
for( int _byte = 0; _byte < mBytesPerPixel; _byte++ )
for( S32 _byte = 0; _byte < mBytesPerPixel; _byte++ )
{
U8 pxA = 0;
U8 pxB = 0;

View file

@ -152,7 +152,7 @@ static bool sReadBMP(Stream &stream, GBitmap *bitmap)
if(bytesPerPixel == 3 && bi.biBitCount != 8) // do BGR swap
{
U8 *ptr = bitmap->getAddress(0,0);
for(int i = 0; i < width * height; i++)
for(S32 i = 0; i < width * height; i++)
{
U8 tmp = ptr[0];
ptr[0] = ptr[2];

View file

@ -54,7 +54,7 @@ static struct _privateRegisterGIF
//-------------------------------------- Replacement I/O for standard LIBjpeg
// functions. we don't wanna use
// FILE*'s...
static int gifReadDataFn(GifFileType *gifinfo, GifByteType *data, int length)
static S32 gifReadDataFn(GifFileType *gifinfo, GifByteType *data, S32 length)
{
Stream *stream = (Stream*)gifinfo->UserData;
AssertFatal(stream != NULL, "gifReadDataFn::No stream.");
@ -72,7 +72,7 @@ static int gifReadDataFn(GifFileType *gifinfo, GifByteType *data, int length)
//--------------------------------------
#if 0
// CodeReview - until we can write these, get rid of warning by disabling method.
static int gifWriteDataFn(GifFileType *gifinfo, GifByteType *data, int length)
static S32 gifWriteDataFn(GifFileType *gifinfo, GifByteType *data, S32 length)
{
Stream *stream = (Stream*)gifinfo->UserData;
AssertFatal(stream != NULL, "gifWriteDataFn::No stream.");

View file

@ -50,11 +50,11 @@ static struct _privateRegisterJPG
//-------------------------------------- Replacement I/O for standard LIBjpeg
// functions. we don't wanna use
// FILE*'s...
static int jpegReadDataFn(void *client_data, unsigned char *data, int length)
static S32 jpegReadDataFn(void *client_data, U8 *data, S32 length)
{
Stream *stream = (Stream*)client_data;
AssertFatal(stream != NULL, "jpegReadDataFn::No stream.");
int pos = stream->getPosition();
S32 pos = stream->getPosition();
if (stream->read(length, data))
return length;
@ -66,7 +66,7 @@ static int jpegReadDataFn(void *client_data, unsigned char *data, int length)
//--------------------------------------
static int jpegWriteDataFn(void *client_data, unsigned char *data, int length)
static S32 jpegWriteDataFn(void *client_data, U8 *data, S32 length)
{
Stream *stream = (Stream*)client_data;
AssertFatal(stream != NULL, "jpegWriteDataFn::No stream.");
@ -78,7 +78,7 @@ static int jpegWriteDataFn(void *client_data, unsigned char *data, int length)
//--------------------------------------
static int jpegFlushDataFn(void *)
static S32 jpegFlushDataFn(void *)
{
// do nothing since we can't flush the stream object
return 0;
@ -86,7 +86,7 @@ static int jpegFlushDataFn(void *)
//--------------------------------------
static int jpegErrorFn(void *client_data)
static S32 jpegErrorFn(void *client_data)
{
Stream *stream = (Stream*)client_data;
AssertFatal(stream != NULL, "jpegErrorFn::No stream.");

View file

@ -103,7 +103,7 @@ GFXDevice::GFXDevice()
mViewMatrix.identity();
mProjectionMatrix.identity();
for( int i = 0; i < WORLD_STACK_MAX; i++ )
for( S32 i = 0; i < WORLD_STACK_MAX; i++ )
mWorldMatrix[i].identity();
AssertFatal(smGFXDevice == NULL, "Already a GFXDevice created! Bad!");
@ -451,7 +451,7 @@ void GFXDevice::updateStates(bool forceSetAll /*=false*/)
if( mTextureMatrixCheckDirty )
{
for( int i = 0; i < getNumSamplers(); i++ )
for( S32 i = 0; i < getNumSamplers(); i++ )
{
if( mTextureMatrixDirty[i] )
{
@ -1279,7 +1279,7 @@ DefineEngineFunction( getPixelShaderVersion, F32, (),,
return GFX->getPixelShaderVersion();
}
DefineEngineFunction( setPixelShaderVersion, void, ( float version ),,
DefineEngineFunction( setPixelShaderVersion, void, ( F32 version ),,
"@brief Sets the pixel shader version for the active device.\n"
"This can be used to force a lower pixel shader version than is supported by "
"the device for testing or performance optimization.\n"

View file

@ -474,7 +474,7 @@ void GFXDrawUtil::drawRect( const Point2F &upperLeft, const Point2F &lowerRight,
verts[8].point.set( upperLeft.x + ulOffset + nw.x, upperLeft.y + ulOffset + nw.y, 0.0f ); // same as 0
verts[9].point.set( upperLeft.x + ulOffset - nw.x, upperLeft.y + ulOffset - nw.y, 0.0f ); // same as 1
for (int i=0; i<10; i++)
for (S32 i=0; i<10; i++)
verts[i].color = color;
verts.unlock();
@ -531,7 +531,7 @@ void GFXDrawUtil::drawRectFill( const Point2F &upperLeft, const Point2F &lowerRi
verts[2].point.set( upperLeft.x-ne.x+ulOffset, lowerRight.y-ne.y, 0.0f );
verts[3].point.set( lowerRight.x-nw.x, lowerRight.y-nw.y, 0.0f );
for (int i=0; i<4; i++)
for (S32 i=0; i<4; i++)
verts[i].color = color;
verts.unlock();
@ -828,11 +828,11 @@ void GFXDrawUtil::_drawWireCube( const GFXStateBlockDesc &desc, const Point3F &s
// setup 6 line loops
U32 vertexIndex = 0;
for(int i = 0; i < 6; i++)
for(S32 i = 0; i < 6; i++)
{
for(int j = 0; j < 5; j++)
for(S32 j = 0; j < 5; j++)
{
int idx = cubeFaces[i][j%4];
S32 idx = cubeFaces[i][j%4];
verts[vertexIndex].point = cubePoints[idx] * halfSize;
verts[vertexIndex].color = color;
@ -872,7 +872,7 @@ void GFXDrawUtil::_drawSolidCube( const GFXStateBlockDesc &desc, const Point3F &
// setup 6 line loops
U32 vertexIndex = 0;
U32 idx;
for(int i = 0; i < 6; i++)
for(S32 i = 0; i < 6; i++)
{
idx = cubeFaces[i][0];
verts[vertexIndex].point = cubePoints[idx] * halfSize;

View file

@ -76,20 +76,20 @@ _STRING_VALUE_LOOKUP_FXN(GFXStringBlendOp);
//------------------------------------------------------------------------------
#define INIT_LOOKUPTABLE( tablearray, enumprefix, type ) \
for( int i = enumprefix##_FIRST; i < enumprefix##_COUNT; i++ ) \
for( S32 i = enumprefix##_FIRST; i < enumprefix##_COUNT; i++ ) \
tablearray[i] = (type)GFX_UNINIT_VAL;
#define INIT_LOOKUPTABLE_EX( tablearray, enumprefix, type, typeTable ) \
for( int i = enumprefix##_FIRST; i < enumprefix##_COUNT; i++ ) \
for( S32 i = enumprefix##_FIRST; i < enumprefix##_COUNT; i++ ) \
{\
tablearray[i] = (type)GFX_UNINIT_VAL;\
typeTable[i] = &defaultStringValueLookup;\
}
#define VALIDATE_LOOKUPTABLE( tablearray, enumprefix ) \
for( int i = enumprefix##_FIRST; i < enumprefix##_COUNT; i++ ) \
if( (int)tablearray[i] == GFX_UNINIT_VAL ) \
for( S32 i = enumprefix##_FIRST; i < enumprefix##_COUNT; i++ ) \
if( (S32)tablearray[i] == GFX_UNINIT_VAL ) \
Con::warnf( "GFXStringEnumTranslate: Unassigned value in " #tablearray ": %i", i ); \
else if( (int)tablearray[i] == GFX_UNSUPPORTED_VAL ) \
else if( (S32)tablearray[i] == GFX_UNSUPPORTED_VAL ) \
Con::warnf( "GFXStringEnumTranslate: Unsupported value in " #tablearray ": %i", i );
//------------------------------------------------------------------------------

View file

@ -71,8 +71,8 @@ extern StringValueLookupFn GFXStringSamplerStateValueLookup[GFXSAMP_COUNT];
extern StringValueLookupFn GFXStringTextureStageStateValueLookup[GFXTSS_COUNT];
#define GFXREVERSE_LOOKUP( tablearray, enumprefix, val ) \
for( int i = enumprefix##_FIRST; i < enumprefix##_COUNT; i++ ) \
if( (int)tablearray##[i] == val ) \
for( S32 i = enumprefix##_FIRST; i < enumprefix##_COUNT; i++ ) \
if( (S32)tablearray##[i] == val ) \
{ \
val = i; \
break; \

View file

@ -1033,7 +1033,7 @@ void GFXTextureManager::_validateTexParams( const U32 width, const U32 height,
GFXFormat testingFormat = inOutFormat;
if( profile->getCompression() != GFXTextureProfile::NONE )
{
const int offset = profile->getCompression() - GFXTextureProfile::DXT1;
const S32 offset = profile->getCompression() - GFXTextureProfile::DXT1;
testingFormat = GFXFormat( GFXFormatDXT1 + offset );
// No auto-gen mips on compressed textures

View file

@ -63,7 +63,7 @@ struct GFXLockedRect
{
/// Pitch of the lock. This is the spacing in bytes of the start
/// of each row of the locked region.
int pitch;
S32 pitch;
/// Pointer to the start of locked rectangle.
U8* bits;

View file

@ -13606,8 +13606,8 @@ void setupBunny(GFXVertexPCN* v)
{
for(j=0;j<3;j++)
{
int vi=face_indicies[i][j];
int ni=face_indicies[i][j+3];//Normal index
S32 vi=face_indicies[i][j];
S32 ni=face_indicies[i][j+3];//Normal index
Point3F point = Point3F(vertices[vi][0], vertices[vi][1], vertices[vi][2]);
v[vert].normal = Point3F(normals[ni][0], normals[ni][1], normals[ni][2]);
v[vert].point = point;

View file

@ -32,7 +32,7 @@ struct DistanceFieldSearchSpaceStruct
F32 distance;
};
int QSORT_CALLBACK cmpSortDistanceFieldSearchSpaceStruct(const void* p1, const void* p2)
S32 QSORT_CALLBACK cmpSortDistanceFieldSearchSpaceStruct(const void* p1, const void* p2)
{
const DistanceFieldSearchSpaceStruct* sp1 = (const DistanceFieldSearchSpaceStruct*)p1;
const DistanceFieldSearchSpaceStruct* sp2 = (const DistanceFieldSearchSpaceStruct*)p2;

View file

@ -48,11 +48,11 @@ void OptimizeTriangleOrdering(const dsize_t numVerts, const dsize_t numIndices,
FrameTemp<TriData> triangleData(NumPrimitives);
U32 curIdx = 0;
for(int tri = 0; tri < NumPrimitives; tri++)
for(S32 tri = 0; tri < NumPrimitives; tri++)
{
TriData &curTri = triangleData[tri];
for(int c = 0; c < 3; c++)
for(S32 c = 0; c < 3; c++)
{
const U32 &curVIdx = indices[curIdx];
AssertFatal(curVIdx < numVerts, "Out of range index.");
@ -71,7 +71,7 @@ void OptimizeTriangleOrdering(const dsize_t numVerts, const dsize_t numIndices,
// Allocate per-vertex triangle lists, and calculate the starting score of
// each of the verts
for(int v = 0; v < numVerts; v++)
for(S32 v = 0; v < numVerts; v++)
{
VertData &curVert = vertexData[v];
curVert.triIndex = new S32[curVert.numUnaddedReferences];
@ -89,11 +89,11 @@ void OptimizeTriangleOrdering(const dsize_t numVerts, const dsize_t numIndices,
// Fill-in per-vertex triangle lists, and sum the scores of each vertex used
// per-triangle, to get the starting triangle score
curIdx = 0;
for(int tri = 0; tri < NumPrimitives; tri++)
for(S32 tri = 0; tri < NumPrimitives; tri++)
{
TriData &curTri = triangleData[tri];
for(int c = 0; c < 3; c++)
for(S32 c = 0; c < 3; c++)
{
const U32 &curVIdx = indices[curIdx];
AssertFatal(curVIdx < numVerts, "Out of range index.");
@ -117,7 +117,7 @@ void OptimizeTriangleOrdering(const dsize_t numVerts, const dsize_t numIndices,
// Step 2: Start emitting triangles...this is the emit loop
//
LRUCacheModel lruCache;
for(int outIdx = 0; outIdx < numIndices; /* this space intentionally left blank */ )
for(S32 outIdx = 0; outIdx < numIndices; /* this space intentionally left blank */ )
{
// If there is no next best triangle, than search for the next highest
// scored triangle that isn't in the list already
@ -127,7 +127,7 @@ void OptimizeTriangleOrdering(const dsize_t numVerts, const dsize_t numIndices,
nextBestTriScore = nextNextBestTriScore = -1.0f;
nextBestTriIdx = nextNextBestTriIdx = -1;
for(int tri = 0; tri < NumPrimitives; tri++)
for(S32 tri = 0; tri < NumPrimitives; tri++)
{
TriData &curTri = triangleData[tri];
@ -143,7 +143,7 @@ void OptimizeTriangleOrdering(const dsize_t numVerts, const dsize_t numIndices,
// Emit the next best triangle
TriData &nextBestTri = triangleData[nextBestTriIdx];
AssertFatal(!nextBestTri.isInList, "Next best triangle already in list, this is no good.");
for(int i = 0; i < 3; i++)
for(S32 i = 0; i < 3; i++)
{
// Emit index
outIndices[outIdx++] = IndexType(nextBestTri.vertIdx[i]);
@ -151,7 +151,7 @@ void OptimizeTriangleOrdering(const dsize_t numVerts, const dsize_t numIndices,
// Update the list of triangles on the vert
VertData &curVert = vertexData[nextBestTri.vertIdx[i]];
curVert.numUnaddedReferences--;
for(int t = 0; t < curVert.numReferences; t++)
for(S32 t = 0; t < curVert.numReferences; t++)
{
if(curVert.triIndex[t] == nextBestTriIdx)
{
@ -184,7 +184,7 @@ void OptimizeTriangleOrdering(const dsize_t numVerts, const dsize_t numIndices,
{
tri.score = 0.0f;
for(int i = 0; i < 3; i++)
for(S32 i = 0; i < 3; i++)
tri.score += vertexData[tri.vertIdx[i]].score;
_CHECK_NEXT_BEST(tri.score, *itr);
@ -288,12 +288,12 @@ void LRUCacheModel::enforceSize(const dsize_t maxSize, Vector<U32> &outTrisToUpd
// Update cache position on verts still in cache
vData.cachePosition = length++;
for(int i = 0; i < vData.numReferences; i++)
for(S32 i = 0; i < vData.numReferences; i++)
{
const S32 &triIdx = vData.triIndex[i];
if(triIdx > -1)
{
int j = 0;
S32 j = 0;
for(; j < outTrisToUpdate.size(); j++)
if(outTrisToUpdate[j] == triIdx)
break;
@ -378,7 +378,7 @@ F32 score(const VertData &vertexData)
AssertFatal(vertexData.cachePosition < MaxSizeVertexCache, "Out of range cache position for vertex");
// Points for being high in the cache.
const float Scaler = 1.0f / (MaxSizeVertexCache - 3);
const F32 Scaler = 1.0f / (MaxSizeVertexCache - 3);
Score = 1.0f - (vertexData.cachePosition - 3) * Scaler;
Score = mPow(Score, FindVertexScore::CacheDecayPower);
}
@ -387,7 +387,7 @@ F32 score(const VertData &vertexData)
// Bonus points for having a low number of tris still to
// use the vert, so we get rid of lone verts quickly.
float ValenceBoost = mPow(vertexData.numUnaddedReferences, -FindVertexScore::ValenceBoostPower);
F32 ValenceBoost = mPow(vertexData.numUnaddedReferences, -FindVertexScore::ValenceBoostPower);
Score += FindVertexScore::ValenceBoostScale * ValenceBoost;
return Score;

View file

@ -150,8 +150,8 @@ class VideoEncoderTheora : public VideoEncoder, public Thread
F64 videotime = th_granule_time(td,ogg_page_granulepos(&videopage));
if (videotime > 0)
{
int hundredths=(int)(videotime*100-(long)videotime*100);
int seconds=(long)videotime%60;
S32 hundredths=(int)(videotime*100-(long)videotime*100);
S32 seconds=(long)videotime%60;
Platform::outputDebugString("Encoding time %g %02i.%02i", videotime, seconds, hundredths);
}
}
@ -254,12 +254,12 @@ public:
th_info_clear(&ti);
// This is needed for youtube compatibility
int vp3_compatible = 1;
S32 vp3_compatible = 1;
th_encode_ctl(td, TH_ENCCTL_SET_VP3_COMPATIBLE, &vp3_compatible, sizeof(vp3_compatible));
// Set the encoder to max speed
int speed_max;
int ret;
S32 speed_max;
S32 ret;
ret = th_encode_ctl(td, TH_ENCCTL_GET_SPLEVEL_MAX, &speed_max, sizeof(speed_max));
if(ret<0){
Platform::outputDebugString("VideoEncoderTheora::begin() - could not determine maximum speed level.");