Browse Source

arm64 : intp fixes

pull/71/head
hymei 2 years ago committed by nillerusr
parent
commit
0499fde751
  1. 36
      engine/spatialpartition.cpp
  2. 6
      game/client/c_baseanimating.cpp
  3. 10
      public/tier2/riff.h
  4. 4
      tier1/byteswap.cpp
  5. 20
      tier2/soundutils.cpp

36
engine/spatialpartition.cpp

@ -95,14 +95,14 @@ struct EntityInfo_t
uint8 m_flags; uint8 m_flags;
char m_nLevel[NUM_TREES]; // Which level voxel tree is it in? char m_nLevel[NUM_TREES]; // Which level voxel tree is it in?
unsigned short m_nVisitBit[NUM_TREES]; unsigned short m_nVisitBit[NUM_TREES];
int m_iLeafList[NUM_TREES]; // Index into the leaf pool - leaf list for entity (m_aLeafList). intp m_iLeafList[NUM_TREES]; // Index into the leaf pool - leaf list for entity (m_aLeafList).
}; };
struct LeafListData_t struct LeafListData_t
{ {
UtlHashFastHandle_t m_hVoxel; // Voxel handle the entity is in. UtlHashFastHandle_t m_hVoxel; // Voxel handle the entity is in.
int m_iEntity; // Entity list index for voxel intp m_iEntity; // Entity list index for voxel
}; };
typedef CUtlFixedLinkedList<LeafListData_t> CLeafList; typedef CUtlFixedLinkedList<LeafListData_t> CLeafList;
@ -206,7 +206,7 @@ private:
inline void PackVoxel( int iX, int iY, int iZ, Voxel_t &voxel ); inline void PackVoxel( int iX, int iY, int iZ, Voxel_t &voxel );
typedef CUtlHashFixed<int, SPHASH_BUCKET_COUNT, CUtlHashFixedGenericHash<SPHASH_BUCKET_COUNT> > CHashTable; typedef CUtlHashFixed<intp, SPHASH_BUCKET_COUNT, CUtlHashFixedGenericHash<SPHASH_BUCKET_COUNT> > CHashTable;
Vector m_vecVoxelOrigin; // Voxel space (hash) origin. Vector m_vecVoxelOrigin; // Voxel space (hash) origin.
CHashTable m_aVoxelHash; // Voxel tree (hash) - data = entity list head handle (m_aEntityList) CHashTable m_aVoxelHash; // Voxel tree (hash) - data = entity list head handle (m_aEntityList)
@ -603,7 +603,7 @@ void CVoxelHash::InsertIntoTree( SpatialPartitionHandle_t hPartition, const Vect
#endif #endif
// Entity list. // Entity list.
int iEntity = m_aEntityList.Alloc( true ); intp iEntity = m_aEntityList.Alloc( true );
m_aEntityList[iEntity] = hPartition; m_aEntityList[iEntity] = hPartition;
UtlHashFastHandle_t hHash = m_aVoxelHash.Find( voxel.uiVoxel ); UtlHashFastHandle_t hHash = m_aVoxelHash.Find( voxel.uiVoxel );
@ -614,13 +614,13 @@ void CVoxelHash::InsertIntoTree( SpatialPartitionHandle_t hPartition, const Vect
} }
else else
{ {
int iHead = m_aVoxelHash.Element( hHash ); intp iHead = m_aVoxelHash.Element( hHash );
m_aEntityList.LinkBefore( iHead, iEntity ); m_aEntityList.LinkBefore( iHead, iEntity );
m_aVoxelHash[hHash] = iEntity; m_aVoxelHash[hHash] = iEntity;
} }
// Leaf list. // Leaf list.
int iLeafList = leafList.Alloc( true ); intp iLeafList = leafList.Alloc( true );
leafList[iLeafList].m_hVoxel = hHash; leafList[iLeafList].m_hVoxel = hHash;
leafList[iLeafList].m_iEntity = iEntity; leafList[iLeafList].m_iEntity = iEntity;
@ -630,7 +630,7 @@ void CVoxelHash::InsertIntoTree( SpatialPartitionHandle_t hPartition, const Vect
} }
else else
{ {
int iHead = info.m_iLeafList[treeId]; intp iHead = info.m_iLeafList[treeId];
leafList.LinkBefore( iHead, iLeafList ); leafList.LinkBefore( iHead, iLeafList );
info.m_iLeafList[treeId] = iLeafList; info.m_iLeafList[treeId] = iLeafList;
} }
@ -649,8 +649,8 @@ void CVoxelHash::RemoveFromTree( SpatialPartitionHandle_t hPartition )
CLeafList &leafList = m_pTree->LeafList(); CLeafList &leafList = m_pTree->LeafList();
int treeId = m_pTree->GetTreeId(); int treeId = m_pTree->GetTreeId();
int iLeaf = data.m_iLeafList[treeId]; intp iLeaf = data.m_iLeafList[treeId];
int iNext; intp iNext;
while ( iLeaf != leafList.InvalidIndex() ) while ( iLeaf != leafList.InvalidIndex() )
{ {
// Get the next voxel - if any. // Get the next voxel - if any.
@ -664,12 +664,12 @@ void CVoxelHash::RemoveFromTree( SpatialPartitionHandle_t hPartition )
} }
// Get the head of the entity list for the voxel. // Get the head of the entity list for the voxel.
int iEntity = leafList[iLeaf].m_iEntity; intp iEntity = leafList[iLeaf].m_iEntity;
int iEntityHead = m_aVoxelHash[hHash]; intp iEntityHead = m_aVoxelHash[hHash];
if ( iEntityHead == iEntity ) if ( iEntityHead == iEntity )
{ {
int iEntityNext = m_aEntityList.Next( iEntityHead ); intp iEntityNext = m_aEntityList.Next( iEntityHead );
if ( iEntityNext == m_aEntityList.InvalidIndex() ) if ( iEntityNext == m_aEntityList.InvalidIndex() )
{ {
m_aVoxelHash.Remove( hHash ); m_aVoxelHash.Remove( hHash );
@ -911,7 +911,7 @@ bool CVoxelHash::EnumerateElementsInVoxel( Voxel_t voxel, const T &intersectTest
return true; return true;
SpatialPartitionHandle_t hPartition; SpatialPartitionHandle_t hPartition;
for ( int i = m_aVoxelHash.Element( hHash ); i != m_aEntityList.InvalidIndex(); i = m_aEntityList.Next(i) ) for ( intp i = m_aVoxelHash.Element( hHash ); i != m_aEntityList.InvalidIndex(); i = m_aEntityList.Next(i) )
{ {
hPartition = m_aEntityList[i]; hPartition = m_aEntityList[i];
if ( hPartition == PARTITION_INVALID_HANDLE ) if ( hPartition == PARTITION_INVALID_HANDLE )
@ -952,7 +952,7 @@ bool CVoxelHash::EnumerateElementsInSingleVoxel( Voxel_t voxel, const T &interse
{ {
// NOTE: We don't have to do the enum id checking, nor do we have to up the // NOTE: We don't have to do the enum id checking, nor do we have to up the
// nesting level, since this only visits 1 voxel. // nesting level, since this only visits 1 voxel.
int iEntityList; intp iEntityList;
UtlHashFastHandle_t hHash = m_aVoxelHash.Find( voxel.uiVoxel ); UtlHashFastHandle_t hHash = m_aVoxelHash.Find( voxel.uiVoxel );
if ( hHash != m_aVoxelHash.InvalidHandle() ) if ( hHash != m_aVoxelHash.InvalidHandle() )
{ {
@ -1394,7 +1394,7 @@ bool CVoxelHash::EnumerateElementsAtPoint( SpatialPartitionListMask_t listMask,
{ {
// NOTE: We don't have to do the enum id checking, nor do we have to up the // NOTE: We don't have to do the enum id checking, nor do we have to up the
// nesting level, since this only visits 1 voxel. // nesting level, since this only visits 1 voxel.
int iEntityList; intp iEntityList;
UtlHashFastHandle_t hHash = m_aVoxelHash.Find( v.uiVoxel ); UtlHashFastHandle_t hHash = m_aVoxelHash.Find( v.uiVoxel );
if ( hHash != m_aVoxelHash.InvalidHandle() ) if ( hHash != m_aVoxelHash.InvalidHandle() )
{ {
@ -1533,7 +1533,7 @@ void CVoxelHash::RenderObjectsInVoxel( Voxel_t voxel, CPartitionVisitor *pVisito
if ( hHash == m_aVoxelHash.InvalidHandle() ) if ( hHash == m_aVoxelHash.InvalidHandle() )
return; return;
int iEntityList = m_aVoxelHash.Element( hHash ); intp iEntityList = m_aVoxelHash.Element( hHash );
while ( iEntityList != m_aEntityList.InvalidIndex() ) while ( iEntityList != m_aEntityList.InvalidIndex() )
{ {
SpatialPartitionHandle_t hPartition = m_aEntityList[iEntityList]; SpatialPartitionHandle_t hPartition = m_aEntityList[iEntityList];
@ -1564,7 +1564,7 @@ int CVoxelHash::EntityCount()
while ( hHash != m_aVoxelHash.m_aBuckets[iBucket].InvalidIndex() ) while ( hHash != m_aVoxelHash.m_aBuckets[iBucket].InvalidIndex() )
{ {
int iEntity = m_aVoxelHash.m_aBuckets[iBucket][hHash].m_Data; intp iEntity = m_aVoxelHash.m_aBuckets[iBucket][hHash].m_Data;
while ( iEntity!= m_aEntityList.InvalidIndex() ) while ( iEntity!= m_aEntityList.InvalidIndex() )
{ {
++nCount; ++nCount;
@ -1645,7 +1645,7 @@ void CVoxelHash::RenderAllObjectsInTree( float flTime )
while ( hHash != m_aVoxelHash.m_aBuckets[iBucket].InvalidIndex() ) while ( hHash != m_aVoxelHash.m_aBuckets[iBucket].InvalidIndex() )
{ {
int iEntity = m_aVoxelHash.m_aBuckets[iBucket][hHash].m_Data; intp iEntity = m_aVoxelHash.m_aBuckets[iBucket][hHash].m_Data;
while ( iEntity!= m_aEntityList.InvalidIndex() ) while ( iEntity!= m_aEntityList.InvalidIndex() )
{ {
SpatialPartitionHandle_t hPartition = m_aEntityList[iEntity]; SpatialPartitionHandle_t hPartition = m_aEntityList[iEntity];

6
game/client/c_baseanimating.cpp

@ -929,7 +929,7 @@ void C_BaseAnimating::LockStudioHdr()
if ( pNewWrapper->GetVirtualModel() ) if ( pNewWrapper->GetVirtualModel() )
{ {
MDLHandle_t hVirtualModel = (MDLHandle_t)(int)(pStudioHdr->virtualModel)&0xffff; MDLHandle_t hVirtualModel = VoidPtrToMDLHandle( pStudioHdr->VirtualModel() );
mdlcache->LockStudioHdr( hVirtualModel ); mdlcache->LockStudioHdr( hVirtualModel );
} }
@ -950,7 +950,7 @@ void C_BaseAnimating::UnlockStudioHdr()
// Parallel rendering: don't unlock model data until end of rendering // Parallel rendering: don't unlock model data until end of rendering
if ( pStudioHdr->GetVirtualModel() ) if ( pStudioHdr->GetVirtualModel() )
{ {
MDLHandle_t hVirtualModel = (MDLHandle_t)(int)pStudioHdr->virtualModel&0xffff; MDLHandle_t hVirtualModel = VoidPtrToMDLHandle( m_pStudioHdr->GetRenderHdr()->VirtualModel() );
pCallQueue->QueueCall( mdlcache, &IMDLCache::UnlockStudioHdr, hVirtualModel ); pCallQueue->QueueCall( mdlcache, &IMDLCache::UnlockStudioHdr, hVirtualModel );
} }
pCallQueue->QueueCall( mdlcache, &IMDLCache::UnlockStudioHdr, m_hStudioHdr ); pCallQueue->QueueCall( mdlcache, &IMDLCache::UnlockStudioHdr, m_hStudioHdr );
@ -961,7 +961,7 @@ void C_BaseAnimating::UnlockStudioHdr()
// Immediate-mode rendering, can unlock immediately // Immediate-mode rendering, can unlock immediately
if ( pStudioHdr->GetVirtualModel() ) if ( pStudioHdr->GetVirtualModel() )
{ {
MDLHandle_t hVirtualModel = (MDLHandle_t)(int)pStudioHdr->virtualModel&0xffff; MDLHandle_t hVirtualModel = VoidPtrToMDLHandle( m_pStudioHdr->GetRenderHdr()->VirtualModel() );
mdlcache->UnlockStudioHdr( hVirtualModel ); mdlcache->UnlockStudioHdr( hVirtualModel );
} }
mdlcache->UnlockStudioHdr( m_hStudioHdr ); mdlcache->UnlockStudioHdr( m_hStudioHdr );

10
public/tier2/riff.h

@ -99,11 +99,11 @@ private:
class IFileWriteBinary class IFileWriteBinary
{ {
public: public:
virtual int create( const char *pFileName ) = 0; virtual intp create( const char *pFileName ) = 0;
virtual int write( void *pData, int size, int file ) = 0; virtual int write( void *pData, int size, intp file ) = 0;
virtual void close( int file ) = 0; virtual void close( intp file ) = 0;
virtual void seek( int file, int pos ) = 0; virtual void seek( intp file, int pos ) = 0;
virtual unsigned int tell( int file ) = 0; virtual unsigned int tell( intp file ) = 0;
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Used to write a RIFF format file // Purpose: Used to write a RIFF format file

4
tier1/byteswap.cpp

@ -34,6 +34,10 @@ void CByteswap::SwapFieldToTargetEndian( void* pOutputBuffer, void *pData, typed
SwapBufferToTargetEndian<int>( (int*)pOutputBuffer, (int*)pData, pField->fieldSize ); SwapBufferToTargetEndian<int>( (int*)pOutputBuffer, (int*)pData, pField->fieldSize );
break; break;
case FIELD_INTEGER64:
SwapBufferToTargetEndian<uint64>( (uint64*)pOutputBuffer, (uint64*)pData, pField->fieldSize );
break;
case FIELD_VECTOR: case FIELD_VECTOR:
SwapBufferToTargetEndian<uint>( (uint*)pOutputBuffer, (uint*)pData, pField->fieldSize * 3 ); SwapBufferToTargetEndian<uint>( (uint*)pOutputBuffer, (uint*)pData, pField->fieldSize * 3 );
break; break;

20
tier2/soundutils.cpp

@ -40,11 +40,11 @@ public:
class CFSIOWriteBinary : public IFileWriteBinary class CFSIOWriteBinary : public IFileWriteBinary
{ {
public: public:
virtual int create( const char *pFileName ); virtual intp create( const char *pFileName );
virtual int write( void *pData, int size, int file ); virtual int write( void *pData, int size, intp file );
virtual void close( int file ); virtual void close( intp file );
virtual void seek( int file, int pos ); virtual void seek( intp file, int pos );
virtual unsigned int tell( int file ); virtual unsigned int tell( intp file );
}; };
@ -110,28 +110,28 @@ void CFSIOReadBinary::close( intp file )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// RIFF writer that use the file system // RIFF writer that use the file system
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int CFSIOWriteBinary::create( const char *pFileName ) intp CFSIOWriteBinary::create( const char *pFileName )
{ {
g_pFullFileSystem->SetFileWritable( pFileName, true ); g_pFullFileSystem->SetFileWritable( pFileName, true );
return (intp)g_pFullFileSystem->Open( pFileName, "wb" ); return (intp)g_pFullFileSystem->Open( pFileName, "wb" );
} }
int CFSIOWriteBinary::write( void *pData, int size, int file ) int CFSIOWriteBinary::write( void *pData, int size, intp file )
{ {
return g_pFullFileSystem->Write( pData, size, (FileHandle_t)file ); return g_pFullFileSystem->Write( pData, size, (FileHandle_t)file );
} }
void CFSIOWriteBinary::close( int file ) void CFSIOWriteBinary::close( intp file )
{ {
g_pFullFileSystem->Close( (FileHandle_t)file ); g_pFullFileSystem->Close( (FileHandle_t)file );
} }
void CFSIOWriteBinary::seek( int file, int pos ) void CFSIOWriteBinary::seek( intp file, int pos )
{ {
g_pFullFileSystem->Seek( (FileHandle_t)file, pos, FILESYSTEM_SEEK_HEAD ); g_pFullFileSystem->Seek( (FileHandle_t)file, pos, FILESYSTEM_SEEK_HEAD );
} }
unsigned int CFSIOWriteBinary::tell( int file ) unsigned int CFSIOWriteBinary::tell( intp file )
{ {
return g_pFullFileSystem->Tell( (FileHandle_t)file ); return g_pFullFileSystem->Tell( (FileHandle_t)file );
} }

Loading…
Cancel
Save