mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-07 17:29:36 +00:00
aarch64: fix android build
This commit is contained in:
+2
-2
@@ -4244,12 +4244,12 @@ ZRESULT TUnzip::Unzip(int index,void *dst,unsigned int len,DWORD flags)
|
||||
#ifdef _WIN32
|
||||
SetFileTime(h,&ze.ctime,&ze.atime,&ze.mtime);
|
||||
#elif defined( ANDROID )
|
||||
struct timespec ts[2];
|
||||
struct timespec ts[2];
|
||||
ts[0].tv_sec = ze.atime;
|
||||
ts[0].tv_nsec = 0;
|
||||
ts[1].tv_sec = ze.mtime;
|
||||
ts[1].tv_nsec = 0;
|
||||
utimensat((int)h, NULL, ts, 0);
|
||||
utimensat((intptr_t)h, NULL, ts, 0);
|
||||
#else
|
||||
struct timeval tv[2];
|
||||
tv[0].tv_sec = ze.atime;
|
||||
|
||||
@@ -1215,7 +1215,7 @@ FORCEINLINE int RoundFloatToInt(float f)
|
||||
};
|
||||
flResult = __fctiw( f );
|
||||
return pResult[1];
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#elif defined (__arm__) || defined (__aarch64__)
|
||||
return (int)(f + 0.5f);
|
||||
#else
|
||||
#error Unknown architecture
|
||||
@@ -1247,7 +1247,7 @@ FORCEINLINE unsigned long RoundFloatToUnsignedLong(float f)
|
||||
Assert( pIntResult[1] >= 0 );
|
||||
return pResult[1];
|
||||
#else // !X360
|
||||
#if defined(__arm__) || defined(__arm64__)
|
||||
#if defined(__arm__) || defined(__aarch64__)
|
||||
return (unsigned long)(f + 0.5f);
|
||||
#elif defined( PLATFORM_WINDOWS_PC64 )
|
||||
uint nRet = ( uint ) f;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -42,7 +42,7 @@ public:
|
||||
Polyhedron_IndexedLine_t *pLines;
|
||||
Polyhedron_IndexedLineReference_t *pIndices;
|
||||
Polyhedron_IndexedPolygon_t *pPolygons;
|
||||
|
||||
|
||||
unsigned short iVertexCount;
|
||||
unsigned short iLineCount;
|
||||
unsigned short iIndexCount;
|
||||
@@ -53,10 +53,10 @@ public:
|
||||
Vector Center( void );
|
||||
};
|
||||
|
||||
class CPolyhedron_AllocByNew final : public CPolyhedron
|
||||
class CPolyhedron_AllocByNew : public CPolyhedron
|
||||
{
|
||||
public:
|
||||
void Release( void ) override;
|
||||
virtual void Release( void );
|
||||
static CPolyhedron_AllocByNew *Allocate( unsigned short iVertices, unsigned short iLines, unsigned short iIndices, unsigned short iPolygons ); //creates the polyhedron along with enough memory to hold all it's data in a single allocation
|
||||
|
||||
private:
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#if defined( _X360 )
|
||||
#include <xboxmath.h>
|
||||
#elif defined(__arm__) || defined(__arm64__)
|
||||
#elif defined(__arm__) || defined(__aarch64__)
|
||||
#include "sse2neon.h"
|
||||
#else
|
||||
#include <xmmintrin.h>
|
||||
@@ -1787,6 +1787,18 @@ FORCEINLINE fltx4 LoadAlignedSIMD( const VectorAligned & pSIMD )
|
||||
return SetWToZeroSIMD( LoadAlignedSIMD(pSIMD.Base()) );
|
||||
}
|
||||
|
||||
#ifdef __SANITIZE_ADDRESS__
|
||||
static __attribute__((no_sanitize("address"))) fltx4 LoadUnalignedSIMD( const void *pSIMD )
|
||||
{
|
||||
return _mm_loadu_ps( reinterpret_cast<const float *>( pSIMD ) );
|
||||
|
||||
}
|
||||
|
||||
static __attribute__((no_sanitize("address"))) fltx4 LoadUnaligned3SIMD( const void *pSIMD )
|
||||
{
|
||||
return _mm_loadu_ps( reinterpret_cast<const float *>( pSIMD ) );
|
||||
}
|
||||
#else
|
||||
FORCEINLINE fltx4 LoadUnalignedSIMD( const void *pSIMD )
|
||||
{
|
||||
return _mm_loadu_ps( reinterpret_cast<const float *>( pSIMD ) );
|
||||
@@ -1796,6 +1808,7 @@ FORCEINLINE fltx4 LoadUnaligned3SIMD( const void *pSIMD )
|
||||
{
|
||||
return _mm_loadu_ps( reinterpret_cast<const float *>( pSIMD ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
/// replicate a single 32 bit integer value to all 4 components of an m128
|
||||
FORCEINLINE fltx4 ReplicateIX4( int i )
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "tier0/dbg.h"
|
||||
#include "mathlib/math_pfns.h"
|
||||
|
||||
#ifdef __arm__
|
||||
#if defined (__arm__) || defined(__aarch64__)
|
||||
#include "sse2neon.h"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -512,7 +512,7 @@ inline const char *CSaveRestoreSegment::StringFromSymbol( int token )
|
||||
/// compilers. Either way, there's no portable intrinsic.
|
||||
|
||||
// Newer GCC versions provide this in this header, older did by default.
|
||||
#if !defined( _rotr ) && defined( COMPILER_GCC ) && !defined( __arm__ ) && !defined( __arm64__ )
|
||||
#if !defined( _rotr ) && defined( COMPILER_GCC ) && !defined( __arm__ ) && !defined( __aarch64__ )
|
||||
#include <x86intrin.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ typedef unsigned char uint8;
|
||||
#define POSIX 1
|
||||
#endif
|
||||
|
||||
#if defined(__x86_64__) || defined(_WIN64) || defined(__arm64__)
|
||||
#if defined(__x86_64__) || defined(_WIN64) || defined(__aarch64__)
|
||||
#define X64BITS
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
//========== Copyright (C) Valve Corporation, All rights reserved. ==========//
|
||||
//
|
||||
// Purpose: CVirtualMemoryManager interface
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef MEM_VIRT_H
|
||||
#define MEM_VIRT_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
#define VMM_KB ( 1024 )
|
||||
#define VMM_MB ( 1024 * VMM_KB )
|
||||
|
||||
#ifdef _PS3
|
||||
// Total virtual address space reserved by CVirtualMemoryManager on startup:
|
||||
#define VMM_VIRTUAL_SIZE ( 512 * VMM_MB )
|
||||
#define VMM_PAGE_SIZE ( 64 * VMM_KB )
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// Allocate virtual sections via IMemAlloc::AllocateVirtualMemorySection
|
||||
abstract_class IVirtualMemorySection
|
||||
{
|
||||
public:
|
||||
// Information about memory section
|
||||
virtual void * GetBaseAddress() = 0;
|
||||
virtual size_t GetPageSize() = 0;
|
||||
virtual size_t GetTotalSize() = 0;
|
||||
|
||||
// Functions to manage physical memory mapped to virtual memory
|
||||
virtual bool CommitPages( void *pvBase, size_t numBytes ) = 0;
|
||||
virtual void DecommitPages( void *pvBase, size_t numBytes ) = 0;
|
||||
|
||||
// Release the physical memory and associated virtual address space
|
||||
virtual void Release() = 0;
|
||||
};
|
||||
|
||||
// Get the IVirtualMemorySection associated with a given memory address (if any):
|
||||
extern IVirtualMemorySection *GetMemorySectionForAddress( void *pAddress );
|
||||
|
||||
|
||||
#endif // MEM_VIRT_H
|
||||
+10
-4
@@ -9,7 +9,7 @@
|
||||
#ifndef PLATFORM_H
|
||||
#define PLATFORM_H
|
||||
|
||||
#if defined(__x86_64__) || defined(_WIN64) || defined(__arm64__)
|
||||
#if defined(__x86_64__) || defined(_WIN64) || defined(__aarch64__)
|
||||
#define PLATFORM_64BITS 1
|
||||
#endif
|
||||
|
||||
@@ -440,7 +440,7 @@ typedef void * HINSTANCE;
|
||||
// On OSX, SIGTRAP doesn't really stop the thread cold when debugging.
|
||||
// So if being debugged, use INT3 which is precise.
|
||||
#ifdef OSX
|
||||
#if defined(__arm__) || defined(__arm64__)
|
||||
#if defined(__arm__) || defined(__aarch64__)
|
||||
#ifdef __clang__
|
||||
#define DebuggerBreak() do { if ( Plat_IsInDebugSession() ) { __builtin_debugtrap(); } else { raise(SIGTRAP); } } while(0)
|
||||
#elif defined __GNUC__
|
||||
@@ -631,6 +631,7 @@ typedef void * HINSTANCE;
|
||||
#endif
|
||||
|
||||
// Used for standard calling conventions
|
||||
|
||||
#if defined( _WIN32 ) && !defined( _X360 )
|
||||
#define STDCALL __stdcall
|
||||
#define FASTCALL __fastcall
|
||||
@@ -687,6 +688,11 @@ typedef void * HINSTANCE;
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#ifdef __SANITIZE_ADDRESS__
|
||||
#undef FORCEINLINE
|
||||
#define FORCEINLINE static
|
||||
#endif
|
||||
|
||||
// Remove warnings from warning level 4.
|
||||
#pragma warning(disable : 4514) // warning C4514: 'acosl' : unreferenced inline function has been removed
|
||||
#pragma warning(disable : 4100) // warning C4100: 'hwnd' : unreferenced formal parameter
|
||||
@@ -861,7 +867,7 @@ static FORCEINLINE double fsel(double fComparand, double fValGE, double fLT)
|
||||
|
||||
#endif
|
||||
#endif
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#elif defined (__arm__) || defined (__aarch64__)
|
||||
inline void SetupFPUControlWord() {}
|
||||
#else
|
||||
inline void SetupFPUControlWord()
|
||||
@@ -1198,7 +1204,7 @@ PLATFORM_INTERFACE struct tm * Plat_localtime( const time_t *timep, struct tm *
|
||||
|
||||
inline uint64 Plat_Rdtsc()
|
||||
{
|
||||
#if (defined( __arm__ ) || defined( __arm64__ )) && defined (POSIX)
|
||||
#if (defined( __arm__ ) || defined( __aarch64__ )) && defined (POSIX)
|
||||
struct timespec t;
|
||||
clock_gettime( CLOCK_REALTIME, &t);
|
||||
return t.tv_sec * 1000000000ULL + t.tv_nsec;
|
||||
|
||||
@@ -81,7 +81,7 @@ enum ThreadPriorityEnum_t
|
||||
TP_PRIORITY_LOW = 2001,
|
||||
TP_PRIORITY_DEFAULT = 1001
|
||||
#error "Need PRIORITY_LOWEST/HIGHEST"
|
||||
#elif defined( PLATFORM_LINUX )
|
||||
#elif defined( LINUX )
|
||||
// We can use nice on Linux threads to change scheduling.
|
||||
// pthreads on Linux only allows priority setting on
|
||||
// real-time threads.
|
||||
@@ -103,7 +103,7 @@ enum ThreadPriorityEnum_t
|
||||
#endif // PLATFORM_PS3
|
||||
};
|
||||
|
||||
#if defined( PLATFORM_LINUX )
|
||||
#if defined( LINUX )
|
||||
#define TP_IS_PRIORITY_HIGHER( a, b ) ( ( a ) < ( b ) )
|
||||
#else
|
||||
#define TP_IS_PRIORITY_HIGHER( a, b ) ( ( a ) > ( b ) )
|
||||
@@ -229,6 +229,8 @@ inline void ThreadPause()
|
||||
{
|
||||
#if defined( COMPILER_PS3 )
|
||||
__db16cyc();
|
||||
#elif defined(__arm__) || defined(__aarch64__)
|
||||
sched_yield();
|
||||
#elif defined( COMPILER_GCC )
|
||||
__asm __volatile( "pause" );
|
||||
#elif defined ( COMPILER_MSVC64 )
|
||||
@@ -301,15 +303,7 @@ inline int32 ThreadInterlockedDecrement( int32 volatile *p )
|
||||
inline int32 ThreadInterlockedExchange( int32 volatile *p, int32 value )
|
||||
{
|
||||
Assert( (size_t)p % 4 == 0 );
|
||||
int32 nRet;
|
||||
|
||||
// Note: The LOCK instruction prefix is assumed on the XCHG instruction and GCC gets very confused on the Mac when we use it.
|
||||
__asm __volatile(
|
||||
"xchgl %2,(%1)"
|
||||
: "=r" (nRet)
|
||||
: "r" (p), "0" (value)
|
||||
: "memory");
|
||||
return nRet;
|
||||
return __sync_lock_test_and_set( p, value );
|
||||
}
|
||||
|
||||
inline int32 ThreadInterlockedExchangeAdd( int32 volatile *p, int32 value )
|
||||
|
||||
@@ -120,7 +120,7 @@ INLINE_ON_PS3 bool CThread::Start( unsigned nBytesStack, ThreadPriorityEnum_t nP
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#ifdef _WIN32
|
||||
m_hThread = (HANDLE)CreateThread( NULL,
|
||||
nBytesStack,
|
||||
(LPTHREAD_START_ROUTINE)GetThreadProc(),
|
||||
@@ -168,7 +168,7 @@ INLINE_ON_PS3 bool CThread::Start( unsigned nBytesStack, ThreadPriorityEnum_t nP
|
||||
}
|
||||
|
||||
bInitSuccess = true;
|
||||
#elif PLATFORM_POSIX
|
||||
#elif POSIX
|
||||
pthread_attr_t attr;
|
||||
pthread_attr_init( &attr );
|
||||
pthread_attr_setstacksize( &attr, MAX( nBytesStack, 1024u*1024 ) );
|
||||
@@ -236,7 +236,7 @@ INLINE_ON_PS3 bool CThread::Start( unsigned nBytesStack, ThreadPriorityEnum_t nP
|
||||
|
||||
INLINE_ON_PS3 bool CThread::IsAlive()
|
||||
{
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#ifdef _WIN32
|
||||
DWORD dwExitCode;
|
||||
return (
|
||||
m_hThread
|
||||
@@ -526,7 +526,7 @@ INLINE_ON_PS3 void CThread::ThreadProcRunWithMinidumpHandler( void *pv )
|
||||
pInit->pThread->m_result = pInit->pThread->Run();
|
||||
}
|
||||
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#ifdef _WIN32
|
||||
unsigned long STDCALL CThread::ThreadProc(LPVOID pv)
|
||||
#else
|
||||
INLINE_ON_PS3 void* CThread::ThreadProc(LPVOID pv)
|
||||
|
||||
@@ -373,7 +373,7 @@ struct RenderTargetState_t
|
||||
|
||||
static inline bool LessFunc( const RenderTargetState_t &lhs, const RenderTargetState_t &rhs )
|
||||
{
|
||||
COMPILE_TIME_ASSERT( sizeof( lhs.m_pRenderTargets[0] ) == sizeof( uint32 ) );
|
||||
COMPILE_TIME_ASSERT( sizeof( lhs.m_pRenderTargets[0] ) == sizeof( uintp ) );
|
||||
uint64 lhs0 = reinterpret_cast<const uint64 *>(lhs.m_pRenderTargets)[0];
|
||||
uint64 rhs0 = reinterpret_cast<const uint64 *>(rhs.m_pRenderTargets)[0];
|
||||
if ( lhs0 < rhs0 )
|
||||
|
||||
@@ -1838,11 +1838,11 @@ FORCEINLINE void GLMContext::DrawRangeElements( GLenum mode, GLuint start, GLuin
|
||||
if ( pIndexBuf->m_bPseudo )
|
||||
{
|
||||
// you have to pass actual address, not offset
|
||||
indicesActual = (void*)( (int)indicesActual + (int)pIndexBuf->m_pPseudoBuf );
|
||||
indicesActual = (void*)( (intp)indicesActual + (intp)pIndexBuf->m_pPseudoBuf );
|
||||
}
|
||||
if (pIndexBuf->m_bUsingPersistentBuffer)
|
||||
{
|
||||
indicesActual = (void*)( (int)indicesActual + (int)pIndexBuf->m_nPersistentBufferStartOffset );
|
||||
indicesActual = (void*)( (intp)indicesActual + (intp)pIndexBuf->m_nPersistentBufferStartOffset );
|
||||
}
|
||||
|
||||
//#if GLMDEBUG
|
||||
|
||||
Reference in New Issue
Block a user