Some cleanup of platform.h and other CryCommon files
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "LogFile.h"
|
||||
#include "CryListenerSet.h"
|
||||
#include "Util/ModalWindowDismisser.h"
|
||||
#include <CryCommon/CryThread.h>
|
||||
#endif
|
||||
|
||||
class CStartupLogoDialog;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "../Include/SandboxAPI.h"
|
||||
#include <set>
|
||||
|
||||
class QWidget;
|
||||
|
||||
|
||||
@@ -12,8 +12,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
#include <AzCore/Math/Guid.h>
|
||||
#include <CryCommon/platform.h>
|
||||
#include <CryCommon/Cry_Geo.h>
|
||||
#include <set>
|
||||
|
||||
// forward declarations.
|
||||
class CEntityObject;
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "Util/GuidUtil.h"
|
||||
#include "ErrorReport.h"
|
||||
|
||||
#include <set>
|
||||
|
||||
class CPakFile;
|
||||
class CErrorRecord;
|
||||
struct IObjectManager;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "CryFile.h"
|
||||
#include "PerforceSourceControl.h"
|
||||
#include "PasswordDlg.h"
|
||||
#include <CryCommon/CryThread.h>
|
||||
|
||||
#include <QSettings>
|
||||
#include <QDir>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
#include <CryCommon/StlUtils.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDropEvent>
|
||||
|
||||
@@ -1527,7 +1527,7 @@ namespace GridMate
|
||||
if (0 != WSAIoctl( m_socket, SIO_GET_MULTIPLE_EXTENSION_FUNCTION_POINTER, &functionTableId,
|
||||
sizeof(GUID), (void**)&m_RIO_FN_TABLE, sizeof(m_RIO_FN_TABLE), &dwBytes, 0, 0))
|
||||
{
|
||||
AZ_Error("GridMate", false, "Could not initialize RIO: %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Could not initialize RIO: %u\n", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
else
|
||||
@@ -1542,13 +1542,13 @@ namespace GridMate
|
||||
|
||||
if ((m_events[WakeupOnSend] = WSACreateEvent()) == WSA_INVALID_EVENT)
|
||||
{
|
||||
AZ_Error("GridMate", false, "Failed WSACreateEvent(): %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Failed WSACreateEvent(): %u\n", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
|
||||
if ((m_events[ReceiveEvent] = WSACreateEvent()) == WSA_INVALID_EVENT)
|
||||
{
|
||||
AZ_Error("GridMate", false, "Failed WSACreateEvent(): %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Failed WSACreateEvent(): %u\n", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
RIO_NOTIFICATION_COMPLETION typeRecv;
|
||||
@@ -1558,13 +1558,13 @@ namespace GridMate
|
||||
m_RIORecvQueue = m_RIO_FN_TABLE.RIOCreateCompletionQueue(maxOutstandingReceive, &typeRecv);
|
||||
if (m_RIORecvQueue == RIO_INVALID_CQ)
|
||||
{
|
||||
AZ_Error("GridMate", false, "Could not RIOCreateCompletionQueue: %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Could not RIOCreateCompletionQueue: %u\n", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
|
||||
if ((m_events[SendEvent] = WSACreateEvent()) == WSA_INVALID_EVENT)
|
||||
{
|
||||
AZ_Error("GridMate", false, "Failed WSACreateEvent(): %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Failed WSACreateEvent(): %u\n", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
RIO_NOTIFICATION_COMPLETION typeSend;
|
||||
@@ -1574,7 +1574,7 @@ namespace GridMate
|
||||
m_RIOSendQueue = m_RIO_FN_TABLE.RIOCreateCompletionQueue(maxOutstandingSend, &typeSend);
|
||||
if (m_RIOSendQueue == RIO_INVALID_CQ)
|
||||
{
|
||||
AZ_Error("GridMate", false, "Could not RIOCreateCompletionQueue: %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Could not RIOCreateCompletionQueue: %u\n", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
|
||||
@@ -1582,7 +1582,7 @@ namespace GridMate
|
||||
maxReceiveDataBuffers, maxOutstandingSend, maxSendDataBuffers, m_RIORecvQueue, m_RIOSendQueue, pContext);
|
||||
if (m_requestQueue == RIO_INVALID_RQ)
|
||||
{
|
||||
AZ_Error("GridMate", m_requestQueue != NULL, "Could not RIOCreateRequestQueue: %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", m_requestQueue != NULL, "Could not RIOCreateRequestQueue: %u\n", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
|
||||
@@ -1595,24 +1595,24 @@ namespace GridMate
|
||||
//Setup Recv raw buffer and RIO record
|
||||
if (nullptr == (m_rawRecvBuffer = AllocRIOBuffer(bufferSize, m_RIORecvBufferCount, &recvAllocated)))
|
||||
{
|
||||
AZ_Error("GridMate", false, "Could not allocate buffer: %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Could not allocate buffer: %u\n", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
if (RIO_INVALID_BUFFERID == (recvBufferId = m_RIO_FN_TABLE.RIORegisterBuffer(m_rawRecvBuffer, bufferSize * m_RIORecvBufferCount)))
|
||||
{
|
||||
AZ_Error("GridMate", false, "Could not register buffer: %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Could not register buffer: %u\n", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
|
||||
//Setup Recv address raw buffer and RIO record
|
||||
if (nullptr == (m_rawRecvAddressBuffer = AllocRIOBuffer(sizeof(SOCKADDR_INET), m_RIORecvBufferCount, &recvAddrsAllocated)))
|
||||
{
|
||||
AZ_Error("GridMate", false, "Could not allocate buffer: %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Could not allocate buffer: %u\n", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
if (RIO_INVALID_BUFFERID == (recvAddressBufferId = m_RIO_FN_TABLE.RIORegisterBuffer(m_rawRecvAddressBuffer, sizeof(SOCKADDR_INET) * m_RIORecvBufferCount)))
|
||||
{
|
||||
AZ_Error("GridMate", false, "Could not register buffer: %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Could not register buffer: %u\n", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
|
||||
@@ -1639,7 +1639,7 @@ namespace GridMate
|
||||
//Start Receive Handler
|
||||
if (false == m_RIO_FN_TABLE.RIOReceiveEx(m_requestQueue, &m_RIORecvBuffer[i], 1, NULL, &m_RIORecvAddressBuffer[i], NULL, NULL, 0, pBuffer))
|
||||
{
|
||||
AZ_Error("GridMate", false, "Could not RIOReceive: %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Could not RIOReceive: %u\n", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
}
|
||||
@@ -1649,25 +1649,25 @@ namespace GridMate
|
||||
//setup send raw buffer and RIO record
|
||||
if (nullptr == (m_rawSendBuffer = AllocRIOBuffer(bufferSize, m_RIOSendBufferCount, &sendAllocated)))
|
||||
{
|
||||
AZ_Error("GridMate", false, "Could not allocate buffer: %u", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Could not allocate buffer: %u", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
if (RIO_INVALID_BUFFERID == (sendBufferId = m_RIO_FN_TABLE.RIORegisterBuffer(m_rawSendBuffer, m_RIOSendBufferCount * bufferSize)))
|
||||
{
|
||||
AZ_Error("GridMate", false, "Could not register buffer: %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Could not register buffer: %u\n", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
|
||||
//setup send address raw buffer and RIO record
|
||||
if (nullptr == (m_rawSendAddressBuffer = AllocRIOBuffer(sizeof(SOCKADDR_INET), m_RIOSendBufferCount, &sendAddrsAllocated)))
|
||||
{
|
||||
AZ_Error("GridMate", false, "Could not allocate send address buffer: %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Could not allocate send address buffer: %u\n", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
|
||||
if (RIO_INVALID_BUFFERID == (sendAddressBufferId = m_RIO_FN_TABLE.RIORegisterBuffer(m_rawSendAddressBuffer, m_RIOSendBufferCount * sizeof(SOCKADDR_INET))))
|
||||
{
|
||||
AZ_Error("GridMate", false, "Could not register buffer: %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Could not register buffer: %u\n", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
|
||||
@@ -1725,7 +1725,7 @@ namespace GridMate
|
||||
if (!m_RIO_FN_TABLE.RIOSendEx(m_requestQueue, &m_RIOSendBuffer[m_workerNextSendBuffer],
|
||||
bufferCount, NULL, &m_RIOSendAddressBuffer[m_workerNextSendBuffer], NULL, NULL, 0, 0))
|
||||
{
|
||||
const DWORD lastError = ::WSAGetLastError();
|
||||
const DWORD lastError = GridMate::Platform::GetSocketError();
|
||||
if (lastError == WSAENOBUFS)
|
||||
{
|
||||
continue; //spin until free
|
||||
@@ -1835,7 +1835,7 @@ namespace GridMate
|
||||
if (false == m_RIO_FN_TABLE.RIOReceiveEx(m_requestQueue, &m_RIORecvBuffer[m_RIONextRecvBuffer],
|
||||
bufferCount, NULL, &m_RIORecvAddressBuffer[m_RIONextRecvBuffer], NULL, NULL, 0, 0))
|
||||
{
|
||||
AZ_Error("GridMate", false, "Could not RIOReceive: %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Could not RIOReceive: %u\n", GridMate::Platform::GetSocketError());
|
||||
}
|
||||
|
||||
if (recvd)
|
||||
@@ -1866,7 +1866,7 @@ namespace GridMate
|
||||
{
|
||||
if (!WSAResetEvent(m_events[Index - WSA_WAIT_EVENT_0]))
|
||||
{
|
||||
AZ_Assert(false, "WSAResetEvent failed with error = %d\n", ::WSAGetLastError());
|
||||
AZ_Assert(false, "WSAResetEvent failed with error = %d\n", GridMate::Platform::GetSocketError());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1925,7 +1925,7 @@ namespace GridMate
|
||||
}
|
||||
else if (isFailed(Index))
|
||||
{
|
||||
AZ_Assert(false, "WSAWaitForMultipleEvents failed with error = %d\n", ::WSAGetLastError());
|
||||
AZ_Assert(false, "WSAWaitForMultipleEvents failed with error = %d\n", GridMate::Platform::GetSocketError());
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@@ -1944,7 +1944,7 @@ namespace GridMate
|
||||
{
|
||||
if (!SetEvent(m_events[WakeupOnSend])) //Wake thread
|
||||
{
|
||||
AZ_Assert(false, "SetEvent failed with error = %d\n", ::WSAGetLastError());
|
||||
AZ_Assert(false, "SetEvent failed with error = %d\n", GridMate::Platform::GetSocketError());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <AzCore/Debug/StackTracer.h>
|
||||
#include <AzCore/IO/SystemFile.h> // for AZ_MAX_PATH_LEN
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
|
||||
#include <CryLibrary.h>
|
||||
|
||||
|
||||
@@ -30,16 +30,6 @@
|
||||
#define MOBILE
|
||||
#endif
|
||||
|
||||
// Force all allocations to be aligned to TARGET_DEFAULT_ALIGN.
|
||||
// This is because malloc on Android 32 bit returns memory that is not aligned
|
||||
// to what some structs/classes need.
|
||||
#define CRY_FORCE_MALLOC_NEW_ALIGN
|
||||
|
||||
#define DEBUG_BREAK raise(SIGTRAP)
|
||||
#define RC_EXECUTABLE "rc"
|
||||
#define USE_CRT 1
|
||||
#define SIZEOF_PTR 4
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Standard includes.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -121,10 +111,6 @@ typedef unsigned char byte;
|
||||
|
||||
#define DEFINE_ALIGNED_DATA(type, name, alignment) \
|
||||
type __attribute__ ((aligned(alignment))) name;
|
||||
#define DEFINE_ALIGNED_DATA_STATIC(type, name, alignment) \
|
||||
static type __attribute__ ((aligned(alignment))) name;
|
||||
#define DEFINE_ALIGNED_DATA_CONST(type, name, alignment) \
|
||||
const type __attribute__ ((aligned(alignment))) name;
|
||||
|
||||
#include "LinuxSpecific.h"
|
||||
// these functions do not exist int the wchar.h header
|
||||
|
||||
@@ -17,10 +17,6 @@
|
||||
#pragma diagnostic ignore "-W#pragma-messages"
|
||||
#endif
|
||||
|
||||
|
||||
#define DEBUG_BREAK __builtin_trap()
|
||||
#define RC_EXECUTABLE "rc"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Standard includes.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -52,12 +48,6 @@
|
||||
#define __COUNTER__ __LINE__
|
||||
#endif
|
||||
|
||||
#ifdef __FUNC__
|
||||
#undef __FUNC__
|
||||
#endif
|
||||
|
||||
#define __FUNC__ __func__
|
||||
|
||||
typedef void* LPVOID;
|
||||
#define VOID void
|
||||
#define PVOID void*
|
||||
@@ -262,10 +252,6 @@ typedef uint64 __uint64;
|
||||
|
||||
#define DEFINE_ALIGNED_DATA(type, name, alignment) \
|
||||
type __attribute__ ((aligned(alignment))) name;
|
||||
#define DEFINE_ALIGNED_DATA_STATIC(type, name, alignment) \
|
||||
static type __attribute__ ((aligned(alignment))) name;
|
||||
#define DEFINE_ALIGNED_DATA_CONST(type, name, alignment) \
|
||||
const type __attribute__ ((aligned(alignment))) name;
|
||||
|
||||
#define BST_UNCHECKED 0x0000
|
||||
|
||||
@@ -298,17 +284,6 @@ enum
|
||||
IDCONTINUE = 11
|
||||
};
|
||||
|
||||
#define ES_MULTILINE 0x0004L
|
||||
#define ES_AUTOVSCROLL 0x0040L
|
||||
#define ES_AUTOHSCROLL 0x0080L
|
||||
#define ES_WANTRETURN 0x1000L
|
||||
|
||||
#define LB_ERR (-1)
|
||||
|
||||
#define LB_ADDSTRING 0x0180
|
||||
#define LB_GETCOUNT 0x018B
|
||||
#define LB_SETTOPINDEX 0x0197
|
||||
|
||||
#define MB_OK 0x00000000L
|
||||
#define MB_OKCANCEL 0x00000001L
|
||||
#define MB_ABORTRETRYIGNORE 0x00000002L
|
||||
@@ -328,22 +303,16 @@ enum
|
||||
|
||||
#define MB_APPLMODAL 0x00000000L
|
||||
|
||||
#define MF_STRING 0x00000000L
|
||||
|
||||
#define MK_LBUTTON 0x0001
|
||||
#define MK_RBUTTON 0x0002
|
||||
#define MK_SHIFT 0x0004
|
||||
#define MK_CONTROL 0x0008
|
||||
#define MK_MBUTTON 0x0010
|
||||
|
||||
#define MK_ALT ( 0x20 )
|
||||
|
||||
#define SM_MOUSEPRESENT 0x00000000L
|
||||
|
||||
#define SM_CMOUSEBUTTONS 43
|
||||
|
||||
#define USER_TIMER_MINIMUM 0x0000000A
|
||||
|
||||
#define VK_TAB 0x09
|
||||
#define VK_SHIFT 0x10
|
||||
#define VK_MENU 0x12
|
||||
@@ -351,11 +320,6 @@ enum
|
||||
#define VK_SPACE 0x20
|
||||
#define VK_DELETE 0x2E
|
||||
|
||||
#define VK_NUMPAD1 0x61
|
||||
#define VK_NUMPAD2 0x62
|
||||
#define VK_NUMPAD3 0x63
|
||||
#define VK_NUMPAD4 0x64
|
||||
|
||||
#define VK_OEM_COMMA 0xBC // ',' any country
|
||||
#define VK_OEM_PERIOD 0xBE // '.' any country
|
||||
#define VK_OEM_3 0xC0 // '`~' for US
|
||||
@@ -386,13 +350,9 @@ enum
|
||||
#define wcsnicmp wcsncasecmp
|
||||
//#define memcpy_s(dest,bytes,src,n) memcpy(dest,src,n)
|
||||
#define _isnan ISNAN
|
||||
#define _wtof(str) wcstod(str, 0)
|
||||
|
||||
|
||||
#define TARGET_DEFAULT_ALIGN (0x8U)
|
||||
|
||||
|
||||
|
||||
#define _msize malloc_size
|
||||
|
||||
|
||||
@@ -498,36 +458,6 @@ typedef HANDLE HMENU;
|
||||
|
||||
#endif //__cplusplus
|
||||
|
||||
inline char* _fullpath(char* absPath, const char* relPath, size_t maxLength)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
|
||||
if (realpath(relPath, path) == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
const size_t len = std::min(strlen(path), maxLength - 1);
|
||||
memcpy(absPath, path, len);
|
||||
absPath[len] = 0;
|
||||
return absPath;
|
||||
}
|
||||
|
||||
typedef union _LARGE_INTEGER
|
||||
{
|
||||
struct
|
||||
{
|
||||
DWORD LowPart;
|
||||
LONG HighPart;
|
||||
};
|
||||
struct
|
||||
{
|
||||
DWORD LowPart;
|
||||
LONG HighPart;
|
||||
} u;
|
||||
|
||||
long long QuadPart;
|
||||
} LARGE_INTEGER;
|
||||
|
||||
extern bool QueryPerformanceCounter(LARGE_INTEGER*);
|
||||
extern bool QueryPerformanceFrequency(LARGE_INTEGER* frequency);
|
||||
|
||||
@@ -568,14 +498,6 @@ inline int closesocket(int s)
|
||||
return ::close(s);
|
||||
}
|
||||
|
||||
inline int WSAGetLastError()
|
||||
{
|
||||
return errno;
|
||||
}
|
||||
|
||||
//we take the definition of the pthread_t type directly from the pthread file
|
||||
#define THREADID_NULL 0
|
||||
|
||||
template <typename T, size_t N>
|
||||
char (*RtlpNumberOf( T (&)[N] ))[N];
|
||||
|
||||
|
||||
@@ -11,12 +11,9 @@
|
||||
#define CRYINCLUDE_CRYCOMMON_BASETYPES_H
|
||||
#pragma once
|
||||
|
||||
#include "CompileTimeAssert.h"
|
||||
|
||||
|
||||
COMPILE_TIME_ASSERT(sizeof(char) == 1);
|
||||
COMPILE_TIME_ASSERT(sizeof(float) == 4);
|
||||
COMPILE_TIME_ASSERT(sizeof(int) >= 4);
|
||||
static_assert(sizeof(char) == 1);
|
||||
static_assert(sizeof(float) == 4);
|
||||
static_assert(sizeof(int) >= 4);
|
||||
|
||||
|
||||
typedef unsigned char uchar;
|
||||
@@ -36,35 +33,35 @@ typedef signed long slong;
|
||||
typedef unsigned long long ulonglong;
|
||||
typedef signed long long slonglong;
|
||||
|
||||
COMPILE_TIME_ASSERT(sizeof(uchar) == sizeof(schar));
|
||||
COMPILE_TIME_ASSERT(sizeof(ushort) == sizeof(sshort));
|
||||
COMPILE_TIME_ASSERT(sizeof(uint) == sizeof(sint));
|
||||
COMPILE_TIME_ASSERT(sizeof(ulong) == sizeof(slong));
|
||||
COMPILE_TIME_ASSERT(sizeof(ulonglong) == sizeof(slonglong));
|
||||
static_assert(sizeof(uchar) == sizeof(schar));
|
||||
static_assert(sizeof(ushort) == sizeof(sshort));
|
||||
static_assert(sizeof(uint) == sizeof(sint));
|
||||
static_assert(sizeof(ulong) == sizeof(slong));
|
||||
static_assert(sizeof(ulonglong) == sizeof(slonglong));
|
||||
|
||||
COMPILE_TIME_ASSERT(sizeof(uchar) <= sizeof(ushort));
|
||||
COMPILE_TIME_ASSERT(sizeof(ushort) <= sizeof(uint));
|
||||
COMPILE_TIME_ASSERT(sizeof(uint) <= sizeof(ulong));
|
||||
COMPILE_TIME_ASSERT(sizeof(ulong) <= sizeof(ulonglong));
|
||||
static_assert(sizeof(uchar) <= sizeof(ushort));
|
||||
static_assert(sizeof(ushort) <= sizeof(uint));
|
||||
static_assert(sizeof(uint) <= sizeof(ulong));
|
||||
static_assert(sizeof(ulong) <= sizeof(ulonglong));
|
||||
|
||||
|
||||
typedef schar int8;
|
||||
typedef schar sint8;
|
||||
typedef uchar uint8;
|
||||
COMPILE_TIME_ASSERT(sizeof(uint8) == 1);
|
||||
COMPILE_TIME_ASSERT(sizeof(sint8) == 1);
|
||||
static_assert(sizeof(uint8) == 1);
|
||||
static_assert(sizeof(sint8) == 1);
|
||||
|
||||
typedef sshort int16;
|
||||
typedef sshort sint16;
|
||||
typedef ushort uint16;
|
||||
COMPILE_TIME_ASSERT(sizeof(uint16) == 2);
|
||||
COMPILE_TIME_ASSERT(sizeof(sint16) == 2);
|
||||
static_assert(sizeof(uint16) == 2);
|
||||
static_assert(sizeof(sint16) == 2);
|
||||
|
||||
typedef sint int32;
|
||||
typedef sint sint32;
|
||||
typedef uint uint32;
|
||||
COMPILE_TIME_ASSERT(sizeof(uint32) == 4);
|
||||
COMPILE_TIME_ASSERT(sizeof(sint32) == 4);
|
||||
static_assert(sizeof(uint32) == 4);
|
||||
static_assert(sizeof(sint32) == 4);
|
||||
|
||||
typedef slonglong int64;
|
||||
|
||||
@@ -72,14 +69,14 @@ typedef slonglong int64;
|
||||
#define O3DE_INT64_DEFINED
|
||||
typedef slonglong sint64;
|
||||
typedef ulonglong uint64;
|
||||
COMPILE_TIME_ASSERT(sizeof(uint64) == 8);
|
||||
COMPILE_TIME_ASSERT(sizeof(sint64) == 8);
|
||||
static_assert(sizeof(uint64) == 8);
|
||||
static_assert(sizeof(sint64) == 8);
|
||||
#endif
|
||||
|
||||
|
||||
typedef float f32;
|
||||
typedef double f64;
|
||||
COMPILE_TIME_ASSERT(sizeof(f32) == 4);
|
||||
COMPILE_TIME_ASSERT(sizeof(f64) == 8);
|
||||
static_assert(sizeof(f32) == 4);
|
||||
static_assert(sizeof(f64) == 8);
|
||||
|
||||
#endif // CRYINCLUDE_CRYCOMMON_BASETYPES_H
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CompileTimeAssert.h"
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
|
||||
// Section dictionary
|
||||
@@ -36,7 +35,6 @@ ILINE uint32 countLeadingZeros32(uint32 x)
|
||||
{
|
||||
DWORD result = 32 ^ 31; // assumes result is unmodified if _BitScanReverse returns 0
|
||||
_BitScanReverse(&result, x);
|
||||
PREFAST_SUPPRESS_WARNING(6102);
|
||||
result ^= 31; // needed because the index is from LSB (whereas all other implementations are from MSB)
|
||||
return result;
|
||||
}
|
||||
@@ -73,16 +71,6 @@ inline bool IsPowerOfTwo(TInteger x)
|
||||
return (x & (x - 1)) == 0;
|
||||
}
|
||||
|
||||
// compile time version of IsPowerOfTwo, useful for STATIC_CHECK
|
||||
template <int nValue>
|
||||
struct IsPowerOfTwoCompileTime
|
||||
{
|
||||
enum
|
||||
{
|
||||
IsPowerOfTwo = ((nValue & (nValue - 1)) == 0)
|
||||
};
|
||||
};
|
||||
|
||||
inline uint32 NextPower2(uint32 n)
|
||||
{
|
||||
n--;
|
||||
@@ -199,45 +187,6 @@ ILINE int32 Isel32(int32 v, int32 alt)
|
||||
return ((static_cast<int32>(v) >> 31) & alt) | ((static_cast<int32>(~v) >> 31) & v);
|
||||
}
|
||||
|
||||
template <uint32 ILOG>
|
||||
struct CompileTimeIntegerLog2
|
||||
{
|
||||
static const uint32 result = 1 + CompileTimeIntegerLog2<(ILOG >> 1)>::result;
|
||||
};
|
||||
template <>
|
||||
struct CompileTimeIntegerLog2<1>
|
||||
{
|
||||
static const uint32 result = 0;
|
||||
};
|
||||
template <>
|
||||
struct CompileTimeIntegerLog2<0>; // keep it undefined, we cannot represent "minus infinity" result
|
||||
|
||||
COMPILE_TIME_ASSERT(CompileTimeIntegerLog2<1>::result == 0);
|
||||
COMPILE_TIME_ASSERT(CompileTimeIntegerLog2<2>::result == 1);
|
||||
COMPILE_TIME_ASSERT(CompileTimeIntegerLog2<3>::result == 1);
|
||||
COMPILE_TIME_ASSERT(CompileTimeIntegerLog2<4>::result == 2);
|
||||
COMPILE_TIME_ASSERT(CompileTimeIntegerLog2<5>::result == 2);
|
||||
COMPILE_TIME_ASSERT(CompileTimeIntegerLog2<255>::result == 7);
|
||||
COMPILE_TIME_ASSERT(CompileTimeIntegerLog2<256>::result == 8);
|
||||
COMPILE_TIME_ASSERT(CompileTimeIntegerLog2<257>::result == 8);
|
||||
|
||||
template <uint32 ILOG>
|
||||
struct CompileTimeIntegerLog2_RoundUp
|
||||
{
|
||||
static const uint32 result = CompileTimeIntegerLog2<ILOG>::result + ((ILOG & (ILOG - 1)) != 0);
|
||||
};
|
||||
template <>
|
||||
struct CompileTimeIntegerLog2_RoundUp<0>; // we can return 0, but let's keep it undefined (same as CompileTimeIntegerLog2<0>)
|
||||
|
||||
COMPILE_TIME_ASSERT(CompileTimeIntegerLog2_RoundUp<1>::result == 0);
|
||||
COMPILE_TIME_ASSERT(CompileTimeIntegerLog2_RoundUp<2>::result == 1);
|
||||
COMPILE_TIME_ASSERT(CompileTimeIntegerLog2_RoundUp<3>::result == 2);
|
||||
COMPILE_TIME_ASSERT(CompileTimeIntegerLog2_RoundUp<4>::result == 2);
|
||||
COMPILE_TIME_ASSERT(CompileTimeIntegerLog2_RoundUp<5>::result == 3);
|
||||
COMPILE_TIME_ASSERT(CompileTimeIntegerLog2_RoundUp<255>::result == 8);
|
||||
COMPILE_TIME_ASSERT(CompileTimeIntegerLog2_RoundUp<256>::result == 8);
|
||||
COMPILE_TIME_ASSERT(CompileTimeIntegerLog2_RoundUp<257>::result == 9);
|
||||
|
||||
// Character-to-bitfield mapping
|
||||
|
||||
inline uint32 AlphaBit(char c)
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
// Inspired by the Boost library's BOOST_STATIC_ASSERT(),
|
||||
// see http://www.boost.org/doc/libs/1_49_0/doc/html/boost_staticassert/how.html
|
||||
// or http://www.boost.org/libs/static_assert
|
||||
|
||||
#ifndef CRYINCLUDE_CRYCOMMON_COMPILETIMEASSERT_H
|
||||
#define CRYINCLUDE_CRYCOMMON_COMPILETIMEASSERT_H
|
||||
#pragma once
|
||||
|
||||
#if defined(__cplusplus)
|
||||
/*
|
||||
template <bool b>
|
||||
struct COMPILE_TIME_ASSERT_FAIL;
|
||||
|
||||
template <>
|
||||
struct COMPILE_TIME_ASSERT_FAIL<true>
|
||||
{
|
||||
};
|
||||
|
||||
template <int i>
|
||||
struct COMPILE_TIME_ASSERT_TEST
|
||||
{
|
||||
enum { dummy = i };
|
||||
};
|
||||
|
||||
#define COMPILE_TIME_ASSERT_BUILD_NAME2(x, y) x##y
|
||||
#define COMPILE_TIME_ASSERT_BUILD_NAME1(x, y) COMPILE_TIME_ASSERT_BUILD_NAME2(x, y)
|
||||
#define COMPILE_TIME_ASSERT_BUILD_NAME(x, y) COMPILE_TIME_ASSERT_BUILD_NAME1(x, y)
|
||||
|
||||
#ifndef __RECODE__
|
||||
#define COMPILE_TIME_ASSERT(expr) \
|
||||
typedef COMPILE_TIME_ASSERT_TEST<sizeof(COMPILE_TIME_ASSERT_FAIL<(bool)(expr)>)> \
|
||||
COMPILE_TIME_ASSERT_BUILD_NAME(compile_time_assert_test_, __LINE__)
|
||||
// note: for MS Visual Studio we could use __COUNTER__ instead of __LINE__
|
||||
#else
|
||||
#define COMPILE_TIME_ASSERT(expr)
|
||||
#endif // __RECODE__
|
||||
|
||||
#else
|
||||
|
||||
#define COMPILE_TIME_ASSERT(expr)
|
||||
*/
|
||||
#endif
|
||||
|
||||
#define COMPILE_TIME_ASSERT_MSG(expr, msg) static_assert(expr, msg)
|
||||
#define COMPILE_TIME_ASSERT(expr) COMPILE_TIME_ASSERT_MSG(expr, "Compile Time Assert")
|
||||
|
||||
|
||||
#endif // CRYINCLUDE_CRYCOMMON_COMPILETIMEASSERT_H
|
||||
@@ -16,24 +16,10 @@
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Convenient iteration macros
|
||||
#define for_iter(IT, it, b, e) for (IT it = (b), _e = (e); it != _e; ++it)
|
||||
#define for_container(CT, it, cont) for_iter (CT::iterator, it, (cont).begin(), (cont).end())
|
||||
|
||||
#define for_ptr(T, it, b, e) for (T* it = (b), * _e = (e); it != _e; ++it)
|
||||
#define for_array_ptr(T, it, arr) for_ptr (T, it, (arr).begin(), (arr).end())
|
||||
|
||||
#define for_array(i, arr) for (int i = 0, _e = (arr).size(); i < _e; i++)
|
||||
#define for_all(cont) for_array (_i, cont) cont[_i]
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Stack array helper
|
||||
#define ALIGNED_STACK_ARRAY(T, name, size, alignment) \
|
||||
PREFAST_SUPPRESS_WARNING(6255) \
|
||||
T * name = (T*) alloca((size) * sizeof(T) + alignment - 1); \
|
||||
name = Align(name, alignment);
|
||||
|
||||
#define STACK_ARRAY(T, name, size) \
|
||||
ALIGNED_STACK_ARRAY(T, name, size, alignof(T)) \
|
||||
#define for_array_ptr(T, it, arr) for_ptr (T, it, (arr).begin(), (arr).end())
|
||||
#define for_array(i, arr) for (int i = 0, _e = (arr).size(); i < _e; i++)
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Specify semantics for moving objects.
|
||||
@@ -774,7 +760,7 @@ namespace NArray
|
||||
|
||||
AP& allocator()
|
||||
{
|
||||
COMPILE_TIME_ASSERT(sizeof(AP) == sizeof(A));
|
||||
static_assert(sizeof(AP) == sizeof(A));
|
||||
return *(AP*)this;
|
||||
}
|
||||
const AP& allocator() const
|
||||
|
||||
@@ -71,7 +71,6 @@
|
||||
#if defined(USE_CRY_ASSERT) && CRYASSERT_H_TRAIT_USE_CRY_ASSERT_MESSAGE
|
||||
void CryAssertTrace(const char*, ...);
|
||||
bool CryAssert(const char*, const char*, unsigned int, bool*);
|
||||
void CryDebugBreak();
|
||||
|
||||
#define CRY_ASSERT(condition) CRY_ASSERT_MESSAGE(condition, NULL)
|
||||
|
||||
@@ -86,7 +85,7 @@ void CryDebugBreak();
|
||||
CryAssertTrace parenthese_message; \
|
||||
if (CryAssert(#condition, __FILE__, __LINE__, &s_bIgnoreAssert)) \
|
||||
{ \
|
||||
DEBUG_BREAK; \
|
||||
AZ::Debug::Trace::Break(); \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
@@ -708,8 +708,8 @@ protected:
|
||||
|
||||
static inline S FromFloat(float fIn)
|
||||
{
|
||||
COMPILE_TIME_ASSERT(sizeof(S) <= 4);
|
||||
COMPILE_TIME_ASSERT(nEXP_BITS > 0 && nEXP_BITS <= 8 && nEXP_BITS < sizeof(S) * 8 - 4);
|
||||
static_assert(sizeof(S) <= 4);
|
||||
static_assert(nEXP_BITS > 0 && nEXP_BITS <= 8 && nEXP_BITS < sizeof(S) * 8 - 4);
|
||||
|
||||
// Clamp to allowed range.
|
||||
float fClamped = clamp_tpl(fIn * fROUNDER(), fMIN(), fMAX());
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
#ifdef MAX_SUB_MATERIALS
|
||||
// This checks that the values are in sync in the different files.
|
||||
COMPILE_TIME_ASSERT(MAX_SUB_MATERIALS == 128);
|
||||
static_assert(MAX_SUB_MATERIALS == 128);
|
||||
#else
|
||||
#define MAX_SUB_MATERIALS 128
|
||||
#endif
|
||||
|
||||
@@ -63,7 +63,6 @@ using DetachEnvironmentFunction = void(*)();
|
||||
#if !defined(WIN32_LEAN_AND_MEAN)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <CryWindows.h>
|
||||
|
||||
HMODULE CryLoadLibrary(const char* libName);
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <limits> // std::numeric_limits
|
||||
#include <type_traits> // std::make_unsigned
|
||||
#include "BaseTypes.h" // uint32, uint64
|
||||
#include "CompileTimeAssert.h"
|
||||
#include "Cry_Vector2.h"
|
||||
#include "Cry_Vector3.h"
|
||||
#include "Cry_Vector4.h"
|
||||
@@ -24,10 +23,10 @@ namespace CryRandom_Internal
|
||||
template <class R, class T, size_t size>
|
||||
struct BoundedRandomUint
|
||||
{
|
||||
COMPILE_TIME_ASSERT(std::numeric_limits<T>::is_integer);
|
||||
COMPILE_TIME_ASSERT(!std::numeric_limits<T>::is_signed);
|
||||
COMPILE_TIME_ASSERT(sizeof(T) == size);
|
||||
COMPILE_TIME_ASSERT(sizeof(T) <= sizeof(uint32));
|
||||
static_assert(std::numeric_limits<T>::is_integer);
|
||||
static_assert(!std::numeric_limits<T>::is_signed);
|
||||
static_assert(sizeof(T) == size);
|
||||
static_assert(sizeof(T) <= sizeof(uint32));
|
||||
|
||||
inline static T Get(R& randomGenerator, const T maxValue)
|
||||
{
|
||||
@@ -41,9 +40,9 @@ namespace CryRandom_Internal
|
||||
template <class R, class T>
|
||||
struct BoundedRandomUint<R, T, 8>
|
||||
{
|
||||
COMPILE_TIME_ASSERT(std::numeric_limits<T>::is_integer);
|
||||
COMPILE_TIME_ASSERT(!std::numeric_limits<T>::is_signed);
|
||||
COMPILE_TIME_ASSERT(sizeof(T) == sizeof(uint64));
|
||||
static_assert(std::numeric_limits<T>::is_integer);
|
||||
static_assert(!std::numeric_limits<T>::is_signed);
|
||||
static_assert(sizeof(T) == sizeof(uint64));
|
||||
|
||||
inline static T Get(R& randomGenerator, const T maxValue)
|
||||
{
|
||||
@@ -65,11 +64,11 @@ namespace CryRandom_Internal
|
||||
template <class R, class T>
|
||||
struct BoundedRandom<R, T, true>
|
||||
{
|
||||
COMPILE_TIME_ASSERT(std::numeric_limits<T>::is_integer);
|
||||
static_assert(std::numeric_limits<T>::is_integer);
|
||||
typedef typename std::make_unsigned<T>::type UT;
|
||||
COMPILE_TIME_ASSERT(sizeof(T) == sizeof(UT));
|
||||
COMPILE_TIME_ASSERT(std::numeric_limits<UT>::is_integer);
|
||||
COMPILE_TIME_ASSERT(!std::numeric_limits<UT>::is_signed);
|
||||
static_assert(sizeof(T) == sizeof(UT));
|
||||
static_assert(std::numeric_limits<UT>::is_integer);
|
||||
static_assert(!std::numeric_limits<UT>::is_signed);
|
||||
|
||||
inline static T Get(R& randomGenerator, T minValue, T maxValue)
|
||||
{
|
||||
@@ -84,7 +83,7 @@ namespace CryRandom_Internal
|
||||
template <class R, class T>
|
||||
struct BoundedRandom<R, T, false>
|
||||
{
|
||||
COMPILE_TIME_ASSERT(!std::numeric_limits<T>::is_integer);
|
||||
static_assert(!std::numeric_limits<T>::is_integer);
|
||||
|
||||
inline static T Get(R& randomGenerator, const T minValue, const T maxValue)
|
||||
{
|
||||
@@ -139,7 +138,7 @@ namespace CryRandom_Internal
|
||||
inline VT GetRandomUnitVector(R& randomGenerator)
|
||||
{
|
||||
typedef typename VT::value_type T;
|
||||
COMPILE_TIME_ASSERT(!std::numeric_limits<T>::is_integer);
|
||||
static_assert(!std::numeric_limits<T>::is_integer);
|
||||
|
||||
VT res;
|
||||
T lenSquared;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <Cry_Quat.h>
|
||||
#include <Cry_Color.h>
|
||||
#include <smartptr.h>
|
||||
#include <AzCore/std/smart_ptr/shared_ptr.h>
|
||||
|
||||
// forward declarations for overloads
|
||||
struct AABB;
|
||||
@@ -579,7 +580,7 @@ protected:
|
||||
|
||||
// use this to push (and automatically pop) the sizer component name at the beginning of the
|
||||
// getSize() function
|
||||
#define SIZER_COMPONENT_NAME(pSizerPointer, szComponentName) PREFAST_SUPPRESS_WARNING(6246) CrySizerComponentNameHelper AZ_JOIN(sizerHelper, __LINE__)(pSizerPointer, szComponentName, false)
|
||||
#define SIZER_SUBCOMPONENT_NAME(pSizerPointer, szComponentName) PREFAST_SUPPRESS_WARNING(6246) CrySizerComponentNameHelper AZ_JOIN(sizerHelper, __LINE__)(pSizerPointer, szComponentName, true)
|
||||
#define SIZER_COMPONENT_NAME(pSizerPointer, szComponentName) CrySizerComponentNameHelper AZ_JOIN(sizerHelper, __LINE__)(pSizerPointer, szComponentName, false)
|
||||
#define SIZER_SUBCOMPONENT_NAME(pSizerPointer, szComponentName) CrySizerComponentNameHelper AZ_JOIN(sizerHelper, __LINE__)(pSizerPointer, szComponentName, true)
|
||||
|
||||
#endif // CRYINCLUDE_CRYCOMMON_CRYSIZER_H
|
||||
|
||||
@@ -14,13 +14,7 @@
|
||||
|
||||
#include "CryThread_pthreads.h"
|
||||
|
||||
#if PLATFORM_SUPPORTS_THREADLOCAL
|
||||
THREADLOCAL CrySimpleThreadSelf
|
||||
* CrySimpleThreadSelf::m_Self = NULL;
|
||||
#else
|
||||
TLS_DEFINE(CrySimpleThreadSelf*, g_CrySimpleThreadSelf)
|
||||
#endif
|
||||
|
||||
AZ_THREAD_LOCAL CrySimpleThreadSelf* CrySimpleThreadSelf::m_Self = NULL;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// CryEvent(Timed) implementation
|
||||
|
||||
@@ -20,7 +20,7 @@ struct SThreadNameDesc
|
||||
DWORD dwFlags;
|
||||
};
|
||||
|
||||
THREADLOCAL CrySimpleThreadSelf* CrySimpleThreadSelf::m_Self = NULL;
|
||||
AZ_THREAD_LOCAL CrySimpleThreadSelf* CrySimpleThreadSelf::m_Self = NULL;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CryEvent::CryEvent()
|
||||
|
||||
@@ -653,15 +653,9 @@ private:
|
||||
|
||||
typedef CryEventTimed CryEvent;
|
||||
|
||||
#if !PLATFORM_SUPPORTS_THREADLOCAL
|
||||
TLS_DECLARE(class CrySimpleThreadSelf*, g_CrySimpleThreadSelf);
|
||||
#endif
|
||||
|
||||
class CrySimpleThreadSelf
|
||||
{
|
||||
protected:
|
||||
#if PLATFORM_SUPPORTS_THREADLOCAL
|
||||
|
||||
static CrySimpleThreadSelf* GetSelf()
|
||||
{
|
||||
return m_Self;
|
||||
@@ -672,21 +666,7 @@ protected:
|
||||
m_Self = pSelf;
|
||||
}
|
||||
private:
|
||||
static THREADLOCAL CrySimpleThreadSelf* m_Self;
|
||||
|
||||
#else
|
||||
|
||||
static CrySimpleThreadSelf* GetSelf()
|
||||
{
|
||||
return TLS_GET(CrySimpleThreadSelf*, g_CrySimpleThreadSelf);
|
||||
}
|
||||
|
||||
static void SetSelf(CrySimpleThreadSelf* pSelf)
|
||||
{
|
||||
TLS_SET(g_CrySimpleThreadSelf, pSelf);
|
||||
}
|
||||
|
||||
#endif
|
||||
static AZ_THREAD_LOCAL CrySimpleThreadSelf* m_Self;
|
||||
};
|
||||
|
||||
template<class Runnable>
|
||||
|
||||
@@ -189,7 +189,7 @@ public:
|
||||
virtual ~CrySimpleThreadSelf();
|
||||
protected:
|
||||
void StartThread(unsigned (__stdcall * func)(void*), void* argList);
|
||||
static THREADLOCAL CrySimpleThreadSelf* m_Self;
|
||||
static AZ_THREAD_LOCAL CrySimpleThreadSelf* m_Self;
|
||||
private:
|
||||
CrySimpleThreadSelf(const CrySimpleThreadSelf&);
|
||||
CrySimpleThreadSelf& operator = (const CrySimpleThreadSelf&);
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// Description : Specific header to handle Windows.h include
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_CRYCOMMON_CRYWINDOWS_H
|
||||
#define CRYINCLUDE_CRYCOMMON_CRYWINDOWS_H
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
|
||||
#endif // CRYINCLUDE_CRYCOMMON_CRYWINDOWS_H
|
||||
@@ -14,6 +14,7 @@
|
||||
#define CRYINCLUDE_CRYCOMMON_IFUNCTORBASE_H
|
||||
#pragma once
|
||||
|
||||
#include <CryCommon/CryThread.h>
|
||||
|
||||
// Base class for functor storage.
|
||||
// Not intended for direct usage.
|
||||
|
||||
@@ -37,10 +37,11 @@ struct IRenderMesh;
|
||||
#include <IXml.h>
|
||||
#include <smartptr.h>
|
||||
#include <AzCore/EBus/EBus.h>
|
||||
#include <CryThread.h>
|
||||
|
||||
#ifdef MAX_SUB_MATERIALS
|
||||
// This checks that the values are in sync in the different files.
|
||||
COMPILE_TIME_ASSERT(MAX_SUB_MATERIALS == 128);
|
||||
static_assert(MAX_SUB_MATERIALS == 128);
|
||||
#else
|
||||
#define MAX_SUB_MATERIALS 128
|
||||
#endif
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#endif
|
||||
|
||||
#include "CryAssert.h"
|
||||
#include "CompileTimeAssert.h"
|
||||
|
||||
#include <AzCore/IO/SystemFile.h>
|
||||
|
||||
@@ -1416,7 +1415,7 @@ namespace Detail
|
||||
} DummyStaticInstance; \
|
||||
if (!(gEnv->pConsole != 0 ? gEnv->pConsole->Register(&DummyStaticInstance) : 0)) \
|
||||
{ \
|
||||
DEBUG_BREAK; \
|
||||
AZ::Debug::Trace::Break(); \
|
||||
CryFatalError("Can not register dummy CVar"); \
|
||||
} \
|
||||
} while (0)
|
||||
@@ -1425,10 +1424,10 @@ namespace Detail
|
||||
# define DeclareConstIntCVar(name, defaultValue) enum : int { name = (defaultValue) }
|
||||
# define DeclareStaticConstIntCVar(name, defaultValue) enum : int { name = (defaultValue) }
|
||||
|
||||
# define DefineConstIntCVarName(strname, name, defaultValue, flags, help) { COMPILE_TIME_ASSERT((int)(defaultValue) == (int)(name)); REGISTER_DUMMY_CVAR(int, strname, defaultValue); }
|
||||
# define DefineConstIntCVar(name, defaultValue, flags, help) { COMPILE_TIME_ASSERT((int)(defaultValue) == (int)(name)); REGISTER_DUMMY_CVAR(int, (#name), defaultValue); }
|
||||
# define DefineConstIntCVarName(strname, name, defaultValue, flags, help) { static_assert((int)(defaultValue) == (int)(name)); REGISTER_DUMMY_CVAR(int, strname, defaultValue); }
|
||||
# define DefineConstIntCVar(name, defaultValue, flags, help) { static_assert((int)(defaultValue) == (int)(name)); REGISTER_DUMMY_CVAR(int, (#name), defaultValue); }
|
||||
// DefineConstIntCVar2 is deprecated, any such instance can be converted to the 3 variant by removing the quotes around the first parameter
|
||||
# define DefineConstIntCVar3(name, _var_, defaultValue, flags, help) { COMPILE_TIME_ASSERT((int)(defaultValue) == (int)(_var_)); REGISTER_DUMMY_CVAR(int, name, defaultValue); }
|
||||
# define DefineConstIntCVar3(name, _var_, defaultValue, flags, help) { static_assert((int)(defaultValue) == (int)(_var_)); REGISTER_DUMMY_CVAR(int, name, defaultValue); }
|
||||
# define AllocateConstIntCVar(scope, name)
|
||||
|
||||
# define DefineConstFloatCVar(name, flags, help) { REGISTER_DUMMY_CVAR(float, (#name), name ## Default); }
|
||||
@@ -1540,33 +1539,33 @@ static void AssertConsoleExists(void)
|
||||
#define ILLEGAL_DEV_FLAGS (VF_NET_SYNCED | VF_CHEAT | VF_CHEAT_ALWAYS_CHECK | VF_CHEAT_NOCHECK | VF_READONLY | VF_CONST_CVAR)
|
||||
|
||||
#if defined(_RELEASE)
|
||||
#define REGISTER_CVAR_DEV_ONLY(_var, _def_val, _flags, _comment) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0); _var = _def_val
|
||||
#define REGISTER_CVAR_CB_DEV_ONLY(_var, _def_val, _flags, _comment, _onchangefunction) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0); _var = _def_val /* _onchangefunction consumed; callback not available */
|
||||
#define REGISTER_STRING_DEV_ONLY(_name, _def_val, _flags, _comment) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
|
||||
#define REGISTER_STRING_CB_DEV_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
|
||||
#define REGISTER_INT_DEV_ONLY(_name, _def_val, _flags, _comment) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
|
||||
#define REGISTER_INT_CB_DEV_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
|
||||
#define REGISTER_INT64_DEV_ONLY(_name, _def_val, _flags, _comment) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
|
||||
#define REGISTER_FLOAT_DEV_ONLY(_name, _def_val, _flags, _comment) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
|
||||
#define REGISTER_CVAR2_DEV_ONLY(_name, _var, _def_val, _flags, _comment) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0); *(_var) = _def_val
|
||||
#define REGISTER_CVAR2_CB_DEV_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0); *(_var) = _def_val
|
||||
#define REGISTER_CVAR3_DEV_ONLY(_name, _var, _def_val, _flags, _comment) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0); _var = _def_val
|
||||
#define REGISTER_CVAR3_CB_DEV_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0); _var = _def_val
|
||||
#define REGISTER_CVAR_DEV_ONLY(_var, _def_val, _flags, _comment) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0); _var = _def_val
|
||||
#define REGISTER_CVAR_CB_DEV_ONLY(_var, _def_val, _flags, _comment, _onchangefunction) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0); _var = _def_val /* _onchangefunction consumed; callback not available */
|
||||
#define REGISTER_STRING_DEV_ONLY(_name, _def_val, _flags, _comment) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
|
||||
#define REGISTER_STRING_CB_DEV_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
|
||||
#define REGISTER_INT_DEV_ONLY(_name, _def_val, _flags, _comment) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
|
||||
#define REGISTER_INT_CB_DEV_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
|
||||
#define REGISTER_INT64_DEV_ONLY(_name, _def_val, _flags, _comment) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
|
||||
#define REGISTER_FLOAT_DEV_ONLY(_name, _def_val, _flags, _comment) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
|
||||
#define REGISTER_CVAR2_DEV_ONLY(_name, _var, _def_val, _flags, _comment) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0); *(_var) = _def_val
|
||||
#define REGISTER_CVAR2_CB_DEV_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0); *(_var) = _def_val
|
||||
#define REGISTER_CVAR3_DEV_ONLY(_name, _var, _def_val, _flags, _comment) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0); _var = _def_val
|
||||
#define REGISTER_CVAR3_CB_DEV_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0); _var = _def_val
|
||||
#define REGISTER_COMMAND_DEV_ONLY(_name, _func, _flags, _comment) /* consumed; command not available */
|
||||
#else
|
||||
#define REGISTER_CVAR_DEV_ONLY(_var, _def_val, _flags, _comment) REGISTER_CVAR(_var, _def_val, ((_flags) | VF_DEV_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_CVAR_CB_DEV_ONLY(_var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR_CB(_var, _def_val, ((_flags) | VF_DEV_ONLY), _comment, _onchangefunction); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_STRING_DEV_ONLY(_name, _def_val, _flags, _comment) REGISTER_STRING(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_STRING_CB_DEV_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) REGISTER_STRING_CB(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment, _onchangefunction); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_INT_DEV_ONLY(_name, _def_val, _flags, _comment) REGISTER_INT(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_INT_CB_DEV_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) REGISTER_INT_CB(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment, _onchangefunction); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_INT64_DEV_ONLY(_name, _def_val, _flags, _comment) REGISTER_INT64(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_FLOAT_DEV_ONLY(_name, _def_val, _flags, _comment) REGISTER_FLOAT(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_CVAR2_DEV_ONLY(_name, _var, _def_val, _flags, _comment) REGISTER_CVAR2(_name, _var, _def_val, ((_flags) | VF_DEV_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_CVAR2_CB_DEV_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR2_CB(_name, _var, _def_val, ((_flags) | VF_DEV_ONLY), _comment, _onchangefunction); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_CVAR3_DEV_ONLY(_name, _var, _def_val, _flags, _comment) REGISTER_CVAR3(_name, _var, _def_val, ((_flags) | VF_DEV_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_CVAR3_CB_DEV_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR3_CB(_name, _var, _def_val, ((_flags) | VF_DEV_ONLY), _comment, _onchangefunction); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_COMMAND_DEV_ONLY(_name, _func, _flags, _comment) REGISTER_COMMAND(_name, _func, ((_flags) | VF_DEV_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_CVAR_DEV_ONLY(_var, _def_val, _flags, _comment) REGISTER_CVAR(_var, _def_val, ((_flags) | VF_DEV_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_CVAR_CB_DEV_ONLY(_var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR_CB(_var, _def_val, ((_flags) | VF_DEV_ONLY), _comment, _onchangefunction); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_STRING_DEV_ONLY(_name, _def_val, _flags, _comment) REGISTER_STRING(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_STRING_CB_DEV_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) REGISTER_STRING_CB(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment, _onchangefunction); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_INT_DEV_ONLY(_name, _def_val, _flags, _comment) REGISTER_INT(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_INT_CB_DEV_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) REGISTER_INT_CB(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment, _onchangefunction); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_INT64_DEV_ONLY(_name, _def_val, _flags, _comment) REGISTER_INT64(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_FLOAT_DEV_ONLY(_name, _def_val, _flags, _comment) REGISTER_FLOAT(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_CVAR2_DEV_ONLY(_name, _var, _def_val, _flags, _comment) REGISTER_CVAR2(_name, _var, _def_val, ((_flags) | VF_DEV_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_CVAR2_CB_DEV_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR2_CB(_name, _var, _def_val, ((_flags) | VF_DEV_ONLY), _comment, _onchangefunction); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_CVAR3_DEV_ONLY(_name, _var, _def_val, _flags, _comment) REGISTER_CVAR3(_name, _var, _def_val, ((_flags) | VF_DEV_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_CVAR3_CB_DEV_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR3_CB(_name, _var, _def_val, ((_flags) | VF_DEV_ONLY), _comment, _onchangefunction); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_COMMAND_DEV_ONLY(_name, _func, _flags, _comment) REGISTER_COMMAND(_name, _func, ((_flags) | VF_DEV_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#endif // defined(_RELEASE)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -1583,19 +1582,19 @@ static void AssertConsoleExists(void)
|
||||
// TODO Registering all cvars for Dedicated server as well. Currently CrySystems have no concept of Dedicated server with cmake.
|
||||
// If we introduce server specific targets for CrySystems, we can add DEDICATED_SERVER flags to those and add the flag back in here.
|
||||
#if defined(_RELEASE)
|
||||
#define REGISTER_CVAR_DEDI_ONLY(_var, _def_val, _flags, _comment) REGISTER_CVAR(_var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_CVAR_CB_DEDI_ONLY(_var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR_CB(_var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_STRING_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_STRING(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_STRING_CB_DEDI_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) REGISTER_STRING_CB(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_INT_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_INT(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_INT_CB_DEDI_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) REGISTER_INT_CB(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_INT64_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_INT64(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_FLOAT_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_FLOAT(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_CVAR2_DEDI_ONLY(_name, _var, _def_val, _flags, _comment) REGISTER_CVAR2(_name, _var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_CVAR2_CB_DEDI_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR2_CB(_name, _var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_CVAR3_DEDI_ONLY(_name, _var, _def_val, _flags, _comment) REGISTER_CVAR3(_name, _var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_CVAR3_CB_DEDI_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR3_CB(_name, _var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_COMMAND_DEDI_ONLY(_name, _func, _flags, _comment) REGISTER_COMMAND(_name, _func, ((_flags) | VF_DEDI_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_CVAR_DEDI_ONLY(_var, _def_val, _flags, _comment) REGISTER_CVAR(_var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_CVAR_CB_DEDI_ONLY(_var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR_CB(_var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_STRING_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_STRING(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_STRING_CB_DEDI_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) REGISTER_STRING_CB(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_INT_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_INT(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_INT_CB_DEDI_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) REGISTER_INT_CB(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_INT64_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_INT64(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_FLOAT_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_FLOAT(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_CVAR2_DEDI_ONLY(_name, _var, _def_val, _flags, _comment) REGISTER_CVAR2(_name, _var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_CVAR2_CB_DEDI_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR2_CB(_name, _var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_CVAR3_DEDI_ONLY(_name, _var, _def_val, _flags, _comment) REGISTER_CVAR3(_name, _var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_CVAR3_CB_DEDI_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR3_CB(_name, _var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#define REGISTER_COMMAND_DEDI_ONLY(_name, _func, _flags, _comment) REGISTER_COMMAND(_name, _func, ((_flags) | VF_DEDI_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
|
||||
#else
|
||||
#define REGISTER_CVAR_DEDI_ONLY(_var, _def_val, _flags, _comment) REGISTER_CVAR_DEV_ONLY(_var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment)
|
||||
#define REGISTER_CVAR_CB_DEDI_ONLY(_var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR_CB_DEV_ONLY(_var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction)
|
||||
|
||||
@@ -314,8 +314,8 @@ public:
|
||||
|
||||
void GetMemoryUsage([[maybe_unused]] ICrySizer* pSizer) const
|
||||
{
|
||||
COMPILE_TIME_ASSERT(eTT_MaxTexType <= 255);
|
||||
COMPILE_TIME_ASSERT(eTF_MaxFormat <= 255);
|
||||
static_assert(eTT_MaxTexType <= 255);
|
||||
static_assert(eTF_MaxFormat <= 255);
|
||||
/*LATER*/
|
||||
}
|
||||
|
||||
|
||||
@@ -18,11 +18,6 @@
|
||||
#define _CPU_X86
|
||||
//#define _CPU_SSE
|
||||
|
||||
#define DEBUG_BREAK raise(SIGTRAP)
|
||||
#define RC_EXECUTABLE "rc"
|
||||
#define USE_CRT 1
|
||||
#define SIZEOF_PTR 4
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Standard includes.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -98,10 +93,6 @@ typedef unsigned char byte;
|
||||
|
||||
#define DEFINE_ALIGNED_DATA(type, name, alignment) \
|
||||
type __attribute__ ((aligned(alignment))) name;
|
||||
#define DEFINE_ALIGNED_DATA_STATIC(type, name, alignment) \
|
||||
static type __attribute__ ((aligned(alignment))) name;
|
||||
#define DEFINE_ALIGNED_DATA_CONST(type, name, alignment) \
|
||||
const type __attribute__ ((aligned(alignment))) name;
|
||||
|
||||
#include "LinuxSpecific.h"
|
||||
|
||||
|
||||
@@ -20,11 +20,6 @@
|
||||
#define _CPU_AMD64
|
||||
#define _CPU_SSE
|
||||
|
||||
#define DEBUG_BREAK ::raise(SIGTRAP)
|
||||
#define RC_EXECUTABLE "rc"
|
||||
#define USE_CRT 1
|
||||
#define SIZEOF_PTR 8
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Standard includes.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -104,10 +99,6 @@ typedef uint8 byte;
|
||||
|
||||
#define DEFINE_ALIGNED_DATA(type, name, alignment) \
|
||||
type __attribute__ ((aligned(alignment))) name;
|
||||
#define DEFINE_ALIGNED_DATA_STATIC(type, name, alignment) \
|
||||
static type __attribute__ ((aligned(alignment))) name;
|
||||
#define DEFINE_ALIGNED_DATA_CONST(type, name, alignment) \
|
||||
const type __attribute__ ((aligned(alignment))) name;
|
||||
|
||||
#include "LinuxSpecific.h"
|
||||
|
||||
|
||||
@@ -42,23 +42,6 @@
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#ifdef __FUNC__
|
||||
#undef __FUNC__
|
||||
#endif
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#define __FUNC__ __func__
|
||||
#else
|
||||
#define __FUNC__ \
|
||||
({ \
|
||||
static char __f[sizeof(__PRETTY_FUNCTION__) + 1]; \
|
||||
strcpy(__f, __PRETTY_FUNCTION__); \
|
||||
char* __p = (char*)strchr(__f, '('); \
|
||||
*__p = 0; \
|
||||
while (*(__p) != ' ' && __p != (__f - 1)) {--__p; } \
|
||||
(__p + 1); \
|
||||
})
|
||||
#endif
|
||||
|
||||
typedef void* LPVOID;
|
||||
#define VOID void
|
||||
#define PVOID void*
|
||||
@@ -194,7 +177,6 @@ typedef int64 __int64;
|
||||
typedef uint64 __uint64;
|
||||
#endif
|
||||
|
||||
#define THREADID_NULL -1
|
||||
typedef unsigned long int threadID;
|
||||
|
||||
#define TRUE 1
|
||||
@@ -222,14 +204,6 @@ typedef unsigned long int threadID;
|
||||
#define wcsicmp wcscasecmp
|
||||
#define wcsnicmp wcsncasecmp
|
||||
|
||||
|
||||
#define _wtof(str) wcstod(str, 0)
|
||||
|
||||
/*static unsigned char toupper(unsigned char c)
|
||||
{
|
||||
return c & ~0x40;
|
||||
}
|
||||
*/
|
||||
typedef union _LARGE_INTEGER
|
||||
{
|
||||
struct
|
||||
@@ -245,7 +219,6 @@ typedef union _LARGE_INTEGER
|
||||
long long QuadPart;
|
||||
} LARGE_INTEGER;
|
||||
|
||||
|
||||
// stdlib.h stuff
|
||||
#define _MAX_DRIVE 3 // max. length of drive component
|
||||
#define _MAX_DIR 256 // max. length of path component
|
||||
@@ -269,21 +242,6 @@ typedef union _LARGE_INTEGER
|
||||
#define _O_SEQUENTIAL 0x0020 /* file access is primarily sequential */
|
||||
#define _O_RANDOM 0x0010 /* file access is primarily random */
|
||||
|
||||
// curses.h stubs for PDcurses keys
|
||||
#define PADENTER KEY_MAX + 1
|
||||
#define CTL_HOME KEY_MAX + 2
|
||||
#define CTL_END KEY_MAX + 3
|
||||
#define CTL_PGDN KEY_MAX + 4
|
||||
#define CTL_PGUP KEY_MAX + 5
|
||||
|
||||
// stubs for virtual keys, isn't used on Linux
|
||||
#define VK_UP 0
|
||||
#define VK_DOWN 0
|
||||
#define VK_RIGHT 0
|
||||
#define VK_LEFT 0
|
||||
#define VK_CONTROL 0
|
||||
#define VK_SCROLL 0
|
||||
|
||||
enum
|
||||
{
|
||||
IDOK = 1,
|
||||
@@ -297,17 +255,6 @@ enum
|
||||
IDCONTINUE = 11
|
||||
};
|
||||
|
||||
#define ES_MULTILINE 0x0004L
|
||||
#define ES_AUTOVSCROLL 0x0040L
|
||||
#define ES_AUTOHSCROLL 0x0080L
|
||||
#define ES_WANTRETURN 0x1000L
|
||||
|
||||
#define LB_ERR (-1)
|
||||
|
||||
#define LB_ADDSTRING 0x0180
|
||||
#define LB_GETCOUNT 0x018B
|
||||
#define LB_SETTOPINDEX 0x0197
|
||||
|
||||
#define MB_OK 0x00000000L
|
||||
#define MB_OKCANCEL 0x00000001L
|
||||
#define MB_ABORTRETRYIGNORE 0x00000002L
|
||||
@@ -327,22 +274,16 @@ enum
|
||||
|
||||
#define MB_APPLMODAL 0x00000000L
|
||||
|
||||
#define MF_STRING 0x00000000L
|
||||
|
||||
#define MK_LBUTTON 0x0001
|
||||
#define MK_RBUTTON 0x0002
|
||||
#define MK_SHIFT 0x0004
|
||||
#define MK_CONTROL 0x0008
|
||||
#define MK_MBUTTON 0x0010
|
||||
|
||||
#define MK_ALT ( 0x20 )
|
||||
|
||||
#define SM_MOUSEPRESENT 0x00000000L
|
||||
|
||||
#define SM_CMOUSEBUTTONS 43
|
||||
|
||||
#define USER_TIMER_MINIMUM 0x0000000A
|
||||
|
||||
#define VK_TAB 0x09
|
||||
#define VK_SHIFT 0x10
|
||||
#define VK_MENU 0x12
|
||||
@@ -350,11 +291,6 @@ enum
|
||||
#define VK_SPACE 0x20
|
||||
#define VK_DELETE 0x2E
|
||||
|
||||
#define VK_NUMPAD1 0x61
|
||||
#define VK_NUMPAD2 0x62
|
||||
#define VK_NUMPAD3 0x63
|
||||
#define VK_NUMPAD4 0x64
|
||||
|
||||
#define VK_OEM_COMMA 0xBC // ',' any country
|
||||
#define VK_OEM_PERIOD 0xBE // '.' any country
|
||||
#define VK_OEM_3 0xC0 // '`~' for US
|
||||
@@ -541,36 +477,11 @@ inline int64 CryGetTicksPerSec()
|
||||
|
||||
inline int _CrtCheckMemory() { return 1; };
|
||||
|
||||
inline char* _fullpath(char* absPath, const char* relPath, size_t maxLength)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
|
||||
if (realpath(relPath, path) == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
const size_t len = std::min(strlen(path), maxLength - 1);
|
||||
memcpy(absPath, path, len);
|
||||
absPath[len] = 0;
|
||||
return absPath;
|
||||
}
|
||||
|
||||
typedef void* HGLRC;
|
||||
typedef void* HDC;
|
||||
typedef void* PROC;
|
||||
typedef void* PIXELFORMATDESCRIPTOR;
|
||||
|
||||
#define SCOPED_ENABLE_FLOAT_EXCEPTIONS
|
||||
|
||||
// Linux_Win32Wrapper.h now included directly by platform.h
|
||||
//#include "Linux_Win32Wrapper.h"
|
||||
|
||||
#define closesocket close
|
||||
inline int WSAGetLastError()
|
||||
{
|
||||
return errno;
|
||||
}
|
||||
|
||||
template <typename T, size_t N>
|
||||
char (*RtlpNumberOf( T (&)[N] ))[N];
|
||||
|
||||
|
||||
@@ -326,8 +326,6 @@ inline uint32 GetTickCount()
|
||||
#define _strlwr_s(BUF, SIZE) strlwr(BUF)
|
||||
#define _strups strupr
|
||||
|
||||
#define _wtof(str) wcstod(str, 0)
|
||||
|
||||
typedef struct __finddata64_t
|
||||
{
|
||||
//!< atributes set by find request
|
||||
@@ -489,8 +487,6 @@ extern void adaptFilenameToLinux(char* rAdjustedFilename);
|
||||
extern const int comparePathNames(const char* cpFirst, const char* cpSecond, unsigned int len);//returns 0 if identical
|
||||
extern void replaceDoublePathFilename(char* szFileName);//removes "\.\" to "\" and "/./" to "/"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
extern char* _fullpath(char* absPath, const char* relPath, size_t maxLength);
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
extern void _makepath(char* path, const char* drive, const char* dir, const char* filename, const char* ext);
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ void CMTRand_int32::seed(const uint32* array, int size) // init by array
|
||||
}
|
||||
for (int k = n - 1; k; --k)
|
||||
{
|
||||
PREFAST_SUPPRESS_WARNING(6385) PREFAST_SUPPRESS_WARNING(6386) m_nState[i] = (m_nState[i] ^ ((m_nState[i - 1] ^ (m_nState[i - 1] >> 30)) * 1566083941UL)) - i;
|
||||
m_nState[i] = (m_nState[i] ^ ((m_nState[i - 1] ^ (m_nState[i - 1] >> 30)) * 1566083941UL)) - i;
|
||||
if ((++i) == n)
|
||||
{
|
||||
m_nState[0] = m_nState[n - 1];
|
||||
|
||||
@@ -24,40 +24,6 @@
|
||||
#define _CPU_SSE
|
||||
#define PLATFORM_64BIT
|
||||
|
||||
#define USE_CRT 1
|
||||
#define SIZEOF_PTR 8
|
||||
|
||||
typedef uint64_t threadID;
|
||||
|
||||
|
||||
// curses.h stubs for PDcurses keys
|
||||
#define PADENTER KEY_MAX + 1
|
||||
#define CTL_HOME KEY_MAX + 2
|
||||
#define CTL_END KEY_MAX + 3
|
||||
#define CTL_PGDN KEY_MAX + 4
|
||||
#define CTL_PGUP KEY_MAX + 5
|
||||
|
||||
// stubs for virtual keys, isn't used on Mac
|
||||
#define VK_UP 0
|
||||
#define VK_DOWN 0
|
||||
#define VK_RIGHT 0
|
||||
#define VK_LEFT 0
|
||||
#define VK_CONTROL 0
|
||||
#define VK_SCROLL 0
|
||||
|
||||
#define MAC_NOT_IMPLEMENTED assert(false);
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
eDAContinue,
|
||||
eDAIgnore,
|
||||
eDAIgnoreAll,
|
||||
eDABreak,
|
||||
eDAStop,
|
||||
eDAReportAsBug
|
||||
} EDialogAction;
|
||||
|
||||
extern EDialogAction MacOSXHandleAssert(const char* condition, const char* file, int line, const char* reason, bool);
|
||||
|
||||
#endif // CRYINCLUDE_CRYCOMMON_MACSPECIFIC_H
|
||||
|
||||
@@ -80,7 +80,7 @@ private:
|
||||
typedef Struc TThis; typedef Int TInt; \
|
||||
TInt Mask() const { return *(const TInt*)this; } \
|
||||
TInt& Mask() { return *(TInt*)this; } \
|
||||
Struc(TInt init = 0) { COMPILE_TIME_ASSERT(sizeof(TThis) == sizeof(TInt)); Mask() = init; } \
|
||||
Struc(TInt init = 0) { static_assert(sizeof(TThis) == sizeof(TInt)); Mask() = init; } \
|
||||
|
||||
#define BIT_VAR(Var) \
|
||||
TInt _##Var : 1; \
|
||||
|
||||
@@ -16,10 +16,6 @@
|
||||
#include "BaseTypes.h"
|
||||
#include <AzCore/PlatformDef.h>
|
||||
|
||||
#if defined(_RELEASE) && !defined(RELEASE)
|
||||
#define RELEASE
|
||||
#endif
|
||||
|
||||
// Section dictionary
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define PROJECTDEFINES_H_SECTION_STATS_AGENT 1
|
||||
@@ -31,54 +27,48 @@
|
||||
#define AZ_RESTRICTED_SECTION PROJECTDEFINES_H_SECTION_STATS_AGENT
|
||||
#include AZ_RESTRICTED_FILE(ProjectDefines_h)
|
||||
#elif defined(WIN32) || defined(WIN64)
|
||||
#if !defined(_RELEASE) || defined(PERFORMANCE_BUILD)
|
||||
#define ENABLE_STATS_AGENT
|
||||
#endif
|
||||
#if !defined(_RELEASE) || defined(PERFORMANCE_BUILD)
|
||||
#define ENABLE_STATS_AGENT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// The following definitions are used by Sandbox and RC to determine which platform support is needed
|
||||
#define TOOLS_SUPPORT_POWERVR
|
||||
#define TOOLS_SUPPORT_ETC2COMP
|
||||
|
||||
// Type used for vertex indices
|
||||
// WARNING: If you change this typedef, you need to update AssetProcessorPlatformConfig.ini to convert cgf and abc files to the proper index format.
|
||||
#if defined(MOBILE)
|
||||
typedef uint16 vtx_idx;
|
||||
#define AZ_RESTRICTED_SECTION_IMPLEMENTED
|
||||
typedef uint16 vtx_idx;
|
||||
#define AZ_RESTRICTED_SECTION_IMPLEMENTED
|
||||
#elif defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION PROJECTDEFINES_H_SECTION_VTX_IDX
|
||||
#include AZ_RESTRICTED_FILE(ProjectDefines_h)
|
||||
#endif
|
||||
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
|
||||
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
|
||||
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
|
||||
#else
|
||||
// Uncomment one of the two following typedefs:
|
||||
typedef uint32 vtx_idx;
|
||||
//typedef uint16 vtx_idx;
|
||||
// Uncomment one of the two following typedefs:
|
||||
typedef uint32 vtx_idx;
|
||||
//typedef uint16 vtx_idx;
|
||||
#endif
|
||||
|
||||
|
||||
// 0=off, 1=on
|
||||
#define TERRAIN_USE_CIE_COLORSPACE 0
|
||||
|
||||
// When non-zero, const cvar accesses (by name) are logged in release-mode on consoles.
|
||||
// This can be used to find non-optimal usage scenario's, where the constant should be used directly instead.
|
||||
// Since read accesses tend to be used in flow-control logic, constants allow for better optimization by the compiler.
|
||||
#define LOG_CONST_CVAR_ACCESS 0
|
||||
|
||||
#if defined(WIN32) || defined(WIN64) || LOG_CONST_CVAR_ACCESS
|
||||
#define RELEASE_LOGGING
|
||||
#define RELEASE_LOGGING
|
||||
#endif
|
||||
|
||||
#if defined(_RELEASE) && !defined(RELEASE_LOGGING)
|
||||
#define EXCLUDE_NORMAL_LOG
|
||||
#define EXCLUDE_NORMAL_LOG
|
||||
#endif
|
||||
|
||||
// Add the "REMOTE_ASSET_PROCESSOR" define except in release
|
||||
// this makes it so that asset processor functions. Without this, all assets must be present and on local media
|
||||
// with this, the asset processor can be used to remotely process assets.
|
||||
#if !defined(_RELEASE)
|
||||
# define REMOTE_ASSET_PROCESSOR
|
||||
#define REMOTE_ASSET_PROCESSOR
|
||||
#endif
|
||||
|
||||
#if (!defined(_RELEASE) || defined(PERFORMANCE_BUILD))
|
||||
@@ -90,132 +80,68 @@ typedef uint32 vtx_idx;
|
||||
#define AZ_RESTRICTED_SECTION PROJECTDEFINES_H_SECTION_TRAITS
|
||||
#include AZ_RESTRICTED_FILE(ProjectDefines_h)
|
||||
#else
|
||||
#define PROJECTDEFINES_H_TRAIT_DISABLE_MONOLITHIC_PROFILING_MARKERS 1
|
||||
#if !defined(LINUX) && !defined(APPLE)
|
||||
#define PROJECTDEFINES_H_TRAIT_ENABLE_SOFTCODE_SYSTEM 1
|
||||
#endif
|
||||
#if defined(WIN32) || defined(WIN64) || defined(LINUX) || defined(APPLE)
|
||||
#define PROJECTDEFINES_H_TRAIT_USE_GPU_PARTICLES 1
|
||||
#endif
|
||||
#define PROJECTDEFINES_H_TRAIT_USE_MESH_TESSELLATION 1
|
||||
#if defined(WIN32)
|
||||
#define PROJECTDEFINES_H_TRAIT_USE_SVO_GI 1
|
||||
#endif
|
||||
#if defined(APPLE) || defined(LINUX)
|
||||
#define AZ_LEGACY_CRYCOMMON_TRAIT_USE_PTHREADS 1
|
||||
#define AZ_LEGACY_CRYCOMMON_TRAIT_USE_UNIX_PATHS 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define USE_GLOBAL_BUCKET_ALLOCATOR
|
||||
|
||||
#ifdef IS_PROSDK
|
||||
# define USING_TAGES_SECURITY // Wrapper for TGVM security
|
||||
# if defined(LINUX) || defined(APPLE)
|
||||
# error LINUX and Mac does not support evaluation version
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef USING_TAGES_SECURITY
|
||||
# define TAGES_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
# define TAGES_EXPORT
|
||||
#endif // USING_TAGES_SECURITY
|
||||
// test -------------------------------------
|
||||
|
||||
#define _DATAPROBE
|
||||
|
||||
|
||||
|
||||
//This feature allows automatic crash submission to JIRA, but does not work outside of O3DE
|
||||
//Note: This #define will be commented out during code export
|
||||
#define ENABLE_CRASH_HANDLER
|
||||
|
||||
#if !defined(PHYSICS_STACK_SIZE)
|
||||
# define PHYSICS_STACK_SIZE (128U << 10)
|
||||
#define PROJECTDEFINES_H_TRAIT_DISABLE_MONOLITHIC_PROFILING_MARKERS 1
|
||||
#if !defined(LINUX) && !defined(APPLE)
|
||||
#define PROJECTDEFINES_H_TRAIT_ENABLE_SOFTCODE_SYSTEM 1
|
||||
#endif
|
||||
#if defined(WIN32) || defined(WIN64) || defined(LINUX) || defined(APPLE)
|
||||
#define PROJECTDEFINES_H_TRAIT_USE_GPU_PARTICLES 1
|
||||
#endif
|
||||
#define PROJECTDEFINES_H_TRAIT_USE_MESH_TESSELLATION 1
|
||||
#if defined(WIN32)
|
||||
#define PROJECTDEFINES_H_TRAIT_USE_SVO_GI 1
|
||||
#endif
|
||||
#if defined(APPLE) || defined(LINUX)
|
||||
#define AZ_LEGACY_CRYCOMMON_TRAIT_USE_PTHREADS 1
|
||||
#define AZ_LEGACY_CRYCOMMON_TRAIT_USE_UNIX_PATHS 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (!defined(_RELEASE) || defined(PERFORMANCE_BUILD))
|
||||
#ifndef ENABLE_PROFILING_CODE
|
||||
#define ENABLE_PROFILING_CODE
|
||||
#endif
|
||||
#if !(defined(SANDBOX_EXPORTS) || defined(PLUGIN_EXPORTS) || (defined(AZ_MONOLITHIC_BUILD) && PROJECTDEFINES_H_TRAIT_DISABLE_MONOLITHIC_PROFILING_MARKERS))
|
||||
#define ENABLE_PROFILING_MARKERS
|
||||
#endif
|
||||
#ifndef ENABLE_PROFILING_CODE
|
||||
#define ENABLE_PROFILING_CODE
|
||||
#endif
|
||||
|
||||
//lightweight profilers, disable for submissions, disables displayinfo inside 3dengine as well
|
||||
#ifndef ENABLE_LW_PROFILERS
|
||||
#define ENABLE_LW_PROFILERS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_PROFILING_CODE)
|
||||
#define ENABLE_ART_RT_TIME_ESTIMATE
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_PROFILING_CODE) && !defined(_RELEASE)
|
||||
#define FMOD_STREAMING_DEBUGGING 1
|
||||
#endif
|
||||
|
||||
#if defined(WIN32) || defined(WIN64) || defined(APPLE) || defined(AZ_PLATFORM_LINUX)
|
||||
#define FLARES_SUPPORT_EDITING
|
||||
//lightweight profilers, disable for submissions, disables displayinfo inside 3dengine as well
|
||||
#ifndef ENABLE_LW_PROFILERS
|
||||
#define ENABLE_LW_PROFILERS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Reflect texture slot information - only used in the editor
|
||||
#if defined(WIN32) || defined(WIN64) || defined(AZ_PLATFORM_MAC)
|
||||
#define SHADER_REFLECT_TEXTURE_SLOTS 1
|
||||
#define SHADER_REFLECT_TEXTURE_SLOTS 1
|
||||
#else
|
||||
#define SHADER_REFLECT_TEXTURE_SLOTS 0
|
||||
#define SHADER_REFLECT_TEXTURE_SLOTS 0
|
||||
#endif
|
||||
|
||||
// these enable and disable certain net features to give compatibility between PCs and consoles / profile and performance builds
|
||||
#define PC_CONSOLE_NET_COMPATIBLE 0
|
||||
#define PROFILE_PERFORMANCE_NET_COMPATIBLE 0
|
||||
|
||||
#if (!defined(_RELEASE) || defined(PERFORMANCE_BUILD)) && !PROFILE_PERFORMANCE_NET_COMPATIBLE
|
||||
#define USE_LAGOMETER (1)
|
||||
#else
|
||||
#define USE_LAGOMETER (0)
|
||||
#endif
|
||||
|
||||
// enable this in order to support old style material names in old data ("engine/material.mtl" or "mygame/material.mtl" as opposed to just "material.mtl")
|
||||
// previously, material names could have the game folder in it, but this is not necessary anymore and would not work with things like gems
|
||||
// note that if you use any older projects such as GameSDK this should remain enabled
|
||||
#define SUPPORT_LEGACY_MATERIAL_NAMES
|
||||
|
||||
// Enable additional structures and code for sprite motion blur. Currently non-functional and disabled
|
||||
// #define PARTICLE_MOTION_BLUR
|
||||
|
||||
// a special ticker thread to run during load and unload of levels
|
||||
#define USE_NETWORK_STALL_TICKER_THREAD
|
||||
|
||||
#if !defined(MOBILE)
|
||||
//---------------------------------------------------------------------
|
||||
// Enable Tessellation Features
|
||||
// (displacement mapping, subdivision, water tessellation)
|
||||
//---------------------------------------------------------------------
|
||||
// Modules : 3DEngine, Renderer
|
||||
// Depends on: DX11
|
||||
//---------------------------------------------------------------------
|
||||
// Enable Tessellation Features
|
||||
// (displacement mapping, subdivision, water tessellation)
|
||||
//---------------------------------------------------------------------
|
||||
// Modules : 3DEngine, Renderer
|
||||
// Depends on: DX11
|
||||
|
||||
// Global tessellation feature flag
|
||||
// Global tessellation feature flag
|
||||
#define TESSELLATION
|
||||
#ifdef TESSELLATION
|
||||
// Specific features flags
|
||||
// Specific features flags
|
||||
#define WATER_TESSELLATION
|
||||
#define PARTICLES_TESSELLATION
|
||||
|
||||
#if PROJECTDEFINES_H_TRAIT_USE_MESH_TESSELLATION
|
||||
// Mesh tessellation (displacement, smoothing, subd)
|
||||
// Mesh tessellation (displacement, smoothing, subd)
|
||||
#define MESH_TESSELLATION
|
||||
// Mesh tessellation also in motion blur passes
|
||||
// Mesh tessellation also in motion blur passes
|
||||
#define MOTIONBLUR_TESSELLATION
|
||||
#endif
|
||||
|
||||
// Dependencies
|
||||
// Dependencies
|
||||
#ifdef MESH_TESSELLATION
|
||||
#define MESH_TESSELLATION_ENGINE
|
||||
#endif
|
||||
#ifndef NULL_RENDERER
|
||||
#ifndef NULL_RENDERER
|
||||
#ifdef WATER_TESSELLATION
|
||||
#define WATER_TESSELLATION_RENDERER
|
||||
#endif
|
||||
@@ -227,7 +153,7 @@ typedef uint32 vtx_idx;
|
||||
#endif
|
||||
|
||||
#if defined(WATER_TESSELLATION_RENDERER) || defined(PARTICLES_TESSELLATION_RENDERER) || defined(MESH_TESSELLATION_RENDERER)
|
||||
// Common tessellation flag enabling tessellation stages in renderer
|
||||
// Common tessellation flag enabling tessellation stages in renderer
|
||||
#define TESSELLATION_RENDERER
|
||||
#endif
|
||||
#endif // !NULL_RENDERER
|
||||
@@ -246,14 +172,8 @@ typedef uint32 vtx_idx;
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_PROFILING_CODE)
|
||||
# define USE_DISK_PROFILER
|
||||
# define ENABLE_LOADING_PROFILER // requires AZ_PROFILE_TELEMETRY to also be defined
|
||||
#endif
|
||||
|
||||
#if PROJECTDEFINES_H_TRAIT_USE_GPU_PARTICLES && !defined(NULL_RENDERER)
|
||||
#define GPU_PARTICLES 1
|
||||
#else
|
||||
#define GPU_PARTICLES 0
|
||||
#define USE_DISK_PROFILER
|
||||
#define ENABLE_LOADING_PROFILER // requires AZ_PROFILE_TELEMETRY to also be defined
|
||||
#endif
|
||||
|
||||
// The maximum number of joints in an animation
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#define CRYINCLUDE_CRYCOMMON_VECTORMAP_H
|
||||
#pragma once
|
||||
|
||||
#include <CryCommon/StlUtils.h>
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// VectorMap
|
||||
|
||||
@@ -23,11 +23,7 @@
|
||||
#define ILINE __forceinline
|
||||
#endif
|
||||
|
||||
#define DEBUG_BREAK _asm { int 3 }
|
||||
#define RC_EXECUTABLE "rc.exe"
|
||||
#define DEPRECATED __declspec(deprecated)
|
||||
#define TYPENAME(x) typeid(x).name()
|
||||
#define SIZEOF_PTR 4
|
||||
|
||||
#ifndef _WIN32_WINNT
|
||||
# define _WIN32_WINNT 0x501
|
||||
@@ -55,8 +51,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#include "BaseTypes.h"
|
||||
|
||||
#define THREADID_NULL -1
|
||||
|
||||
typedef unsigned char BYTE;
|
||||
typedef unsigned int threadID;
|
||||
typedef unsigned long DWORD;
|
||||
@@ -112,14 +106,11 @@ int64 CryGetTicksPerSec();
|
||||
__declspec(align(num))
|
||||
|
||||
#define DEFINE_ALIGNED_DATA(type, name, alignment) _declspec(align(alignment)) type name;
|
||||
#define DEFINE_ALIGNED_DATA_STATIC(type, name, alignment) static _declspec(align(alignment)) type name;
|
||||
#define DEFINE_ALIGNED_DATA_CONST(type, name, alignment) const _declspec(align(alignment)) type name;
|
||||
|
||||
#ifndef FILE_ATTRIBUTE_NORMAL
|
||||
#define FILE_ATTRIBUTE_NORMAL 0x00000080
|
||||
#endif
|
||||
|
||||
#define FP16_TERRAIN
|
||||
#define TARGET_DEFAULT_ALIGN (0x4U)
|
||||
|
||||
|
||||
|
||||
@@ -19,11 +19,7 @@
|
||||
#define _CPU_SSE
|
||||
#define ILINE __forceinline
|
||||
|
||||
#define DEBUG_BREAK CryDebugBreak()
|
||||
#define RC_EXECUTABLE "rc.exe"
|
||||
#define DEPRECATED __declspec(deprecated)
|
||||
#define TYPENAME(x) typeid(x).name()
|
||||
#define SIZEOF_PTR 8
|
||||
|
||||
#ifndef _WIN32_WINNT
|
||||
# define _WIN32_WINNT 0x501
|
||||
@@ -52,7 +48,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#include "BaseTypes.h"
|
||||
|
||||
#define THREADID_NULL -1
|
||||
typedef long LONG;
|
||||
typedef unsigned char BYTE;
|
||||
typedef unsigned long threadID;
|
||||
@@ -94,10 +89,6 @@ int64 CryGetTicksPerSec();
|
||||
__declspec(align(num))
|
||||
|
||||
#define DEFINE_ALIGNED_DATA(type, name, alignment) _declspec(align(alignment)) type name;
|
||||
#define DEFINE_ALIGNED_DATA_STATIC(type, name, alignment) static _declspec(align(alignment)) type name;
|
||||
#define DEFINE_ALIGNED_DATA_CONST(type, name, alignment) const _declspec(align(alignment)) type name;
|
||||
|
||||
#define SIZEOF_PTR 8
|
||||
|
||||
#ifndef FILE_ATTRIBUTE_NORMAL
|
||||
#define FILE_ATTRIBUTE_NORMAL 0x00000080
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "platform.h" // Note: This should be first to get consistent debugging definitions
|
||||
|
||||
#include <CryCommon/ISystem.h>
|
||||
#include <CryAssert.h>
|
||||
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
@@ -29,7 +30,7 @@
|
||||
#include AZ_RESTRICTED_FILE(WinBase_cpp)
|
||||
#endif
|
||||
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
|
||||
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
|
||||
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
|
||||
#else
|
||||
#include <signal.h>
|
||||
#endif
|
||||
@@ -1126,20 +1127,6 @@ void CrySleep(unsigned int dwMilliseconds)
|
||||
Sleep(dwMilliseconds);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CryLowLatencySleep(unsigned int dwMilliseconds)
|
||||
{
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION WINBASE_CPP_SECTION_6
|
||||
#include AZ_RESTRICTED_FILE(WinBase_cpp)
|
||||
#endif
|
||||
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
|
||||
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
|
||||
#else
|
||||
CrySleep(dwMilliseconds);
|
||||
#endif
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CryMessageBox(const char* lpText, const char* lpCaption, unsigned int uType)
|
||||
@@ -1283,14 +1270,6 @@ int CryMessageBox(const char* lpText, const char* lpCaption, unsigned int uType)
|
||||
#endif
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
short CryGetAsyncKeyState(int vKey)
|
||||
{
|
||||
//TODO: implement
|
||||
CRY_ASSERT_MESSAGE(0, "CryGetAsyncKeyState not implemented yet");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(LINUX) || defined(APPLE) || defined(DEFINE_CRY_INTERLOCKED_INCREMENT)
|
||||
//[K01]: http://www.memoryhole.net/kyle/2007/05/atomic_incrementing.html
|
||||
//http://forums.devx.com/archive/index.php/t-160558.html
|
||||
@@ -1381,10 +1360,6 @@ threadID CryGetCurrentThreadId()
|
||||
return GetCurrentThreadId();
|
||||
}
|
||||
|
||||
void CryDebugBreak()
|
||||
{
|
||||
__builtin_trap();
|
||||
}
|
||||
#endif//LINUX APPLE
|
||||
|
||||
#if defined(APPLE) || defined(LINUX)
|
||||
@@ -1397,11 +1372,6 @@ DLL_EXPORT void OutputDebugString(const char* outputString)
|
||||
#endif
|
||||
}
|
||||
|
||||
DLL_EXPORT void DebugBreak()
|
||||
{
|
||||
CryDebugBreak();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// This code does not have a long life span and will be replaced soon
|
||||
@@ -1627,37 +1597,6 @@ DWORD GetFileAttributes(LPCWSTR lpFileNameW)
|
||||
return (ret == 0) ? FILE_ATTRIBUTE_NORMAL : ret;//return file attribute normal as the default value, must only be set if no other attributes have been found
|
||||
}
|
||||
|
||||
uint32 CryGetFileAttributes(const char* lpFileName)
|
||||
{
|
||||
AZStd::string fn = lpFileName;
|
||||
adaptFilenameToLinux(fn);
|
||||
const char* buffer = fn.c_str();
|
||||
|
||||
struct stat fileStats;
|
||||
const int success = stat(buffer, &fileStats);
|
||||
if (success == -1)
|
||||
{
|
||||
char adjustedFilename[MAX_PATH];
|
||||
GetFilenameNoCase(buffer, adjustedFilename);
|
||||
if (stat(adjustedFilename, &fileStats) == -1)
|
||||
{
|
||||
return (DWORD)INVALID_FILE_ATTRIBUTES;
|
||||
}
|
||||
}
|
||||
DWORD ret = 0;
|
||||
|
||||
const int acc = (fileStats.st_mode & S_IWRITE);
|
||||
|
||||
if (acc != 0)
|
||||
{
|
||||
if (S_ISDIR(fileStats.st_mode) != 0)
|
||||
{
|
||||
ret |= FILE_ATTRIBUTE_DIRECTORY;
|
||||
}
|
||||
}
|
||||
return (ret == 0) ? FILE_ATTRIBUTE_NORMAL : ret;//return file attribute normal as the default value, must only be set if no other attributes have been found
|
||||
}
|
||||
|
||||
__finddata64_t::~__finddata64_t()
|
||||
{
|
||||
if (m_Dir != FS_DIR_NULL)
|
||||
|
||||
@@ -68,7 +68,6 @@ set(FILES
|
||||
LCGRandom.h
|
||||
CryTypeInfo.cpp
|
||||
BaseTypes.h
|
||||
CompileTimeAssert.h
|
||||
MemoryAccess.h
|
||||
AnimKey.h
|
||||
BitFiddling.h
|
||||
@@ -158,7 +157,6 @@ set(FILES
|
||||
CryThread_windows.h
|
||||
CryThreadImpl_pthreads.h
|
||||
CryThreadImpl_windows.h
|
||||
CryWindows.h
|
||||
Linux32Specific.h
|
||||
Linux64Specific.h
|
||||
Linux_Win32Wrapper.h
|
||||
|
||||
@@ -47,11 +47,9 @@
|
||||
#define VK_SCROLL 0
|
||||
|
||||
|
||||
//#define USE_CRT 1
|
||||
#if !defined(PLATFORM_64BIT)
|
||||
#error "IOS build only supports the 64bit architecture"
|
||||
#else
|
||||
#define SIZEOF_PTR 8
|
||||
typedef uint64_t threadID;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -7,22 +7,18 @@
|
||||
*/
|
||||
|
||||
|
||||
// Description : Platform dependend stuff.
|
||||
// Description : Platform dependent stuff.
|
||||
// Include this file instead of windows h
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#undef AZ_RESTRICTED_SECTION
|
||||
#define PLATFORM_H_SECTION_1 1
|
||||
#define PLATFORM_H_SECTION_2 2
|
||||
#define PLATFORM_H_SECTION_3 3
|
||||
#define PLATFORM_H_SECTION_4 4
|
||||
#define PLATFORM_H_SECTION_5 5
|
||||
#define PLATFORM_H_SECTION_6 6
|
||||
#define PLATFORM_H_SECTION_7 7
|
||||
#define PLATFORM_H_SECTION_8 8
|
||||
#define PLATFORM_H_SECTION_9 9
|
||||
#define PLATFORM_H_SECTION_10 10
|
||||
#define PLATFORM_H_SECTION_11 11
|
||||
#define PLATFORM_H_SECTION_12 12
|
||||
@@ -31,112 +27,12 @@
|
||||
#define PLATFORM_H_SECTION_15 15
|
||||
#endif
|
||||
|
||||
// certain C++ features are not available in some compiler versions
|
||||
// turn them off here:
|
||||
// #define _ALLOW_KEYWORD_MACROS
|
||||
// #define _DISALLOW_INITIALIZER_LISTS
|
||||
// #define _DISALLOW_ENUM_CLASS
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define _ALLOW_KEYWORD_MACROS
|
||||
|
||||
#define alignof _alignof
|
||||
#if !defined(_HAS_EXCEPTIONS)
|
||||
#define _HAS_EXCEPTIONS 0
|
||||
#endif
|
||||
#elif defined(__GNUC__)
|
||||
#define alignof __alignof__
|
||||
#endif
|
||||
|
||||
// Alignment|InitializerList support.
|
||||
#define _ALLOW_INITIALIZER_LISTS
|
||||
|
||||
#if (defined(LINUX) && !defined(ANDROID)) || defined(APPLE)
|
||||
#define _FILE_OFFSET_BITS 64 // define large file support > 2GB
|
||||
#define _FILE_OFFSET_BITS 64 // define large file support > 2GB
|
||||
#endif
|
||||
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#if defined(_MSC_VER) // We want the class name to be included, but __FUNCTION__ doesn't contain that on GCC/clang
|
||||
#define __FUNC__ __FUNCTION__
|
||||
#else
|
||||
#define __FUNC__ __PRETTY_FUNCTION__
|
||||
#endif
|
||||
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_1
|
||||
#include AZ_RESTRICTED_FILE(platform_h)
|
||||
#endif
|
||||
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
|
||||
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
|
||||
#elif defined(_DEBUG) && !defined(LINUX) && !defined(APPLE)
|
||||
#include <crtdbg.h>
|
||||
#endif
|
||||
|
||||
#define RESTRICT_POINTER __restrict
|
||||
|
||||
// we have to use it because of VS doesn't support restrict reference variables
|
||||
#if defined(APPLE) || defined(LINUX)
|
||||
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)
|
||||
#define GCC411_OR_LATER
|
||||
#endif
|
||||
#define RESTRICT_REFERENCE __restrict
|
||||
#else
|
||||
#define RESTRICT_REFERENCE
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef CHECK_REFERENCE_COUNTS //define that in your StdAfx.h to override per-project
|
||||
# define CHECK_REFERENCE_COUNTS 0 //default value
|
||||
#endif
|
||||
|
||||
#if CHECK_REFERENCE_COUNTS
|
||||
# define CHECK_REFCOUNT_CRASH(x) { if (!(x)) {*((int*)0) = 0; } \
|
||||
}
|
||||
#else
|
||||
# define CHECK_REFCOUNT_CRASH(x)
|
||||
#endif
|
||||
|
||||
#ifndef GARBAGE_MEMORY_ON_FREE //define that in your StdAfx.h to override per-project
|
||||
# define GARBAGE_MEMORY_ON_FREE 0 //default value
|
||||
#endif
|
||||
|
||||
#if GARBAGE_MEMORY_ON_FREE
|
||||
# ifndef GARBAGE_MEMORY_RANDOM //define that in your StdAfx.h to override per-project
|
||||
# define GARBAGE_MEMORY_RANDOM 1 //0 to change it to progressive pattern
|
||||
# endif
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Available predefined compiler macros for Visual C++.
|
||||
// _MSC_VER // Indicates MS Visual C compiler version
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_2
|
||||
#include AZ_RESTRICTED_FILE(platform_h)
|
||||
#endif
|
||||
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
|
||||
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
|
||||
#else
|
||||
// _WIN32, _WIN64 // Indicates target OS
|
||||
#endif
|
||||
// _M_IX86, _M_PPC // Indicates target processor
|
||||
// _DEBUG // Building in Debug mode
|
||||
// _DLL // Linking with DLL runtime libs
|
||||
// _MT // Linking with multi-threaded runtime libs
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// Translate some predefined macros.
|
||||
//
|
||||
|
||||
// NDEBUG disables std asserts, etc.
|
||||
// Define it automatically if not compiling with Debug libs, or with ADEBUG flag.
|
||||
#if !defined(_DEBUG) && !defined(ADEBUG) && !defined(NDEBUG)
|
||||
#define NDEBUG
|
||||
#endif
|
||||
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_3
|
||||
#include AZ_RESTRICTED_FILE(platform_h)
|
||||
@@ -147,44 +43,6 @@
|
||||
#define CONSOLE
|
||||
#endif
|
||||
|
||||
//render thread settings, as this is accessed inside 3dengine and renderer and needs to be compile time defined, we need to do it here
|
||||
//enable this macro to strip out the overhead for render thread
|
||||
// #define STRIP_RENDER_THREAD
|
||||
#ifdef STRIP_RENDER_THREAD
|
||||
#define RT_COMMAND_BUF_COUNT 1
|
||||
#else
|
||||
//can be enhanced to triple buffering, FlushFrame needs to be adjusted and RenderObj would become 132 bytes
|
||||
#define RT_COMMAND_BUF_COUNT 2
|
||||
#endif
|
||||
|
||||
|
||||
// We use WIN macros without _.
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_4
|
||||
#include AZ_RESTRICTED_FILE(platform_h)
|
||||
#endif
|
||||
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
|
||||
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
|
||||
#else
|
||||
#if defined(_WIN32) && !defined(LINUX32) && !defined(LINUX64) && !defined(APPLE) && !defined(WIN32)
|
||||
#define WIN32
|
||||
#endif
|
||||
#if defined(_WIN64) && !defined(WIN64)
|
||||
#define WIN64
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// In Win32 Release we use static linkage
|
||||
#ifdef WIN32
|
||||
#if !defined(_RELEASE) || defined(EDITOR) || defined(_FORCEDLL)
|
||||
// All windows targets not in Release built as DLLs.
|
||||
#ifndef _USRDLL
|
||||
#define _USRDLL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif //WIN32
|
||||
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_5
|
||||
#include AZ_RESTRICTED_FILE(platform_h)
|
||||
@@ -205,19 +63,17 @@
|
||||
#define PRId64 "lld"
|
||||
#define PRIu64 "llu"
|
||||
#endif
|
||||
#define PLATFORM_I64(x) x##ll
|
||||
#else
|
||||
#include <inttypes.h>
|
||||
#define PLATFORM_I64(x) x##i64
|
||||
#endif
|
||||
|
||||
#if !defined(PRISIZE_T)
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_6
|
||||
#include AZ_RESTRICTED_FILE(platform_h)
|
||||
#endif
|
||||
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
|
||||
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_6
|
||||
#include AZ_RESTRICTED_FILE(platform_h)
|
||||
#endif
|
||||
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
|
||||
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
|
||||
#elif defined(WIN64)
|
||||
#define PRISIZE_T "I64u" //size_t defined as unsigned __int64
|
||||
#elif defined(WIN32) || defined(LINUX32)
|
||||
@@ -228,13 +84,14 @@
|
||||
#error "Please defined PRISIZE_T for this platform"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(PRI_THREADID)
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_7
|
||||
#include AZ_RESTRICTED_FILE(platform_h)
|
||||
#endif
|
||||
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
|
||||
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_7
|
||||
#include AZ_RESTRICTED_FILE(platform_h)
|
||||
#endif
|
||||
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
|
||||
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
|
||||
#elif defined(MAC) || defined(IOS) && defined(__LP64__) && defined(__LP64__)
|
||||
#define PRI_THREADID "lld"
|
||||
#elif defined(LINUX64) || defined(ANDROID)
|
||||
@@ -243,6 +100,7 @@
|
||||
#define PRI_THREADID "d"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "ProjectDefines.h" // to get some defines available in every CryEngine project
|
||||
|
||||
// Function attribute for printf/scanf-style parameters.
|
||||
@@ -277,47 +135,6 @@
|
||||
#define PRINTF_EMPTY_FORMAT ""
|
||||
#endif
|
||||
|
||||
#if defined(IOS)
|
||||
#define USE_PTHREAD_TLS
|
||||
#endif
|
||||
|
||||
// Storage class modifier for thread local storage.
|
||||
// THEADLOCAL should NOT be defined to empty because that creates some
|
||||
// really hard to find issues.
|
||||
#if !defined(USE_PTHREAD_TLS)
|
||||
# define THREADLOCAL AZ_TRAIT_COMPILER_THREAD_LOCAL
|
||||
#endif //!defined(USE_PTHREAD_TLS)
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// define Read Write Barrier macro needed for lockless programming
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#if defined(__arm__)
|
||||
/**
|
||||
* (ARMv7) Full memory barriar.
|
||||
*
|
||||
* None of GCC 4.6/4.8 or clang 3.3/3.4 have a builtin intrinsic for ARM's ldrex/strex or dmb
|
||||
* instructions. This is a placeholder until supplied by the toolchain.
|
||||
*/
|
||||
inline void __dmb()
|
||||
{
|
||||
// The linux kernel uses "dmb ish" to only sync with local monitor (arch/arm/include/asm/barrier.h):
|
||||
//#define dmb(option) __asm__ __volatile__ ("dmb " #option : : : "memory")
|
||||
//#define smp_mb() dmb(ish)
|
||||
__asm__ __volatile__ ("dmb ish" : : : "memory");
|
||||
}
|
||||
|
||||
#define READ_WRITE_BARRIER {__dmb(); }
|
||||
#else
|
||||
#define READ_WRITE_BARRIER
|
||||
#endif
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// define macro to prevent memory reoderings of reads/and writes
|
||||
//TODO implement for all GCC platforms, else there are potential crashes with strict aliasing
|
||||
#define MEMORY_RW_REORDERING_BARRIER do { /*not implemented*/} while (0)
|
||||
|
||||
//default stack size for threads, currently only used on pthread platforms
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
@@ -325,7 +142,7 @@ inline void __dmb()
|
||||
#include AZ_RESTRICTED_FILE(platform_h)
|
||||
#endif
|
||||
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
|
||||
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
|
||||
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
|
||||
#elif defined(LINUX) || defined(APPLE)
|
||||
#if !defined(_DEBUG)
|
||||
#define SIMPLE_THREAD_STACK_SIZE_KB (256)
|
||||
@@ -362,22 +179,6 @@ inline void __dmb()
|
||||
#else
|
||||
#define _HELP(x) ""
|
||||
#endif
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Globally Used Defines.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// CPU Types: _CPU_X86,_CPU_AMD64,_CPU_G5
|
||||
// Platform: WIN23,WIN64,LINUX32,LINUX64,MAC
|
||||
// CPU supported functionality: _CPU_SSE
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define PREFAST_SUPPRESS_WARNING(W) __pragma(warning(suppress: W))
|
||||
#else
|
||||
#define PREFAST_SUPPRESS_WARNING(W)
|
||||
#endif
|
||||
|
||||
#ifdef _PREFAST_
|
||||
# define PREFAST_ASSUME(cond) __analysis_assume(cond)
|
||||
@@ -385,47 +186,21 @@ inline void __dmb()
|
||||
# define PREFAST_ASSUME(cond)
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_9
|
||||
#include AZ_RESTRICTED_FILE(platform_h)
|
||||
#endif
|
||||
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
|
||||
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
|
||||
#else
|
||||
#if defined(WIN32) && !defined(WIN64)
|
||||
#include "Win32specific.h"
|
||||
#endif
|
||||
|
||||
#if defined(WIN64)
|
||||
#include "Win64specific.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LINUX64) && !defined(ANDROID)
|
||||
#include "Linux64Specific.h"
|
||||
#endif
|
||||
|
||||
#if defined(LINUX32) && !defined(ANDROID)
|
||||
#include "Linux32Specific.h"
|
||||
#endif
|
||||
|
||||
#if defined(ANDROID)
|
||||
#include "AndroidSpecific.h"
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_10
|
||||
#include AZ_RESTRICTED_FILE(platform_h)
|
||||
#endif
|
||||
|
||||
#if defined(MAC)
|
||||
#include "MacSpecific.h"
|
||||
#endif
|
||||
|
||||
#if defined(IOS)
|
||||
#include "iOSSpecific.h"
|
||||
#else
|
||||
#if defined(WIN64)
|
||||
#include "Win64specific.h"
|
||||
#elif defined(LINUX64) && !defined(ANDROID)
|
||||
#include "Linux64Specific.h"
|
||||
#elif defined(MAC)
|
||||
#include "MacSpecific.h"
|
||||
#elif defined(ANDROID)
|
||||
#include "AndroidSpecific.h"
|
||||
#elif defined(IOS)
|
||||
#include "iOSSpecific.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -480,12 +255,6 @@ ILINE DestinationType alias_cast(SourceType pPtr)
|
||||
#define DEPRECATED
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// compile time error stuff
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#undef STATIC_CHECK
|
||||
#define STATIC_CHECK(expr, msg) static_assert(expr, #msg)
|
||||
|
||||
// Assert dialog box macros
|
||||
#include "CryAssert.h"
|
||||
|
||||
@@ -495,35 +264,12 @@ ILINE DestinationType alias_cast(SourceType pPtr)
|
||||
#define assert CRY_ASSERT
|
||||
#endif
|
||||
|
||||
#include "CompileTimeAssert.h"
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Platform dependent functions that emulate Win32 API.
|
||||
// Mostly used only for debugging!
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CryDebugBreak();
|
||||
void CrySleep(unsigned int dwMilliseconds);
|
||||
void CryLowLatencySleep(unsigned int dwMilliseconds);
|
||||
int CryMessageBox(const char* lpText, const char* lpCaption, unsigned int uType);
|
||||
short CryGetAsyncKeyState(int vKey);
|
||||
unsigned int CryGetFileAttributes(const char* lpFileName);
|
||||
|
||||
inline void CryHeapCheck()
|
||||
{
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_11
|
||||
#include AZ_RESTRICTED_FILE(platform_h)
|
||||
#elif !defined(LINUX) && !defined(APPLE) // todo: this might be readded with later xdks?
|
||||
#if !defined(NDEBUG)
|
||||
int Result =
|
||||
#endif
|
||||
_heapchk();
|
||||
assert(Result != _HEAPBADBEGIN);
|
||||
assert(Result != _HEAPBADNODE);
|
||||
assert(Result != _HEAPBADPTR);
|
||||
assert(Result != _HEAPEMPTY);
|
||||
assert(Result == _HEAPOK);
|
||||
#endif
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Useful function to clean the structure.
|
||||
@@ -554,77 +300,6 @@ inline D check_cast(S const& s)
|
||||
return d;
|
||||
}
|
||||
|
||||
// Convert one type to another, asserting there is no conversion loss.
|
||||
// Usage: DestType dest; check_convert(dest, src);
|
||||
template<class D, class S>
|
||||
inline D& check_convert(D& d, S const& s)
|
||||
{
|
||||
d = D(s);
|
||||
assert(S(d) == s);
|
||||
return d;
|
||||
}
|
||||
|
||||
// Convert one type to another, asserting there is no conversion loss.
|
||||
// Usage: DestType dest; check_convert(dest) = src;
|
||||
template<class D>
|
||||
struct CheckConvert
|
||||
{
|
||||
CheckConvert(D& d)
|
||||
: dest(&d) {}
|
||||
|
||||
template<class S>
|
||||
D& operator=(S const& s)
|
||||
{
|
||||
return check_convert(*dest, s);
|
||||
}
|
||||
|
||||
protected:
|
||||
D* dest;
|
||||
};
|
||||
|
||||
template<class D>
|
||||
inline CheckConvert<D> check_convert(D& d)
|
||||
{
|
||||
return d;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Use NoCopy as a base class to easily prevent copy init & assign for any class.
|
||||
struct NoCopy
|
||||
{
|
||||
NoCopy() {}
|
||||
private:
|
||||
NoCopy(const NoCopy&);
|
||||
NoCopy& operator =(const NoCopy&);
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// ZeroInit: base class to zero the memory of the derived class before initialization, so local objects initialize the same as static.
|
||||
// Usage:
|
||||
// class MyClass: ZeroInit<MyClass> {...}
|
||||
// class MyChild: public MyClass, ZeroInit<MyChild> {...} // ZeroInit must be the last base class
|
||||
|
||||
template<class TDerived>
|
||||
struct ZeroInit
|
||||
{
|
||||
#if defined(__clang__) || defined(__GNUC__)
|
||||
bool __dummy; // Dummy var to create non-zero size, ensuring proper placement in TDerived
|
||||
#endif
|
||||
|
||||
ZeroInit(bool bZero = true)
|
||||
{
|
||||
// Optional bool arg to selectively disable zeroing.
|
||||
if (bZero)
|
||||
{
|
||||
// Infer offset of this base class by static casting to derived class.
|
||||
// Zero only the additional memory of the derived class.
|
||||
TDerived* struct_end = static_cast<TDerived*>(this) + 1;
|
||||
size_t memory_size = (char*)struct_end - (char*)this;
|
||||
memset(this, 0, memory_size);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Quick const-manipulation macros
|
||||
|
||||
@@ -696,29 +371,19 @@ void SetFlags(T& dest, U flags, bool b)
|
||||
bool CrySetFileAttributes(const char* lpFileName, uint32 dwFileAttributes);
|
||||
threadID CryGetCurrentThreadId();
|
||||
|
||||
// need this in a common header file and any other file would be too misleading
|
||||
enum ETriState
|
||||
{
|
||||
eTS_false,
|
||||
eTS_true,
|
||||
eTS_maybe
|
||||
};
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define NO_INLINE __attribute__ ((noinline))
|
||||
# define NO_INLINE_WEAK __attribute__ ((noinline)) __attribute__((weak)) // marks a function as no_inline, but also as weak to prevent multiple-defined errors
|
||||
|
||||
# define __PACKED __attribute__ ((packed))
|
||||
#else
|
||||
#define NO_INLINE _declspec(noinline)
|
||||
# define NO_INLINE_WEAK _declspec(noinline) inline
|
||||
|
||||
# define __PACKED
|
||||
#endif
|
||||
#ifdef __GNUC__
|
||||
#define NO_INLINE __attribute__ ((noinline))
|
||||
#define NO_INLINE_WEAK __attribute__ ((noinline)) __attribute__((weak)) // marks a function as no_inline, but also as weak to prevent multiple-defined errors
|
||||
#define __PACKED __attribute__ ((packed))
|
||||
#else
|
||||
#define NO_INLINE _declspec(noinline)
|
||||
#define NO_INLINE_WEAK _declspec(noinline) inline
|
||||
#define __PACKED
|
||||
#endif
|
||||
|
||||
// Fallback for Alignment macro of GCC/CLANG (must be after the class definition)
|
||||
#if !defined(_ALIGN)
|
||||
#define _ALIGN(num) AZ_POP_DISABLE_WARNING
|
||||
#define _ALIGN(num) AZ_POP_DISABLE_WARNING
|
||||
#endif
|
||||
|
||||
// Fallback for Alignment macro of MSVC (must be before the class definition)
|
||||
@@ -726,60 +391,13 @@ enum ETriState
|
||||
#define _MS_ALIGN(num) AZ_PUSH_DISABLE_WARNING(4324, "-Wunknown-warning-option")
|
||||
#endif
|
||||
|
||||
#if defined(WIN32) || defined(WIN64)
|
||||
extern "C" {
|
||||
__declspec(dllimport) unsigned long __stdcall TlsAlloc();
|
||||
__declspec(dllimport) void* __stdcall TlsGetValue(unsigned long dwTlsIndex);
|
||||
__declspec(dllimport) int __stdcall TlsSetValue(unsigned long dwTlsIndex, void* lpTlsValue);
|
||||
}
|
||||
|
||||
#define TLS_DECLARE(type, var) extern int var##idx;
|
||||
#define TLS_DEFINE(type, var) \
|
||||
int var##idx; \
|
||||
struct Init##var { \
|
||||
Init##var() { var##idx = TlsAlloc(); } \
|
||||
}; \
|
||||
Init##var g_init##var;
|
||||
#define TLS_DEFINE_DEFAULT_VALUE(type, var, value) \
|
||||
int var##idx; \
|
||||
struct Init##var { \
|
||||
Init##var() { var##idx = TlsAlloc(); TlsSetValue(var##idx, reinterpret_cast<void*>(value)); } \
|
||||
}; \
|
||||
Init##var g_init##var;
|
||||
#define TLS_GET(type, var) (type)TlsGetValue(var##idx)
|
||||
#define TLS_SET(var, val) TlsSetValue(var##idx, reinterpret_cast<void*>(val))
|
||||
#elif defined(USE_PTHREAD_TLS)
|
||||
#define TLS_DECLARE(_TYPE, _VAR) extern SCryPthreadTLS<_TYPE> _VAR##TLSKey;
|
||||
#define TLS_DEFINE(_TYPE, _VAR) SCryPthreadTLS<_TYPE> _VAR##TLSKey;
|
||||
#define TLS_DEFINE_DEFAULT_VALUE(_TYPE, _VAR, _DEFAULT) SCryPthreadTLS<_TYPE> _VAR##TLSKey = _DEFAULT;
|
||||
#define TLS_GET(_TYPE, _VAR) _VAR##TLSKey.Get()
|
||||
#define TLS_SET(_VAR, _VALUE) _VAR##TLSKey.Set(_VALUE)
|
||||
#elif defined(THREADLOCAL)
|
||||
#define TLS_DECLARE(type, var) extern THREADLOCAL type var;
|
||||
#if defined(LINUX) || defined(MAC)
|
||||
#define TLS_DEFINE(type, var) THREADLOCAL type var = 0;
|
||||
#else
|
||||
#define TLS_DEFINE(type, var) THREADLOCAL type var;
|
||||
#endif // defined(LINUX) || defined(MAC)
|
||||
#define TLS_DEFINE_DEFAULT_VALUE(type, var, value) THREADLOCAL type var = value;
|
||||
#define TLS_GET(type, var) (var)
|
||||
#define TLS_SET(var, val) (var = (val))
|
||||
#else // defined(THREADLOCAL)
|
||||
#error "There's no support for thread local storage"
|
||||
#endif
|
||||
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_13
|
||||
#include AZ_RESTRICTED_FILE(platform_h)
|
||||
#elif !defined(LINUX) && !defined(APPLE)
|
||||
typedef int socklen_t;
|
||||
typedef int socklen_t;
|
||||
#endif
|
||||
|
||||
|
||||
// Include MultiThreading support.
|
||||
#include "CryThread.h"
|
||||
#include "MultiThread.h"
|
||||
|
||||
// In RELEASE disable printf and fprintf
|
||||
#if defined(_RELEASE) && !defined(RELEASE_LOGGING)
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
@@ -788,19 +406,9 @@ typedef int socklen_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define _STRINGIFY(x) #x
|
||||
#define STRINGIFY(x) _STRINGIFY(x)
|
||||
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_15
|
||||
#include AZ_RESTRICTED_FILE(platform_h)
|
||||
#endif
|
||||
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
|
||||
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
|
||||
#elif defined(WIN32) || defined(WIN64)
|
||||
#define MESSAGE(msg) message(__FILE__ "(" STRINGIFY(__LINE__) "): " msg)
|
||||
#else
|
||||
#define MESSAGE(msg)
|
||||
#endif
|
||||
|
||||
void InitRootDir(char szExeFileName[] = nullptr, uint nExeSize = 0, char szExeRootName[] = nullptr, uint nRootSize = 0);
|
||||
|
||||
@@ -204,17 +204,6 @@ void __stl_debug_message(const char* format_str, ...)
|
||||
|
||||
#include "CryAssert_impl.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CryDebugBreak()
|
||||
{
|
||||
#if defined(WIN32) && !defined(RELEASE)
|
||||
if (IsDebuggerPresent())
|
||||
#endif
|
||||
{
|
||||
DebugBreak();
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CrySleep(unsigned int dwMilliseconds)
|
||||
{
|
||||
@@ -222,21 +211,6 @@ void CrySleep(unsigned int dwMilliseconds)
|
||||
Sleep(dwMilliseconds);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CryLowLatencySleep(unsigned int dwMilliseconds)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::System);
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION PLATFORM_IMPL_H_SECTION_CRYLOWLATENCYSLEEP
|
||||
#include AZ_RESTRICTED_FILE(platform_impl_h)
|
||||
#endif
|
||||
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
|
||||
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
|
||||
#else
|
||||
CrySleep(dwMilliseconds);
|
||||
#endif
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CryMessageBox([[maybe_unused]] const char* lpText, [[maybe_unused]] const char* lpCaption, [[maybe_unused]] unsigned int uType)
|
||||
{
|
||||
@@ -304,16 +278,6 @@ void InitRootDir(char szExeFileName[], uint nExeSize, char szExeRootName[], uint
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
short CryGetAsyncKeyState([[maybe_unused]] int vKey)
|
||||
{
|
||||
#ifdef WIN32
|
||||
return GetAsyncKeyState(vKey);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
LONG CryInterlockedIncrement(int volatile* lpAddend)
|
||||
{
|
||||
@@ -419,25 +383,6 @@ void CryLeaveCriticalSection(void* cs)
|
||||
LeaveCriticalSection((CRITICAL_SECTION*)cs);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
uint32 CryGetFileAttributes(const char* lpFileName)
|
||||
{
|
||||
WIN32_FILE_ATTRIBUTE_DATA data;
|
||||
BOOL res;
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION PLATFORM_IMPL_H_SECTION_CRYGETFILEATTRIBUTES
|
||||
#include AZ_RESTRICTED_FILE(platform_impl_h)
|
||||
#endif
|
||||
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
|
||||
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
|
||||
#else
|
||||
AZStd::wstring lpFileNameW;
|
||||
AZStd::to_wstring(lpFileNameW, lpFileName);
|
||||
res = GetFileAttributesExW(lpFileNameW.c_str(), GetFileExInfoStandard, &data);
|
||||
#endif
|
||||
return res ? data.dwFileAttributes : -1;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CrySetFileAttributes(const char* lpFileName, uint32 dwFileAttributes)
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#include <platform.h>
|
||||
#include <type_traits>
|
||||
#include <MultiThread.h>
|
||||
|
||||
void CryFatalError(const char*, ...) PRINTF_PARAMS(1, 2);
|
||||
#if defined(APPLE)
|
||||
@@ -171,13 +172,13 @@ public:
|
||||
|
||||
void AddRef()
|
||||
{
|
||||
CHECK_REFCOUNT_CRASH(m_nRefCounter >= 0);
|
||||
AZ_Assert(m_nRefCounter >= 0, "Invalid ref count");
|
||||
++m_nRefCounter;
|
||||
}
|
||||
|
||||
void Release()
|
||||
{
|
||||
CHECK_REFCOUNT_CRASH(m_nRefCounter > 0);
|
||||
AZ_Assert(m_nRefCounter > 0, "Invalid ref count");
|
||||
if (--m_nRefCounter == 0)
|
||||
{
|
||||
delete static_cast<TDerived*>(this);
|
||||
@@ -215,13 +216,13 @@ public:
|
||||
|
||||
void AddRef()
|
||||
{
|
||||
CHECK_REFCOUNT_CRASH(m_nRefCounter >= 0);
|
||||
AZ_Assert(m_nRefCounter >= 0, "Invalid ref count");
|
||||
++m_nRefCounter;
|
||||
}
|
||||
|
||||
void Release()
|
||||
{
|
||||
CHECK_REFCOUNT_CRASH(m_nRefCounter > 0);
|
||||
AZ_Assert(m_nRefCounter > 0, "Invalid ref count");
|
||||
if (--m_nRefCounter == 0)
|
||||
{
|
||||
delete this;
|
||||
@@ -272,13 +273,13 @@ public:
|
||||
|
||||
void AddRef()
|
||||
{
|
||||
CHECK_REFCOUNT_CRASH(m_nRefCounter >= 0);
|
||||
AZ_Assert(m_nRefCounter >= 0, "Invalid ref count");
|
||||
++m_nRefCounter;
|
||||
}
|
||||
|
||||
void Release()
|
||||
{
|
||||
CHECK_REFCOUNT_CRASH(m_nRefCounter > 0);
|
||||
AZ_Assert(m_nRefCounter > 0, "Invalid ref count");
|
||||
if (--m_nRefCounter == 0)
|
||||
{
|
||||
assert(m_pDeleteFnc);
|
||||
|
||||
@@ -66,9 +66,9 @@ private:
|
||||
# if !defined(eLittleEndian)
|
||||
# error eLittleEndian is not defined, please include CryEndian.h.
|
||||
# endif
|
||||
COMPILE_TIME_ASSERT(metautils::is_const<dtype>::value || !metautils::is_const<dtype1>::value);
|
||||
static_assert(metautils::is_const<dtype>::value || !metautils::is_const<dtype1>::value);
|
||||
// note: we allow xint32 -> xint16 converting
|
||||
COMPILE_TIME_ASSERT(
|
||||
static_assert(
|
||||
(metautils::is_same<typename metautils::remove_const<dtype1>::type, typename metautils::remove_const<dtype>::type>::value ||
|
||||
((metautils::is_same<typename metautils::remove_const<dtype1>::type, sint32>::value ||
|
||||
metautils::is_same<typename metautils::remove_const<dtype1>::type, uint32>::value ||
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#include <CryWindows.h>
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
#include <tlhelp32.h>
|
||||
#undef GetCharWidth
|
||||
#undef GetUserName
|
||||
|
||||
@@ -227,7 +227,7 @@ void IDebugCallStack::FatalError(const char* description)
|
||||
|
||||
#if defined(WIN32) || !defined(_RELEASE)
|
||||
int* p = 0x0;
|
||||
PREFAST_SUPPRESS_WARNING(6011) * p = 1; // we're intentionally crashing here
|
||||
*p = 1; // we're intentionally crashing here
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -33,10 +33,6 @@
|
||||
|
||||
#include <AzCore/Script/ScriptSystemBus.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <CryWindows.h>
|
||||
#endif
|
||||
|
||||
namespace LegacyLevelSystem
|
||||
{
|
||||
static constexpr const char* ArchiveExtension = ".pak";
|
||||
|
||||
@@ -251,7 +251,7 @@ static void CmdCrashTest(IConsoleCmdArgs* pArgs)
|
||||
case 1:
|
||||
{
|
||||
int* p = 0;
|
||||
PREFAST_SUPPRESS_WARNING(6011) * p = 0xABCD;
|
||||
*p = 0xABCD;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
|
||||
@@ -338,32 +338,25 @@ void CSystem::FatalError(const char* format, ...)
|
||||
IDebugCallStack::instance()->FatalError(szBuffer);
|
||||
#endif
|
||||
|
||||
CryDebugBreak();
|
||||
|
||||
// app can not continue
|
||||
AZ::Debug::Trace::Break();
|
||||
|
||||
#ifdef _DEBUG
|
||||
#if defined(WIN32) || defined(WIN64)
|
||||
_flushall();
|
||||
// on windows, _exit does all sorts of things which can cause cleanup to fail during a crash, we need to terminate instead.
|
||||
TerminateProcess(GetCurrentProcess(), 1);
|
||||
#endif
|
||||
|
||||
#if defined(WIN32) && !defined(WIN64)
|
||||
DEBUG_BREAK;
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#if defined(WIN32) || defined(WIN64)
|
||||
_flushall();
|
||||
// on windows, _exit does all sorts of things which can cause cleanup to fail during a crash, we need to terminate instead.
|
||||
TerminateProcess(GetCurrentProcess(), 1);
|
||||
#endif
|
||||
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION SYSTEMWIN32_CPP_SECTION_2
|
||||
#include AZ_RESTRICTED_FILE(SystemWin32_cpp)
|
||||
#endif
|
||||
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
|
||||
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
|
||||
#else
|
||||
_exit(1);
|
||||
#endif
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION SYSTEMWIN32_CPP_SECTION_2
|
||||
#include AZ_RESTRICTED_FILE(SystemWin32_cpp)
|
||||
#endif
|
||||
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
|
||||
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
|
||||
#else
|
||||
_exit(1);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
if (count > 0) \
|
||||
{ \
|
||||
const size_t memSize = count * sizeof(IViewSystemListener*); \
|
||||
PREFAST_SUPPRESS_WARNING(6255) IViewSystemListener * *pArray = (IViewSystemListener**) alloca(memSize); \
|
||||
IViewSystemListener* *pArray = (IViewSystemListener**) alloca(memSize); \
|
||||
memcpy(pArray, &*m_listeners.begin(), memSize); \
|
||||
while (count--) \
|
||||
{ \
|
||||
|
||||
@@ -194,7 +194,7 @@ void XMLBinary::XMLBinaryReader::CheckHeader(const BinaryFileHeader& header, siz
|
||||
// Check the signature of the file to make sure that it is a binary XML file.
|
||||
{
|
||||
static const char signature[] = "CryXmlB";
|
||||
COMPILE_TIME_ASSERT(sizeof(signature) == sizeof(header.szSignature));
|
||||
static_assert(sizeof(signature) == sizeof(header.szSignature));
|
||||
if (memcmp(header.szSignature, signature, sizeof(header.szSignature)) != 0)
|
||||
{
|
||||
result = eResult_NotBinXml;
|
||||
|
||||
@@ -109,7 +109,7 @@ bool XMLBinary::CXMLBinaryWriter::WriteNode(IDataWriter* pFile, XmlNodeRef node,
|
||||
|
||||
BinaryFileHeader header;
|
||||
static const char signature[] = "CryXmlB";
|
||||
COMPILE_TIME_ASSERT(sizeof(signature) == sizeof(header.szSignature));
|
||||
static_assert(sizeof(signature) == sizeof(header.szSignature));
|
||||
memcpy(header.szSignature, signature, sizeof(header.szSignature));
|
||||
nTheoreticalPosition += sizeof(header);
|
||||
align(nTheoreticalPosition, nAlignment);
|
||||
|
||||
@@ -1390,7 +1390,7 @@ protected:
|
||||
{
|
||||
((XmlParserImp*)userData)->onEndElement(name);
|
||||
}
|
||||
static void characterData(void* userData, const char* s, int len) PREFAST_SUPPRESS_WARNING(6262)
|
||||
static void characterData(void* userData, const char* s, int len)
|
||||
{
|
||||
char str[32700];
|
||||
if (len > sizeof(str) - 1)
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <AzCore/std/parallel/shared_mutex.h>
|
||||
#include <AzCore/Asset/AssetCommon.h>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <AzFramework/Font/FontInterface.h>
|
||||
#include <AzFramework/Scene/SceneSystemInterface.h>
|
||||
|
||||
@@ -26,12 +26,12 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Serialization for anim nodes & param types
|
||||
#define REGISTER_NODE_TYPE(name) assert(g_animNodeEnumToStringMap.find(eUiAnimNodeType_ ## name) == g_animNodeEnumToStringMap.end()); \
|
||||
g_animNodeEnumToStringMap[eUiAnimNodeType_ ## name] = STRINGIFY(name); \
|
||||
g_animNodeStringToEnumMap[AZStd::string(STRINGIFY(name))] = eUiAnimNodeType_ ## name;
|
||||
g_animNodeEnumToStringMap[eUiAnimNodeType_ ## name] = AZ_STRINGIZE(name); \
|
||||
g_animNodeStringToEnumMap[AZStd::string(AZ_STRINGIZE(name))] = eUiAnimNodeType_ ## name;
|
||||
|
||||
#define REGISTER_PARAM_TYPE(name) assert(g_animParamEnumToStringMap.find(eUiAnimParamType_ ## name) == g_animParamEnumToStringMap.end()); \
|
||||
g_animParamEnumToStringMap[eUiAnimParamType_ ## name] = STRINGIFY(name); \
|
||||
g_animParamStringToEnumMap[AZStd::string(STRINGIFY(name))] = eUiAnimParamType_ ## name;
|
||||
g_animParamEnumToStringMap[eUiAnimParamType_ ## name] = AZ_STRINGIZE(name); \
|
||||
g_animParamStringToEnumMap[AZStd::string(AZ_STRINGIZE(name))] = eUiAnimParamType_ ## name;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
@@ -74,12 +74,12 @@ static SMovieSequenceAutoComplete s_movieSequenceAutoComplete;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Serialization for anim nodes & param types
|
||||
#define REGISTER_NODE_TYPE(name) assert(g_animNodeEnumToStringMap.find(AnimNodeType::name) == g_animNodeEnumToStringMap.end()); \
|
||||
g_animNodeEnumToStringMap[AnimNodeType::name] = STRINGIFY(name); \
|
||||
g_animNodeStringToEnumMap[AZStd::string(STRINGIFY(name))] = AnimNodeType::name;
|
||||
g_animNodeEnumToStringMap[AnimNodeType::name] = AZ_STRINGIZE(name); \
|
||||
g_animNodeStringToEnumMap[AZStd::string(AZ_STRINGIZE(name))] = AnimNodeType::name;
|
||||
|
||||
#define REGISTER_PARAM_TYPE(name) assert(g_animParamEnumToStringMap.find(AnimParamType::name) == g_animParamEnumToStringMap.end()); \
|
||||
g_animParamEnumToStringMap[AnimParamType::name] = STRINGIFY(name); \
|
||||
g_animParamStringToEnumMap[AZStd::string(STRINGIFY(name))] = AnimParamType::name;
|
||||
g_animParamEnumToStringMap[AnimParamType::name] = AZ_STRINGIZE(name); \
|
||||
g_animParamStringToEnumMap[AZStd::string(AZ_STRINGIZE(name))] = AnimParamType::name;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user