mirror of
https://github.com/nillerusr/source-engine.git
synced 2024-12-22 14:16: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)
|
void Host_Shutdown(void)
|
||||||
{
|
{
|
||||||
|
#ifndef ANDROID
|
||||||
extern void ShutdownMixerControls();
|
extern void ShutdownMixerControls();
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( host_checkheap )
|
if ( host_checkheap )
|
||||||
{
|
{
|
||||||
@ -4962,7 +4964,7 @@ void Host_Shutdown(void)
|
|||||||
|
|
||||||
#ifndef SWDS
|
#ifndef SWDS
|
||||||
TRACESHUTDOWN( Key_Shutdown() );
|
TRACESHUTDOWN( Key_Shutdown() );
|
||||||
#ifndef _X360
|
#if !defined _X360 && !defined ANDROID
|
||||||
TRACESHUTDOWN( ShutdownMixerControls() );
|
TRACESHUTDOWN( ShutdownMixerControls() );
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "tier0/dbg.h"
|
#include "tier0/dbg.h"
|
||||||
#include "mathlib/mathlib.h"
|
#include "mathlib/mathlib.h"
|
||||||
#include "mathlib/vector.h"
|
#include "mathlib/vector.h"
|
||||||
#if defined(__arm__) || defined(__arm64__)
|
#if defined(__arm__) || defined(__aarch64__)
|
||||||
#include "sse2neon.h"
|
#include "sse2neon.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ float _SSE_RSqrtFast(float x)
|
|||||||
Assert( s_bMathlibInitialized );
|
Assert( s_bMathlibInitialized );
|
||||||
|
|
||||||
float rroot;
|
float rroot;
|
||||||
#if defined(__arm__) || defined(__arm64__)
|
#if defined(__arm__) || defined(__aarch64__)
|
||||||
rroot = _SSE_RSqrtAccurate(x);
|
rroot = _SSE_RSqrtAccurate(x);
|
||||||
#elif _WIN32
|
#elif _WIN32
|
||||||
_asm
|
_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.
|
// 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 ( 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] );
|
float rsqrt = _SSE_RSqrtAccurate( v[0] * v[0] + v[1] * v[1] + v[2] * v[2] );
|
||||||
r[0] = v[0] * rsqrt;
|
r[0] = v[0] * rsqrt;
|
||||||
r[1] = v[1] * rsqrt;
|
r[1] = v[1] * rsqrt;
|
||||||
@ -296,7 +296,7 @@ void FASTCALL _SSE_VectorNormalizeFast (Vector& vec)
|
|||||||
float _SSE_InvRSquared(const float* v)
|
float _SSE_InvRSquared(const float* v)
|
||||||
{
|
{
|
||||||
float inv_r2 = 1.f;
|
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] );
|
return _SSE_RSqrtAccurate( FLT_EPSILON + v[0] * v[0] + v[1] * v[1] + v[2] * v[2] );
|
||||||
#elif _WIN32
|
#elif _WIN32
|
||||||
_asm { // Intel SSE only routine
|
_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)
|
void _SSE_SinCos(float x, float* s, float* c)
|
||||||
{
|
{
|
||||||
#if defined(__arm__) || defined(__arm64__)
|
#if defined(__arm__) || defined(__aarch64__)
|
||||||
#if defined( OSX )
|
#if defined( OSX )
|
||||||
__sincosf(x, s, c);
|
__sincosf(x, s, c);
|
||||||
#elif defined( POSIX )
|
#elif defined( POSIX )
|
||||||
@ -607,7 +607,7 @@ void _SSE_SinCos(float x, float* s, float* c)
|
|||||||
|
|
||||||
float _SSE_cos( float x )
|
float _SSE_cos( float x )
|
||||||
{
|
{
|
||||||
#if defined(__arm__) || defined(__arm64__)
|
#if defined(__arm__) || defined(__aarch64__)
|
||||||
return cos(x);
|
return cos(x);
|
||||||
#elif _WIN32
|
#elif _WIN32
|
||||||
float temp;
|
float temp;
|
||||||
|
@ -4244,12 +4244,12 @@ ZRESULT TUnzip::Unzip(int index,void *dst,unsigned int len,DWORD flags)
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
SetFileTime(h,&ze.ctime,&ze.atime,&ze.mtime);
|
SetFileTime(h,&ze.ctime,&ze.atime,&ze.mtime);
|
||||||
#elif defined( ANDROID )
|
#elif defined( ANDROID )
|
||||||
struct timespec ts[2];
|
struct timespec ts[2];
|
||||||
ts[0].tv_sec = ze.atime;
|
ts[0].tv_sec = ze.atime;
|
||||||
ts[0].tv_nsec = 0;
|
ts[0].tv_nsec = 0;
|
||||||
ts[1].tv_sec = ze.mtime;
|
ts[1].tv_sec = ze.mtime;
|
||||||
ts[1].tv_nsec = 0;
|
ts[1].tv_nsec = 0;
|
||||||
utimensat((int)h, NULL, ts, 0);
|
utimensat((intptr_t)h, NULL, ts, 0);
|
||||||
#else
|
#else
|
||||||
struct timeval tv[2];
|
struct timeval tv[2];
|
||||||
tv[0].tv_sec = ze.atime;
|
tv[0].tv_sec = ze.atime;
|
||||||
|
@ -1215,7 +1215,7 @@ FORCEINLINE int RoundFloatToInt(float f)
|
|||||||
};
|
};
|
||||||
flResult = __fctiw( f );
|
flResult = __fctiw( f );
|
||||||
return pResult[1];
|
return pResult[1];
|
||||||
#elif defined (__arm__) || defined (__arm64__)
|
#elif defined (__arm__) || defined (__aarch64__)
|
||||||
return (int)(f + 0.5f);
|
return (int)(f + 0.5f);
|
||||||
#else
|
#else
|
||||||
#error Unknown architecture
|
#error Unknown architecture
|
||||||
@ -1247,7 +1247,7 @@ FORCEINLINE unsigned long RoundFloatToUnsignedLong(float f)
|
|||||||
Assert( pIntResult[1] >= 0 );
|
Assert( pIntResult[1] >= 0 );
|
||||||
return pResult[1];
|
return pResult[1];
|
||||||
#else // !X360
|
#else // !X360
|
||||||
#if defined(__arm__) || defined(__arm64__)
|
#if defined(__arm__) || defined(__aarch64__)
|
||||||
return (unsigned long)(f + 0.5f);
|
return (unsigned long)(f + 0.5f);
|
||||||
#elif defined( PLATFORM_WINDOWS_PC64 )
|
#elif defined( PLATFORM_WINDOWS_PC64 )
|
||||||
uint nRet = ( uint ) f;
|
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_IndexedLine_t *pLines;
|
||||||
Polyhedron_IndexedLineReference_t *pIndices;
|
Polyhedron_IndexedLineReference_t *pIndices;
|
||||||
Polyhedron_IndexedPolygon_t *pPolygons;
|
Polyhedron_IndexedPolygon_t *pPolygons;
|
||||||
|
|
||||||
unsigned short iVertexCount;
|
unsigned short iVertexCount;
|
||||||
unsigned short iLineCount;
|
unsigned short iLineCount;
|
||||||
unsigned short iIndexCount;
|
unsigned short iIndexCount;
|
||||||
@ -53,10 +53,10 @@ public:
|
|||||||
Vector Center( void );
|
Vector Center( void );
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPolyhedron_AllocByNew final : public CPolyhedron
|
class CPolyhedron_AllocByNew : public CPolyhedron
|
||||||
{
|
{
|
||||||
public:
|
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
|
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:
|
private:
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#if defined( _X360 )
|
#if defined( _X360 )
|
||||||
#include <xboxmath.h>
|
#include <xboxmath.h>
|
||||||
#elif defined(__arm__) || defined(__arm64__)
|
#elif defined(__arm__) || defined(__aarch64__)
|
||||||
#include "sse2neon.h"
|
#include "sse2neon.h"
|
||||||
#else
|
#else
|
||||||
#include <xmmintrin.h>
|
#include <xmmintrin.h>
|
||||||
@ -1787,6 +1787,18 @@ FORCEINLINE fltx4 LoadAlignedSIMD( const VectorAligned & pSIMD )
|
|||||||
return SetWToZeroSIMD( LoadAlignedSIMD(pSIMD.Base()) );
|
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 )
|
FORCEINLINE fltx4 LoadUnalignedSIMD( const void *pSIMD )
|
||||||
{
|
{
|
||||||
return _mm_loadu_ps( reinterpret_cast<const float *>( 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 ) );
|
return _mm_loadu_ps( reinterpret_cast<const float *>( pSIMD ) );
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/// replicate a single 32 bit integer value to all 4 components of an m128
|
/// replicate a single 32 bit integer value to all 4 components of an m128
|
||||||
FORCEINLINE fltx4 ReplicateIX4( int i )
|
FORCEINLINE fltx4 ReplicateIX4( int i )
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "tier0/dbg.h"
|
#include "tier0/dbg.h"
|
||||||
#include "mathlib/math_pfns.h"
|
#include "mathlib/math_pfns.h"
|
||||||
|
|
||||||
#ifdef __arm__
|
#if defined (__arm__) || defined(__aarch64__)
|
||||||
#include "sse2neon.h"
|
#include "sse2neon.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -512,7 +512,7 @@ inline const char *CSaveRestoreSegment::StringFromSymbol( int token )
|
|||||||
/// compilers. Either way, there's no portable intrinsic.
|
/// compilers. Either way, there's no portable intrinsic.
|
||||||
|
|
||||||
// Newer GCC versions provide this in this header, older did by default.
|
// 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>
|
#include <x86intrin.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ typedef unsigned char uint8;
|
|||||||
#define POSIX 1
|
#define POSIX 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__x86_64__) || defined(_WIN64) || defined(__arm64__)
|
#if defined(__x86_64__) || defined(_WIN64) || defined(__aarch64__)
|
||||||
#define X64BITS
|
#define X64BITS
|
||||||
#endif
|
#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
|
#ifndef PLATFORM_H
|
||||||
#define 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
|
#define PLATFORM_64BITS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -440,7 +440,7 @@ typedef void * HINSTANCE;
|
|||||||
// On OSX, SIGTRAP doesn't really stop the thread cold when debugging.
|
// On OSX, SIGTRAP doesn't really stop the thread cold when debugging.
|
||||||
// So if being debugged, use INT3 which is precise.
|
// So if being debugged, use INT3 which is precise.
|
||||||
#ifdef OSX
|
#ifdef OSX
|
||||||
#if defined(__arm__) || defined(__arm64__)
|
#if defined(__arm__) || defined(__aarch64__)
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
#define DebuggerBreak() do { if ( Plat_IsInDebugSession() ) { __builtin_debugtrap(); } else { raise(SIGTRAP); } } while(0)
|
#define DebuggerBreak() do { if ( Plat_IsInDebugSession() ) { __builtin_debugtrap(); } else { raise(SIGTRAP); } } while(0)
|
||||||
#elif defined __GNUC__
|
#elif defined __GNUC__
|
||||||
@ -631,6 +631,7 @@ typedef void * HINSTANCE;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Used for standard calling conventions
|
// Used for standard calling conventions
|
||||||
|
|
||||||
#if defined( _WIN32 ) && !defined( _X360 )
|
#if defined( _WIN32 ) && !defined( _X360 )
|
||||||
#define STDCALL __stdcall
|
#define STDCALL __stdcall
|
||||||
#define FASTCALL __fastcall
|
#define FASTCALL __fastcall
|
||||||
@ -687,6 +688,11 @@ typedef void * HINSTANCE;
|
|||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
|
#ifdef __SANITIZE_ADDRESS__
|
||||||
|
#undef FORCEINLINE
|
||||||
|
#define FORCEINLINE static
|
||||||
|
#endif
|
||||||
|
|
||||||
// Remove warnings from warning level 4.
|
// Remove warnings from warning level 4.
|
||||||
#pragma warning(disable : 4514) // warning C4514: 'acosl' : unreferenced inline function has been removed
|
#pragma warning(disable : 4514) // warning C4514: 'acosl' : unreferenced inline function has been removed
|
||||||
#pragma warning(disable : 4100) // warning C4100: 'hwnd' : unreferenced formal parameter
|
#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
|
||||||
#endif
|
#endif
|
||||||
#elif defined (__arm__) || defined (__arm64__)
|
#elif defined (__arm__) || defined (__aarch64__)
|
||||||
inline void SetupFPUControlWord() {}
|
inline void SetupFPUControlWord() {}
|
||||||
#else
|
#else
|
||||||
inline void SetupFPUControlWord()
|
inline void SetupFPUControlWord()
|
||||||
@ -1198,7 +1204,7 @@ PLATFORM_INTERFACE struct tm * Plat_localtime( const time_t *timep, struct tm *
|
|||||||
|
|
||||||
inline uint64 Plat_Rdtsc()
|
inline uint64 Plat_Rdtsc()
|
||||||
{
|
{
|
||||||
#if (defined( __arm__ ) || defined( __arm64__ )) && defined (POSIX)
|
#if (defined( __arm__ ) || defined( __aarch64__ )) && defined (POSIX)
|
||||||
struct timespec t;
|
struct timespec t;
|
||||||
clock_gettime( CLOCK_REALTIME, &t);
|
clock_gettime( CLOCK_REALTIME, &t);
|
||||||
return t.tv_sec * 1000000000ULL + t.tv_nsec;
|
return t.tv_sec * 1000000000ULL + t.tv_nsec;
|
||||||
|
@ -81,7 +81,7 @@ enum ThreadPriorityEnum_t
|
|||||||
TP_PRIORITY_LOW = 2001,
|
TP_PRIORITY_LOW = 2001,
|
||||||
TP_PRIORITY_DEFAULT = 1001
|
TP_PRIORITY_DEFAULT = 1001
|
||||||
#error "Need PRIORITY_LOWEST/HIGHEST"
|
#error "Need PRIORITY_LOWEST/HIGHEST"
|
||||||
#elif defined( PLATFORM_LINUX )
|
#elif defined( LINUX )
|
||||||
// We can use nice on Linux threads to change scheduling.
|
// We can use nice on Linux threads to change scheduling.
|
||||||
// pthreads on Linux only allows priority setting on
|
// pthreads on Linux only allows priority setting on
|
||||||
// real-time threads.
|
// real-time threads.
|
||||||
@ -103,7 +103,7 @@ enum ThreadPriorityEnum_t
|
|||||||
#endif // PLATFORM_PS3
|
#endif // PLATFORM_PS3
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined( PLATFORM_LINUX )
|
#if defined( LINUX )
|
||||||
#define TP_IS_PRIORITY_HIGHER( a, b ) ( ( a ) < ( b ) )
|
#define TP_IS_PRIORITY_HIGHER( a, b ) ( ( a ) < ( b ) )
|
||||||
#else
|
#else
|
||||||
#define TP_IS_PRIORITY_HIGHER( a, b ) ( ( a ) > ( b ) )
|
#define TP_IS_PRIORITY_HIGHER( a, b ) ( ( a ) > ( b ) )
|
||||||
@ -229,6 +229,8 @@ inline void ThreadPause()
|
|||||||
{
|
{
|
||||||
#if defined( COMPILER_PS3 )
|
#if defined( COMPILER_PS3 )
|
||||||
__db16cyc();
|
__db16cyc();
|
||||||
|
#elif defined(__arm__) || defined(__aarch64__)
|
||||||
|
sched_yield();
|
||||||
#elif defined( COMPILER_GCC )
|
#elif defined( COMPILER_GCC )
|
||||||
__asm __volatile( "pause" );
|
__asm __volatile( "pause" );
|
||||||
#elif defined ( COMPILER_MSVC64 )
|
#elif defined ( COMPILER_MSVC64 )
|
||||||
@ -301,15 +303,7 @@ inline int32 ThreadInterlockedDecrement( int32 volatile *p )
|
|||||||
inline int32 ThreadInterlockedExchange( int32 volatile *p, int32 value )
|
inline int32 ThreadInterlockedExchange( int32 volatile *p, int32 value )
|
||||||
{
|
{
|
||||||
Assert( (size_t)p % 4 == 0 );
|
Assert( (size_t)p % 4 == 0 );
|
||||||
int32 nRet;
|
return __sync_lock_test_and_set( p, value );
|
||||||
|
|
||||||
// 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int32 ThreadInterlockedExchangeAdd( int32 volatile *p, int32 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
|
#endif
|
||||||
|
|
||||||
#ifdef PLATFORM_WINDOWS
|
#ifdef _WIN32
|
||||||
m_hThread = (HANDLE)CreateThread( NULL,
|
m_hThread = (HANDLE)CreateThread( NULL,
|
||||||
nBytesStack,
|
nBytesStack,
|
||||||
(LPTHREAD_START_ROUTINE)GetThreadProc(),
|
(LPTHREAD_START_ROUTINE)GetThreadProc(),
|
||||||
@ -168,7 +168,7 @@ INLINE_ON_PS3 bool CThread::Start( unsigned nBytesStack, ThreadPriorityEnum_t nP
|
|||||||
}
|
}
|
||||||
|
|
||||||
bInitSuccess = true;
|
bInitSuccess = true;
|
||||||
#elif PLATFORM_POSIX
|
#elif POSIX
|
||||||
pthread_attr_t attr;
|
pthread_attr_t attr;
|
||||||
pthread_attr_init( &attr );
|
pthread_attr_init( &attr );
|
||||||
pthread_attr_setstacksize( &attr, MAX( nBytesStack, 1024u*1024 ) );
|
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()
|
INLINE_ON_PS3 bool CThread::IsAlive()
|
||||||
{
|
{
|
||||||
#ifdef PLATFORM_WINDOWS
|
#ifdef _WIN32
|
||||||
DWORD dwExitCode;
|
DWORD dwExitCode;
|
||||||
return (
|
return (
|
||||||
m_hThread
|
m_hThread
|
||||||
@ -526,7 +526,7 @@ INLINE_ON_PS3 void CThread::ThreadProcRunWithMinidumpHandler( void *pv )
|
|||||||
pInit->pThread->m_result = pInit->pThread->Run();
|
pInit->pThread->m_result = pInit->pThread->Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PLATFORM_WINDOWS
|
#ifdef _WIN32
|
||||||
unsigned long STDCALL CThread::ThreadProc(LPVOID pv)
|
unsigned long STDCALL CThread::ThreadProc(LPVOID pv)
|
||||||
#else
|
#else
|
||||||
INLINE_ON_PS3 void* CThread::ThreadProc(LPVOID pv)
|
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 )
|
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 lhs0 = reinterpret_cast<const uint64 *>(lhs.m_pRenderTargets)[0];
|
||||||
uint64 rhs0 = reinterpret_cast<const uint64 *>(rhs.m_pRenderTargets)[0];
|
uint64 rhs0 = reinterpret_cast<const uint64 *>(rhs.m_pRenderTargets)[0];
|
||||||
if ( lhs0 < rhs0 )
|
if ( lhs0 < rhs0 )
|
||||||
|
@ -1838,11 +1838,11 @@ FORCEINLINE void GLMContext::DrawRangeElements( GLenum mode, GLuint start, GLuin
|
|||||||
if ( pIndexBuf->m_bPseudo )
|
if ( pIndexBuf->m_bPseudo )
|
||||||
{
|
{
|
||||||
// you have to pass actual address, not offset
|
// 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)
|
if (pIndexBuf->m_bUsingPersistentBuffer)
|
||||||
{
|
{
|
||||||
indicesActual = (void*)( (int)indicesActual + (int)pIndexBuf->m_nPersistentBufferStartOffset );
|
indicesActual = (void*)( (intp)indicesActual + (intp)pIndexBuf->m_nPersistentBufferStartOffset );
|
||||||
}
|
}
|
||||||
|
|
||||||
//#if GLMDEBUG
|
//#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)
|
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;
|
return false;
|
||||||
#elif defined(GNUC)
|
#elif defined(GNUC)
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ uint64 CalculateCPUFreq()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(__arm__) && !defined(__arm64__)
|
#if !defined(__arm__) && !defined(__aarch64__)
|
||||||
// Compute the period. Loop until we get 3 consecutive periods that
|
// Compute the period. Loop until we get 3 consecutive periods that
|
||||||
// are the same to within a small error. The error is chosen
|
// are the same to within a small error. The error is chosen
|
||||||
// to be +/- 0.02% on a P-200.
|
// 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.
|
// The version check may not be necessary, but we know it was RW before that.
|
||||||
if ( malloc_zone->version >= 8 )
|
if ( malloc_zone->version >= 8 )
|
||||||
{
|
{
|
||||||
#ifdef __arm64__
|
#ifdef __aarch64__
|
||||||
// MoeMod : this is required for Apple Silicon
|
// MoeMod : this is required for Apple Silicon
|
||||||
pthread_jit_write_protect_np(false);
|
pthread_jit_write_protect_np(false);
|
||||||
#endif
|
#endif
|
||||||
@ -1849,7 +1849,7 @@ static inline void protect_malloc_zone( malloc_zone_t *malloc_zone )
|
|||||||
if ( malloc_zone->version >= 8 )
|
if ( malloc_zone->version >= 8 )
|
||||||
{
|
{
|
||||||
vm_protect( mach_task_self(), (uintptr_t)malloc_zone, sizeof( malloc_zone_t ), 0, VM_PROT_READ );
|
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
|
// MoeMod : this is required for Apple Silicon
|
||||||
pthread_jit_write_protect_np(true);
|
pthread_jit_write_protect_np(true);
|
||||||
#endif
|
#endif
|
||||||
|
@ -6,29 +6,19 @@
|
|||||||
|
|
||||||
#include "tier0/platform.h"
|
#include "tier0/platform.h"
|
||||||
|
|
||||||
#if defined( PLATFORM_WINDOWS_PC )
|
#if defined(_WIN32)
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#define _WIN32_WINNT 0x0403
|
#define _WIN32_WINNT 0x0403
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PLATFORM_WINDOWS
|
#ifdef _WIN32
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
#ifdef PLATFORM_WINDOWS_PC
|
#ifdef _WIN32
|
||||||
#include <Mmsystem.h>
|
#include <Mmsystem.h>
|
||||||
#pragma comment(lib, "winmm.lib")
|
#pragma comment(lib, "winmm.lib")
|
||||||
#endif
|
#endif
|
||||||
#elif PLATFORM_PS3
|
#elif POSIX
|
||||||
#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
|
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -38,8 +28,13 @@
|
|||||||
#define GetLastError() errno
|
#define GetLastError() errno
|
||||||
typedef void *LPVOID;
|
typedef void *LPVOID;
|
||||||
#if !defined(OSX)
|
#if !defined(OSX)
|
||||||
#include <sys/fcntl.h>
|
#if defined(ANDROID)
|
||||||
#include <sys/unistd.h>
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#else
|
||||||
|
#include <sys/fcntl.h>
|
||||||
|
#include <sys/unistd.h>
|
||||||
|
#endif
|
||||||
#define sem_unlink( arg )
|
#define sem_unlink( arg )
|
||||||
#define OS_TO_PTHREAD(x) (x)
|
#define OS_TO_PTHREAD(x) (x)
|
||||||
#else
|
#else
|
||||||
@ -155,7 +150,7 @@ struct ThreadProcInfo_t
|
|||||||
|
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
|
|
||||||
#ifdef PLATFORM_WINDOWS
|
#ifdef _WIN32
|
||||||
static DWORD WINAPI ThreadProcConvert( void *pParam )
|
static DWORD WINAPI ThreadProcConvert( void *pParam )
|
||||||
{
|
{
|
||||||
ThreadProcInfo_t info = *((ThreadProcInfo_t *)pParam);
|
ThreadProcInfo_t info = *((ThreadProcInfo_t *)pParam);
|
||||||
@ -165,7 +160,7 @@ static DWORD WINAPI ThreadProcConvert( void *pParam )
|
|||||||
FreeThreadID();
|
FreeThreadID();
|
||||||
return nRet;
|
return nRet;
|
||||||
}
|
}
|
||||||
#elif defined( PLATFORM_PS3 )
|
#elif defined( PS3 )
|
||||||
union ThreadProcInfoUnion_t
|
union ThreadProcInfoUnion_t
|
||||||
{
|
{
|
||||||
struct Val_t
|
struct Val_t
|
||||||
@ -262,7 +257,7 @@ void TlsSetValue( uint32 index, void *pValue )
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PLATFORM_WINDOWS
|
#ifdef _WIN32
|
||||||
class CThreadHandleToIDMap
|
class CThreadHandleToIDMap
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -421,12 +416,12 @@ void JoinTestThreads( ThreadHandle_t *pHandles )
|
|||||||
|
|
||||||
ThreadHandle_t CreateSimpleThread( ThreadFunc_t pfnThread, void *pParam, unsigned stackSize )
|
ThreadHandle_t CreateSimpleThread( ThreadFunc_t pfnThread, void *pParam, unsigned stackSize )
|
||||||
{
|
{
|
||||||
#ifdef PLATFORM_WINDOWS
|
#ifdef _WIN32
|
||||||
DWORD threadID;
|
DWORD threadID;
|
||||||
HANDLE hThread = (HANDLE)CreateThread( NULL, stackSize, ThreadProcConvert, new ThreadProcInfo_t( pfnThread, pParam ), stackSize ? STACK_SIZE_PARAM_IS_A_RESERVATION : 0, &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 );
|
AddThreadHandleToIDMap( hThread, threadID );
|
||||||
return (ThreadHandle_t)hThread;
|
return (ThreadHandle_t)hThread;
|
||||||
#elif PLATFORM_PS3
|
#elif PS3
|
||||||
//TestThreads();
|
//TestThreads();
|
||||||
ThreadHandle_t th;
|
ThreadHandle_t th;
|
||||||
ThreadProcInfoUnion_t info;
|
ThreadProcInfoUnion_t info;
|
||||||
@ -439,7 +434,7 @@ ThreadHandle_t CreateSimpleThread( ThreadFunc_t pfnThread, void *pParam, unsigne
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return th;
|
return th;
|
||||||
#elif PLATFORM_POSIX
|
#elif POSIX
|
||||||
pthread_t tid;
|
pthread_t tid;
|
||||||
pthread_create( &tid, NULL, ThreadProcConvert, new ThreadProcInfo_t( pfnThread, pParam ) );
|
pthread_create( &tid, NULL, ThreadProcConvert, new ThreadProcInfo_t( pfnThread, pParam ) );
|
||||||
return ( ThreadHandle_t ) tid;
|
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 )
|
ThreadHandle_t CreateSimpleThread( ThreadFunc_t pfnThread, void *pParam, ThreadId_t *pID, unsigned stackSize )
|
||||||
{
|
{
|
||||||
#ifdef PLATFORM_WINDOWS
|
#ifdef _WIN32
|
||||||
DWORD threadID;
|
DWORD threadID;
|
||||||
HANDLE hThread = (HANDLE)CreateThread( NULL, stackSize, ThreadProcConvert, new ThreadProcInfo_t( pfnThread, pParam ), stackSize ? STACK_SIZE_PARAM_IS_A_RESERVATION : 0, &threadID );
|
HANDLE hThread = (HANDLE)CreateThread( NULL, stackSize, ThreadProcConvert, new ThreadProcInfo_t( pfnThread, pParam ), stackSize ? STACK_SIZE_PARAM_IS_A_RESERVATION : 0, &threadID );
|
||||||
if( pID )
|
if( pID )
|
||||||
*pID = (ThreadId_t)threadID;
|
*pID = (ThreadId_t)threadID;
|
||||||
AddThreadHandleToIDMap( hThread, threadID );
|
AddThreadHandleToIDMap( hThread, threadID );
|
||||||
return (ThreadHandle_t)hThread;
|
return (ThreadHandle_t)hThread;
|
||||||
#elif PLATFORM_POSIX
|
#elif POSIX
|
||||||
pthread_t tid;
|
pthread_t tid;
|
||||||
pthread_create( &tid, NULL, ThreadProcConvert, new ThreadProcInfo_t( pfnThread, pParam ) );
|
pthread_create( &tid, NULL, ThreadProcConvert, new ThreadProcInfo_t( pfnThread, pParam ) );
|
||||||
if( pID )
|
if( pID )
|
||||||
@ -494,7 +489,7 @@ void ThreadSleep(unsigned nMilliseconds)
|
|||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
#ifdef PLATFORM_WINDOWS_PC
|
#ifdef _WIN32_PC
|
||||||
static bool bInitialized = false;
|
static bool bInitialized = false;
|
||||||
if ( !bInitialized )
|
if ( !bInitialized )
|
||||||
{
|
{
|
||||||
@ -508,7 +503,7 @@ void ThreadSleep(unsigned nMilliseconds)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
Sleep( nMilliseconds );
|
Sleep( nMilliseconds );
|
||||||
#elif PLATFORM_PS3
|
#elif PS3
|
||||||
if( nMilliseconds == 0 )
|
if( nMilliseconds == 0 )
|
||||||
{
|
{
|
||||||
// sys_ppu_thread_yield doesn't seem to function properly, so sleep instead.
|
// sys_ppu_thread_yield doesn't seem to function properly, so sleep instead.
|
||||||
@ -530,7 +525,7 @@ void ThreadNanoSleep(unsigned ns)
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// ceil
|
// ceil
|
||||||
Sleep( ( ns + 999 ) / 1000 );
|
Sleep( ( ns + 999 ) / 1000 );
|
||||||
#elif PLATFORM_PS3
|
#elif PS3
|
||||||
sys_timer_usleep( ns );
|
sys_timer_usleep( ns );
|
||||||
#elif defined(POSIX)
|
#elif defined(POSIX)
|
||||||
struct timespec tm;
|
struct timespec tm;
|
||||||
@ -814,7 +809,7 @@ sys_lwmutex_t CThreadSyncObject::m_staticMutex;
|
|||||||
CThreadSyncObject::CThreadSyncObject()
|
CThreadSyncObject::CThreadSyncObject()
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
: m_hSyncObject( NULL ), m_bCreatedHandle(false)
|
: m_hSyncObject( NULL ), m_bCreatedHandle(false)
|
||||||
#elif defined(POSIX) && !defined(PLATFORM_PS3)
|
#elif defined(POSIX) && !defined(PS3)
|
||||||
: m_bInitalized( false )
|
: m_bInitalized( false )
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@ -857,7 +852,7 @@ CThreadSyncObject::~CThreadSyncObject()
|
|||||||
Assert( 0 );
|
Assert( 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#elif defined(POSIX) && !defined( PLATFORM_PS3 )
|
#elif defined(POSIX) && !defined( PS3 )
|
||||||
if ( m_bInitalized )
|
if ( m_bInitalized )
|
||||||
{
|
{
|
||||||
pthread_cond_destroy( &m_Condition );
|
pthread_cond_destroy( &m_Condition );
|
||||||
@ -871,7 +866,7 @@ CThreadSyncObject::~CThreadSyncObject()
|
|||||||
|
|
||||||
bool CThreadSyncObject::operator!() const
|
bool CThreadSyncObject::operator!() const
|
||||||
{
|
{
|
||||||
#if PLATFORM_PS3
|
#if PS3
|
||||||
return m_bstaticMutexInitialized;
|
return m_bstaticMutexInitialized;
|
||||||
#elif defined( _WIN32 )
|
#elif defined( _WIN32 )
|
||||||
return !m_hSyncObject;
|
return !m_hSyncObject;
|
||||||
@ -885,7 +880,7 @@ bool CThreadSyncObject::operator!() const
|
|||||||
void CThreadSyncObject::AssertUseable()
|
void CThreadSyncObject::AssertUseable()
|
||||||
{
|
{
|
||||||
#ifdef THREADS_DEBUG
|
#ifdef THREADS_DEBUG
|
||||||
#if PLATFORM_PS3
|
#if PS3
|
||||||
AssertMsg( m_bstaticMutexInitialized, "Thread synchronization object is unuseable" );
|
AssertMsg( m_bstaticMutexInitialized, "Thread synchronization object is unuseable" );
|
||||||
#elif defined( _WIN32 )
|
#elif defined( _WIN32 )
|
||||||
AssertMsg( m_hSyncObject, "Thread synchronization object is unuseable" );
|
AssertMsg( m_hSyncObject, "Thread synchronization object is unuseable" );
|
||||||
@ -905,7 +900,7 @@ bool CThreadSyncObject::Wait( uint32 dwTimeout )
|
|||||||
#endif
|
#endif
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return ( WaitForSingleObject( m_hSyncObject, dwTimeout ) == WAIT_OBJECT_0 );
|
return ( WaitForSingleObject( m_hSyncObject, dwTimeout ) == WAIT_OBJECT_0 );
|
||||||
#elif defined( POSIX ) && !defined( PLATFORM_PS3 )
|
#elif defined( POSIX ) && !defined( PS3 )
|
||||||
pthread_mutex_lock( &m_Mutex );
|
pthread_mutex_lock( &m_Mutex );
|
||||||
bool bRet = false;
|
bool bRet = false;
|
||||||
if ( m_cSet > 0 )
|
if ( m_cSet > 0 )
|
||||||
@ -1263,7 +1258,7 @@ void CThreadEvent::UnregisterWaitingThread(sys_semaphore_t *pSemaphore)
|
|||||||
#endif // _PS3
|
#endif // _PS3
|
||||||
|
|
||||||
|
|
||||||
#ifdef PLATFORM_WINDOWS
|
#ifdef _WIN32
|
||||||
CThreadEvent::CThreadEvent( const char *name, bool initialState, bool bManualReset )
|
CThreadEvent::CThreadEvent( const char *name, bool initialState, bool bManualReset )
|
||||||
{
|
{
|
||||||
m_hSyncObject = CreateEvent( NULL, bManualReset, (BOOL) initialState, name );
|
m_hSyncObject = CreateEvent( NULL, bManualReset, (BOOL) initialState, name );
|
||||||
|
@ -13,7 +13,7 @@ bool CheckMMXTechnology(void) { return false; }
|
|||||||
bool CheckSSETechnology(void) { return false; }
|
bool CheckSSETechnology(void) { return false; }
|
||||||
bool CheckSSE2Technology(void) { return false; }
|
bool CheckSSE2Technology(void) { return false; }
|
||||||
bool Check3DNowTechnology(void) { return false; }
|
bool Check3DNowTechnology(void) { return false; }
|
||||||
#elif defined (__arm__) || defined (__arm64__)
|
#elif defined (__arm__) || defined (__aarch64__)
|
||||||
bool CheckMMXTechnology(void) { return false; }
|
bool CheckMMXTechnology(void) { return false; }
|
||||||
bool CheckSSETechnology(void) { return false; }
|
bool CheckSSETechnology(void) { return false; }
|
||||||
bool CheckSSE2Technology(void) { return false; }
|
bool CheckSSE2Technology(void) { return false; }
|
||||||
|
@ -87,7 +87,7 @@ int64 CReliableTimer::GetPerformanceCountNow()
|
|||||||
uint64 ulNow;
|
uint64 ulNow;
|
||||||
SYS_TIMEBASE_GET( ulNow );
|
SYS_TIMEBASE_GET( ulNow );
|
||||||
return ulNow;
|
return ulNow;
|
||||||
#elif (defined( __arm__ ) || defined( __arm64__ )) && defined (POSIX)
|
#elif (defined( __arm__ ) || defined( __aarch64__ )) && defined (POSIX)
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
clock_gettime(CLOCK_REALTIME, &ts);
|
clock_gettime(CLOCK_REALTIME, &ts);
|
||||||
return ts.tv_sec * 1000000000ULL + ts.tv_nsec;
|
return ts.tv_sec * 1000000000ULL + ts.tv_nsec;
|
||||||
|
@ -47,7 +47,6 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#ifdef POSIX
|
#ifdef POSIX
|
||||||
#include <iconv.h>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -79,7 +78,12 @@
|
|||||||
#include "xbox/xbox_win32stubs.h"
|
#include "xbox/xbox_win32stubs.h"
|
||||||
#endif
|
#endif
|
||||||
#include "tier0/memdbgon.h"
|
#include "tier0/memdbgon.h"
|
||||||
#include "iconv.h"
|
|
||||||
|
#ifdef ANDROID
|
||||||
|
#include "common/iconv.h"
|
||||||
|
#elif POSIX
|
||||||
|
#include <iconv.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static int FastToLower( char c )
|
static int FastToLower( char c )
|
||||||
{
|
{
|
||||||
|
@ -66,6 +66,7 @@ def build(bld):
|
|||||||
|
|
||||||
includes = [
|
includes = [
|
||||||
'.',
|
'.',
|
||||||
|
'../',
|
||||||
'../public',
|
'../public',
|
||||||
'../public/tier1',
|
'../public/tier1',
|
||||||
'../public/tier0',
|
'../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_hex( fff ) printf( "\n %-30s : 0x%08x", #fff, (int) m_caps.fff )
|
||||||
#define dumpfield_str( fff ) printf( "\n %-30s : %s", #fff, 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_fullscreen );
|
||||||
dumpfield( m_accelerated );
|
dumpfield( m_accelerated );
|
||||||
@ -4925,11 +4925,11 @@ void GLMContext::DrawRangeElementsNonInline( GLenum mode, GLuint start, GLuint e
|
|||||||
if ( pIndexBuf->m_bPseudo )
|
if ( pIndexBuf->m_bPseudo )
|
||||||
{
|
{
|
||||||
// you have to pass actual address, not offset
|
// 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)
|
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
|
#if GL_ENABLE_INDEX_VERIFICATION
|
||||||
|
@ -573,7 +573,7 @@ FORCEINLINE void GLMContext::FlushDrawStates( uint nStartIndex, uint nEndIndex,
|
|||||||
|
|
||||||
SetBufAndVertexAttribPointer( nIndex, pBuf->GetHandle(),
|
SetBufAndVertexAttribPointer( nIndex, pBuf->GetHandle(),
|
||||||
pStream->m_stride, pDeclElem->m_gldecl.m_datatype, pDeclElem->m_gldecl.m_normalized, pDeclElem->m_gldecl.m_nCompCount,
|
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 );
|
pBuf->m_nRevision );
|
||||||
|
|
||||||
if ( !( m_lastKnownVertexAttribMask & nMask ) )
|
if ( !( m_lastKnownVertexAttribMask & nMask ) )
|
||||||
|
@ -131,7 +131,7 @@ void CPhysicsEnvironment::PostRestore()
|
|||||||
|
|
||||||
void CVPhysPtrSaveRestoreOps::Save( const SaveRestoreFieldInfo_t &fieldInfo, ISave *pSave )
|
void CVPhysPtrSaveRestoreOps::Save( const SaveRestoreFieldInfo_t &fieldInfo, ISave *pSave )
|
||||||
{
|
{
|
||||||
void *pField = (void *)fieldInfo.pField;
|
char *pField = (char *)fieldInfo.pField;
|
||||||
int nObjects = fieldInfo.pTypeDesc->fieldSize;
|
int nObjects = fieldInfo.pTypeDesc->fieldSize;
|
||||||
for ( int i = 0; i < nObjects; i++ )
|
for ( int i = 0; i < nObjects; i++ )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user