mirror of
https://github.com/nillerusr/source-engine.git
synced 2024-12-22 06:06:50 +00:00
aarch64: fix android build
This commit is contained in:
parent
57bb27e443
commit
2e7fa2dfc8
@ -4850,7 +4850,9 @@ void Host_FreeToLowMark( bool server )
|
||||
//-----------------------------------------------------------------------------
|
||||
void Host_Shutdown(void)
|
||||
{
|
||||
#ifndef ANDROID
|
||||
extern void ShutdownMixerControls();
|
||||
#endif
|
||||
|
||||
if ( host_checkheap )
|
||||
{
|
||||
@ -4962,7 +4964,7 @@ void Host_Shutdown(void)
|
||||
|
||||
#ifndef SWDS
|
||||
TRACESHUTDOWN( Key_Shutdown() );
|
||||
#ifndef _X360
|
||||
#if !defined _X360 && !defined ANDROID
|
||||
TRACESHUTDOWN( ShutdownMixerControls() );
|
||||
#endif
|
||||
#endif
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "tier0/dbg.h"
|
||||
#include "mathlib/mathlib.h"
|
||||
#include "mathlib/vector.h"
|
||||
#if defined(__arm__) || defined(__arm64__)
|
||||
#if defined(__arm__) || defined(__aarch64__)
|
||||
#include "sse2neon.h"
|
||||
#endif
|
||||
|
||||
@ -180,7 +180,7 @@ float _SSE_RSqrtFast(float x)
|
||||
Assert( s_bMathlibInitialized );
|
||||
|
||||
float rroot;
|
||||
#if defined(__arm__) || defined(__arm64__)
|
||||
#if defined(__arm__) || defined(__aarch64__)
|
||||
rroot = _SSE_RSqrtAccurate(x);
|
||||
#elif _WIN32
|
||||
_asm
|
||||
@ -217,7 +217,7 @@ float FASTCALL _SSE_VectorNormalize (Vector& vec)
|
||||
// be much of a performance win, considering you will very likely miss 3 branch predicts in a row.
|
||||
if ( v[0] || v[1] || v[2] )
|
||||
{
|
||||
#if defined(__arm__) || defined(__arm64__)
|
||||
#if defined(__arm__) || defined(__aarch64__)
|
||||
float rsqrt = _SSE_RSqrtAccurate( v[0] * v[0] + v[1] * v[1] + v[2] * v[2] );
|
||||
r[0] = v[0] * rsqrt;
|
||||
r[1] = v[1] * rsqrt;
|
||||
@ -296,7 +296,7 @@ void FASTCALL _SSE_VectorNormalizeFast (Vector& vec)
|
||||
float _SSE_InvRSquared(const float* v)
|
||||
{
|
||||
float inv_r2 = 1.f;
|
||||
#if defined(__arm__) || defined(__arm64__)
|
||||
#if defined(__arm__) || defined(__aarch64__)
|
||||
return _SSE_RSqrtAccurate( FLT_EPSILON + v[0] * v[0] + v[1] * v[1] + v[2] * v[2] );
|
||||
#elif _WIN32
|
||||
_asm { // Intel SSE only routine
|
||||
@ -391,7 +391,7 @@ typedef __m64 v2si; // vector of 2 int (mmx)
|
||||
|
||||
void _SSE_SinCos(float x, float* s, float* c)
|
||||
{
|
||||
#if defined(__arm__) || defined(__arm64__)
|
||||
#if defined(__arm__) || defined(__aarch64__)
|
||||
#if defined( OSX )
|
||||
__sincosf(x, s, c);
|
||||
#elif defined( POSIX )
|
||||
@ -607,7 +607,7 @@ void _SSE_SinCos(float x, float* s, float* c)
|
||||
|
||||
float _SSE_cos( float x )
|
||||
{
|
||||
#if defined(__arm__) || defined(__arm64__)
|
||||
#if defined(__arm__) || defined(__aarch64__)
|
||||
return cos(x);
|
||||
#elif _WIN32
|
||||
float temp;
|
||||
|
@ -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;
|
||||
|
2293
public/mathlib/polyhedron.cpp
Normal file
2293
public/mathlib/polyhedron.cpp
Normal file
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
|
||||
|
||||
|
46
public/tier0/memvirt.h
Normal file
46
public/tier0/memvirt.h
Normal file
@ -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
|
@ -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
|
||||
|
@ -22,7 +22,7 @@ const tchar* GetProcessorVendorId();
|
||||
|
||||
static bool cpuid(uint32 function, uint32& out_eax, uint32& out_ebx, uint32& out_ecx, uint32& out_edx)
|
||||
{
|
||||
#if defined (__arm__) || defined (__arm64__) || defined( _X360 )
|
||||
#if defined (__arm__) || defined (__aarch64__) || defined( _X360 )
|
||||
return false;
|
||||
#elif defined(GNUC)
|
||||
|
||||
|
@ -129,7 +129,7 @@ uint64 CalculateCPUFreq()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(__arm__) && !defined(__arm64__)
|
||||
#if !defined(__arm__) && !defined(__aarch64__)
|
||||
// Compute the period. Loop until we get 3 consecutive periods that
|
||||
// are the same to within a small error. The error is chosen
|
||||
// to be +/- 0.02% on a P-200.
|
||||
|
6
tier0/mem_impl_type.h
Normal file
6
tier0/mem_impl_type.h
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
#if ( (!defined( POSIX )||defined(_GAMECONSOLE)) && (defined(_DEBUG) || defined(USE_MEM_DEBUG) ) )
|
||||
#define MEM_IMPL_TYPE_DBG 1
|
||||
#else
|
||||
#define MEM_IMPL_TYPE_STD 1
|
||||
#endif
|
@ -1836,7 +1836,7 @@ static inline void unprotect_malloc_zone( malloc_zone_t *malloc_zone )
|
||||
// The version check may not be necessary, but we know it was RW before that.
|
||||
if ( malloc_zone->version >= 8 )
|
||||
{
|
||||
#ifdef __arm64__
|
||||
#ifdef __aarch64__
|
||||
// MoeMod : this is required for Apple Silicon
|
||||
pthread_jit_write_protect_np(false);
|
||||
#endif
|
||||
@ -1849,7 +1849,7 @@ static inline void protect_malloc_zone( malloc_zone_t *malloc_zone )
|
||||
if ( malloc_zone->version >= 8 )
|
||||
{
|
||||
vm_protect( mach_task_self(), (uintptr_t)malloc_zone, sizeof( malloc_zone_t ), 0, VM_PROT_READ );
|
||||
#ifdef __arm64__
|
||||
#ifdef __aarch64__
|
||||
// MoeMod : this is required for Apple Silicon
|
||||
pthread_jit_write_protect_np(true);
|
||||
#endif
|
||||
|
@ -6,29 +6,19 @@
|
||||
|
||||
#include "tier0/platform.h"
|
||||
|
||||
#if defined( PLATFORM_WINDOWS_PC )
|
||||
#if defined(_WIN32)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define _WIN32_WINNT 0x0403
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#ifdef _WIN32
|
||||
#include <process.h>
|
||||
#ifdef PLATFORM_WINDOWS_PC
|
||||
#ifdef _WIN32
|
||||
#include <Mmsystem.h>
|
||||
#pragma comment(lib, "winmm.lib")
|
||||
#endif
|
||||
#elif PLATFORM_PS3
|
||||
#include <sched.h>
|
||||
#include <unistd.h>
|
||||
#include <exception>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/timer.h>
|
||||
#define GetLastError() errno
|
||||
typedef void *LPVOID;
|
||||
#elif PLATFORM_POSIX
|
||||
#elif POSIX
|
||||
#include <sched.h>
|
||||
#include <exception>
|
||||
#include <errno.h>
|
||||
@ -38,8 +28,13 @@
|
||||
#define GetLastError() errno
|
||||
typedef void *LPVOID;
|
||||
#if !defined(OSX)
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/unistd.h>
|
||||
#if defined(ANDROID)
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/unistd.h>
|
||||
#endif
|
||||
#define sem_unlink( arg )
|
||||
#define OS_TO_PTHREAD(x) (x)
|
||||
#else
|
||||
@ -155,7 +150,7 @@ struct ThreadProcInfo_t
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#ifdef _WIN32
|
||||
static DWORD WINAPI ThreadProcConvert( void *pParam )
|
||||
{
|
||||
ThreadProcInfo_t info = *((ThreadProcInfo_t *)pParam);
|
||||
@ -165,7 +160,7 @@ static DWORD WINAPI ThreadProcConvert( void *pParam )
|
||||
FreeThreadID();
|
||||
return nRet;
|
||||
}
|
||||
#elif defined( PLATFORM_PS3 )
|
||||
#elif defined( PS3 )
|
||||
union ThreadProcInfoUnion_t
|
||||
{
|
||||
struct Val_t
|
||||
@ -262,7 +257,7 @@ void TlsSetValue( uint32 index, void *pValue )
|
||||
|
||||
|
||||
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#ifdef _WIN32
|
||||
class CThreadHandleToIDMap
|
||||
{
|
||||
public:
|
||||
@ -421,12 +416,12 @@ void JoinTestThreads( ThreadHandle_t *pHandles )
|
||||
|
||||
ThreadHandle_t CreateSimpleThread( ThreadFunc_t pfnThread, void *pParam, unsigned stackSize )
|
||||
{
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#ifdef _WIN32
|
||||
DWORD threadID;
|
||||
HANDLE hThread = (HANDLE)CreateThread( NULL, stackSize, ThreadProcConvert, new ThreadProcInfo_t( pfnThread, pParam ), stackSize ? STACK_SIZE_PARAM_IS_A_RESERVATION : 0, &threadID );
|
||||
AddThreadHandleToIDMap( hThread, threadID );
|
||||
return (ThreadHandle_t)hThread;
|
||||
#elif PLATFORM_PS3
|
||||
#elif PS3
|
||||
//TestThreads();
|
||||
ThreadHandle_t th;
|
||||
ThreadProcInfoUnion_t info;
|
||||
@ -439,7 +434,7 @@ ThreadHandle_t CreateSimpleThread( ThreadFunc_t pfnThread, void *pParam, unsigne
|
||||
return 0;
|
||||
}
|
||||
return th;
|
||||
#elif PLATFORM_POSIX
|
||||
#elif POSIX
|
||||
pthread_t tid;
|
||||
pthread_create( &tid, NULL, ThreadProcConvert, new ThreadProcInfo_t( pfnThread, pParam ) );
|
||||
return ( ThreadHandle_t ) tid;
|
||||
@ -452,14 +447,14 @@ ThreadHandle_t CreateSimpleThread( ThreadFunc_t pfnThread, void *pParam, unsigne
|
||||
|
||||
ThreadHandle_t CreateSimpleThread( ThreadFunc_t pfnThread, void *pParam, ThreadId_t *pID, unsigned stackSize )
|
||||
{
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#ifdef _WIN32
|
||||
DWORD threadID;
|
||||
HANDLE hThread = (HANDLE)CreateThread( NULL, stackSize, ThreadProcConvert, new ThreadProcInfo_t( pfnThread, pParam ), stackSize ? STACK_SIZE_PARAM_IS_A_RESERVATION : 0, &threadID );
|
||||
if( pID )
|
||||
*pID = (ThreadId_t)threadID;
|
||||
AddThreadHandleToIDMap( hThread, threadID );
|
||||
return (ThreadHandle_t)hThread;
|
||||
#elif PLATFORM_POSIX
|
||||
#elif POSIX
|
||||
pthread_t tid;
|
||||
pthread_create( &tid, NULL, ThreadProcConvert, new ThreadProcInfo_t( pfnThread, pParam ) );
|
||||
if( pID )
|
||||
@ -494,7 +489,7 @@ void ThreadSleep(unsigned nMilliseconds)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
||||
#ifdef PLATFORM_WINDOWS_PC
|
||||
#ifdef _WIN32_PC
|
||||
static bool bInitialized = false;
|
||||
if ( !bInitialized )
|
||||
{
|
||||
@ -508,7 +503,7 @@ void ThreadSleep(unsigned nMilliseconds)
|
||||
#endif
|
||||
|
||||
Sleep( nMilliseconds );
|
||||
#elif PLATFORM_PS3
|
||||
#elif PS3
|
||||
if( nMilliseconds == 0 )
|
||||
{
|
||||
// sys_ppu_thread_yield doesn't seem to function properly, so sleep instead.
|
||||
@ -530,7 +525,7 @@ void ThreadNanoSleep(unsigned ns)
|
||||
#ifdef _WIN32
|
||||
// ceil
|
||||
Sleep( ( ns + 999 ) / 1000 );
|
||||
#elif PLATFORM_PS3
|
||||
#elif PS3
|
||||
sys_timer_usleep( ns );
|
||||
#elif defined(POSIX)
|
||||
struct timespec tm;
|
||||
@ -814,7 +809,7 @@ sys_lwmutex_t CThreadSyncObject::m_staticMutex;
|
||||
CThreadSyncObject::CThreadSyncObject()
|
||||
#ifdef _WIN32
|
||||
: m_hSyncObject( NULL ), m_bCreatedHandle(false)
|
||||
#elif defined(POSIX) && !defined(PLATFORM_PS3)
|
||||
#elif defined(POSIX) && !defined(PS3)
|
||||
: m_bInitalized( false )
|
||||
#endif
|
||||
{
|
||||
@ -857,7 +852,7 @@ CThreadSyncObject::~CThreadSyncObject()
|
||||
Assert( 0 );
|
||||
}
|
||||
}
|
||||
#elif defined(POSIX) && !defined( PLATFORM_PS3 )
|
||||
#elif defined(POSIX) && !defined( PS3 )
|
||||
if ( m_bInitalized )
|
||||
{
|
||||
pthread_cond_destroy( &m_Condition );
|
||||
@ -871,7 +866,7 @@ CThreadSyncObject::~CThreadSyncObject()
|
||||
|
||||
bool CThreadSyncObject::operator!() const
|
||||
{
|
||||
#if PLATFORM_PS3
|
||||
#if PS3
|
||||
return m_bstaticMutexInitialized;
|
||||
#elif defined( _WIN32 )
|
||||
return !m_hSyncObject;
|
||||
@ -885,7 +880,7 @@ bool CThreadSyncObject::operator!() const
|
||||
void CThreadSyncObject::AssertUseable()
|
||||
{
|
||||
#ifdef THREADS_DEBUG
|
||||
#if PLATFORM_PS3
|
||||
#if PS3
|
||||
AssertMsg( m_bstaticMutexInitialized, "Thread synchronization object is unuseable" );
|
||||
#elif defined( _WIN32 )
|
||||
AssertMsg( m_hSyncObject, "Thread synchronization object is unuseable" );
|
||||
@ -905,7 +900,7 @@ bool CThreadSyncObject::Wait( uint32 dwTimeout )
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
return ( WaitForSingleObject( m_hSyncObject, dwTimeout ) == WAIT_OBJECT_0 );
|
||||
#elif defined( POSIX ) && !defined( PLATFORM_PS3 )
|
||||
#elif defined( POSIX ) && !defined( PS3 )
|
||||
pthread_mutex_lock( &m_Mutex );
|
||||
bool bRet = false;
|
||||
if ( m_cSet > 0 )
|
||||
@ -1263,7 +1258,7 @@ void CThreadEvent::UnregisterWaitingThread(sys_semaphore_t *pSemaphore)
|
||||
#endif // _PS3
|
||||
|
||||
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#ifdef _WIN32
|
||||
CThreadEvent::CThreadEvent( const char *name, bool initialState, bool bManualReset )
|
||||
{
|
||||
m_hSyncObject = CreateEvent( NULL, bManualReset, (BOOL) initialState, name );
|
||||
|
@ -13,7 +13,7 @@ bool CheckMMXTechnology(void) { return false; }
|
||||
bool CheckSSETechnology(void) { return false; }
|
||||
bool CheckSSE2Technology(void) { return false; }
|
||||
bool Check3DNowTechnology(void) { return false; }
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#elif defined (__arm__) || defined (__aarch64__)
|
||||
bool CheckMMXTechnology(void) { return false; }
|
||||
bool CheckSSETechnology(void) { return false; }
|
||||
bool CheckSSE2Technology(void) { return false; }
|
||||
|
@ -87,7 +87,7 @@ int64 CReliableTimer::GetPerformanceCountNow()
|
||||
uint64 ulNow;
|
||||
SYS_TIMEBASE_GET( ulNow );
|
||||
return ulNow;
|
||||
#elif (defined( __arm__ ) || defined( __arm64__ )) && defined (POSIX)
|
||||
#elif (defined( __arm__ ) || defined( __aarch64__ )) && defined (POSIX)
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
return ts.tv_sec * 1000000000ULL + ts.tv_nsec;
|
||||
|
@ -47,7 +47,6 @@
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef POSIX
|
||||
#include <iconv.h>
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
@ -79,7 +78,12 @@
|
||||
#include "xbox/xbox_win32stubs.h"
|
||||
#endif
|
||||
#include "tier0/memdbgon.h"
|
||||
#include "iconv.h"
|
||||
|
||||
#ifdef ANDROID
|
||||
#include "common/iconv.h"
|
||||
#elif POSIX
|
||||
#include <iconv.h>
|
||||
#endif
|
||||
|
||||
static int FastToLower( char c )
|
||||
{
|
||||
|
@ -66,6 +66,7 @@ def build(bld):
|
||||
|
||||
includes = [
|
||||
'.',
|
||||
'../',
|
||||
'../public',
|
||||
'../public/tier1',
|
||||
'../public/tier0',
|
||||
|
@ -667,7 +667,7 @@ void GLMContext::DumpCaps( void )
|
||||
#define dumpfield_hex( fff ) printf( "\n %-30s : 0x%08x", #fff, (int) m_caps.fff )
|
||||
#define dumpfield_str( fff ) printf( "\n %-30s : %s", #fff, m_caps.fff )
|
||||
|
||||
printf("\n-------------------------------- context caps for context %08x", (uint)this);
|
||||
printf("\n-------------------------------- context caps for context %zx", (size_t)this);
|
||||
|
||||
dumpfield( m_fullscreen );
|
||||
dumpfield( m_accelerated );
|
||||
@ -4925,11 +4925,11 @@ void GLMContext::DrawRangeElementsNonInline( GLenum mode, GLuint start, GLuint e
|
||||
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 GL_ENABLE_INDEX_VERIFICATION
|
||||
|
@ -573,7 +573,7 @@ FORCEINLINE void GLMContext::FlushDrawStates( uint nStartIndex, uint nEndIndex,
|
||||
|
||||
SetBufAndVertexAttribPointer( nIndex, pBuf->GetHandle(),
|
||||
pStream->m_stride, pDeclElem->m_gldecl.m_datatype, pDeclElem->m_gldecl.m_normalized, pDeclElem->m_gldecl.m_nCompCount,
|
||||
reinterpret_cast< const GLvoid * >( reinterpret_cast< int >( pBuf->m_pPseudoBuf ) + nBufOffset ),
|
||||
reinterpret_cast< const GLvoid * >( reinterpret_cast< intp >( pBuf->m_pPseudoBuf ) + nBufOffset ),
|
||||
pBuf->m_nRevision );
|
||||
|
||||
if ( !( m_lastKnownVertexAttribMask & nMask ) )
|
||||
|
@ -131,7 +131,7 @@ void CPhysicsEnvironment::PostRestore()
|
||||
|
||||
void CVPhysPtrSaveRestoreOps::Save( const SaveRestoreFieldInfo_t &fieldInfo, ISave *pSave )
|
||||
{
|
||||
void *pField = (void *)fieldInfo.pField;
|
||||
char *pField = (char *)fieldInfo.pField;
|
||||
int nObjects = fieldInfo.pTypeDesc->fieldSize;
|
||||
for ( int i = 0; i < nObjects; i++ )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user