/* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or the license accompanying this file. Do not * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * */ // Original file Copyright Crytek GMBH or its affiliates, used under license. // Description : Utility header for standalone DXGL build #if defined(_MSC_VER) #define ILINE __forceinline #else #define ILINE inline #endif #define COMPILE_TIME_ASSERT(_Condition) #if !defined(SAFE_RELEASE) #define SAFE_RELEASE(p) { if (p) { (p)->Release(); (p) = NULL; } \ } #endif //!defined(SAFE_RELEASE) #include typedef unsigned short ushort; typedef unsigned char uchar; typedef uchar uint8; typedef char int8; #if defined(WIN32) typedef unsigned __int16 uint16; typedef __int16 int16; typedef unsigned __int32 uint32; typedef __int32 int32; typedef unsigned __int64 uint64; typedef __int64 int64; #else #include typedef uint16_t uint16; typedef int16_t int16; typedef uint32_t uint32; typedef int32_t int32; typedef uint64_t uint64; typedef int64_t int64; typedef uint32 ULONG; typedef uint32 DWORD; typedef void* HANDLE; typedef void* HWND; typedef void* HMODULE; typedef uchar BYTE; typedef uint64 UINT64; typedef int32 LONG; typedef float FLOAT; typedef int HRESULT; typedef wchar_t WCHAR; typedef size_t SIZE_T; typedef const char* LPCSTR; typedef char* LPSTR; typedef const void* LPCVOID; typedef void* LPVOID; #define WINAPI #endif #include #if defined(WIN32) #include namespace stl { template > struct hash_compare : stdext::hash_compare { hash_compare(){} }; template > > struct hash_map : stdext::hash_map > > { hash_map(){} }; } #else #include namespace stl { template > struct hash_compare : Less { hash_compare(){} size_t operator()(const Key& kKey) const{ return std::hash(kKey); } bool operator()(const Key& kLeft, const Key& kRight) const{ return Less::operator()(kLeft, kRight); } }; template struct hash : HashCompare { hash(){} size_t operator()(const Key& kKey) const{ return HashCompare::operator()(kKey); } }; template struct equal_to : HashCompare { equal_to(){} bool operator()(const Key& kLeft, const Key& kRight) const{ return !HashCompare::operator()(kLeft, kRight) && !HashCompare::operator()(kRight, kLeft); } }; template > > struct hash_map : std::unordered_map, stl::equal_to > { hash_map(){} }; } #endif template struct _smart_ptr { _smart_ptr(T* pPtr = NULL) : m_pPtr(pPtr) { if (m_pPtr) { m_pPtr->AddRef(); } } _smart_ptr(const _smart_ptr& kOther) : m_pPtr(kOther.m_pPtr) { if (m_pPtr) { m_pPtr->AddRef(); } } template _smart_ptr(const _smart_ptr& kOther) : m_pPtr(kOther.m_pPtr) { if (m_pPtr) { m_pPtr->AddRef(); } } ~_smart_ptr() { if (m_pPtr) { m_pPtr->Release(); } } _smart_ptr& operator=(const _smart_ptr& kOther) { if (m_pPtr != kOther.m_pPtr) { if (m_pPtr) { m_pPtr->Release(); } m_pPtr = kOther.m_pPtr; if (m_pPtr) { m_pPtr->AddRef(); } } return *this; } template _smart_ptr& operator=(const _smart_ptr& kOther) { if (m_pPtr != kOther.m_pPtr) { if (m_pPtr) { m_pPtr->Release(); } m_pPtr = kOther.m_pPtr; if (m_pPtr) { m_pPtr->AddRef(); } } return *this; } bool operator==(T* pPtr) const { return m_pPtr == pPtr; } bool operator!=(T* pPtr) const { return m_pPtr != pPtr; } T& operator*() const { return *get(); } T* operator->() const { return get(); } operator T*() const { return get(); } T* get() const { return m_pPtr; } T* m_pPtr; }; #if !defined(WIN32) typedef struct tagRECT { LONG left; LONG top; LONG right; LONG bottom; } RECT, * PRECT; typedef union _LARGE_INTEGER { struct { DWORD LowPart; LONG HighPart; }; struct { DWORD LowPart; LONG HighPart; } u; long long QuadPart; } LARGE_INTEGER; #endif //!defined(WIN32) #define D3D10CreateBlob D3DCreateBlob #define CRY_OPENGL_ADAPT_CLIP_SPACE 1 #define CRY_OPENGL_FLIP_Y 1 #define CRY_OPENGL_MODIFY_PROJECTIONS !CRY_OPENGL_ADAPT_CLIP_SPACE #include "../CryDXGL.hpp"