12#define GX_PLATFORM_NAME "Win64"
14#define GX_OPENGL_VERSION GX_OPENGL_VERSION_INVALID
15#define GX_DIRECTX_VERSION GX_DIRECTX_VERSION_12_0
16#define GX_SHADER_MODEL GX_SHADER_MODEL_5
18#define GX_STRING_LITERALS_ENCODE GX_STRING_ENCODE_SJIS
21#define GX_LITTLE_ENDIAN 1
22#define GX_BIG_ENDIAN 0
23#define GX_BITFIELD_LITTLEENDIAN 1
24#define GX_BITFIELD_BIGENDIAN 0
31#define GX_USE_RESET_INDEX16 0
32#define GX_USE_RESET_INDEX32 0
35#if !defined(GX_USE_SIMD)
42#pragma warning(disable:4061)
43#pragma warning(disable:4191)
44#pragma warning(disable:4201)
45#pragma warning(disable:4324)
46#pragma warning(disable:4365)
47#pragma warning(disable:4505)
48#pragma warning(disable:4640)
49#pragma warning(disable:4710)
50#pragma warning(disable:4711)
51#pragma warning(disable:4820)
52#pragma warning(disable:4625)
53#pragma warning(disable:4626)
54#pragma warning(disable:4738)
57#pragma warning(disable:4619)
58#pragma warning(disable:4668)
59#pragma warning(disable:4826)
60#pragma warning(disable:4548)
61#pragma warning(disable:4917)
63#pragma warning(disable:4005)
65#pragma warning(disable:4458)
69#define _CRT_SECURE_NO_DEPRECATE
71#define WIN32_LEAN_AND_MEAN
76#define _HAS_EXCEPTIONS (0)
96#pragma comment(lib, "winmm.lib")
101#define DIRECTINPUT_VERSION 0x0800
103#pragma comment(lib, "dxguid.lib")
110#pragma comment(lib, "dinput8.lib")
111#pragma comment(lib, "xinput.lib")
118#include <d3dcompiler.h>
122#pragma comment(lib, "d3d12.lib")
123#pragma comment(lib, "dxcompiler.lib")
124#pragma comment(lib, "dxgi.lib")
125#pragma comment(lib, "d3dcompiler.lib")
126#pragma comment(lib, "d2d1.lib")
134#include <WinPixEventRuntime/pix3.h>
137#define GX_PPV_ARGS IID_PPV_ARGS
141#include "steam_api.h"
144#pragma warning(default:4619)
145#pragma warning(default:4668)
146#pragma warning(default:4826)
147#pragma warning(default:4548)
148#pragma warning(default:4917)
150#pragma warning(default:4005)
152#pragma warning(default:4458)
157using Microsoft::WRL::ComPtr;
159#define GX_CORE_NAMESPACE_BEGIN() namespace gx{namespace core{
160#define GX_CORE_NAMESPACE_END() }}
162GX_CORE_NAMESPACE_BEGIN()
166using s8 =
signed char;
167using u8 =
unsigned char;
168using s16 =
signed short;
169using u16 =
unsigned short;
170using s32 =
signed int;
171using u32 =
unsigned int;
172using s64 =
signed long long;
173using u64 =
unsigned long long;
178using GX_CCHAR = const
char;
180using GX_CSTR = const
char*;
182using GX_WCHAR =
wchar_t;
183using GX_CWCHAR = const
wchar_t;
184using GX_WSTR =
wchar_t*;
185using GX_CWSTR = const
wchar_t*;
205using GxNativeDateTime = tm;
206using GxNativeThread = u32;
207using GxNativeMutex = CRITICAL_SECTION;
209using GxNativeFileEntry = WIN32_FIND_DATA;
210using GxNativeFileHandle = HANDLE;
211using GxNativeFindHandle = HANDLE;
213using GxNativeBuffer = ComPtr<ID3D12Resource>;
214using GxNativeBufferAddress =
void*;
215using GxNativeDevice = ComPtr<ID3D12Device>;
216using GxNativeSwapChain = IDXGISwapChain3;
217using GxNativeTexture = ComPtr<ID3D12Resource>;
218using GxNativeRenderTarget = ComPtr<ID3D12Resource>;
219using GxNativeDepthStencil = ComPtr<ID3D12Resource>;
220using GxNativeRenderFormat = DXGI_FORMAT;
221using GxNativeQueryResult = ComPtr<ID3D12Resource>;
222using D3D_INPUT_ELEMENT_DESC = D3D12_INPUT_ELEMENT_DESC;
227#define U8_MAX ( (u8)( UCHAR_MAX ) )
228#define S8_MIN ( (s8)( CHAR_MIN ) )
229#define S8_MAX ( (s8)( CHAR_MAX ) )
231#define U16_MAX ( (u16)( USHRT_MAX ) )
232#define S16_MIN ( (s16)( SHRT_MIN ) )
233#define S16_MAX ( (s16)( SHRT_MAX ) )
235#define U32_MAX ( (u32)( ULONG_MAX ) )
236#define S32_MIN ( (s32)( LONG_MIN ) )
237#define S32_MAX ( (s32)( LONG_MAX ) )
241#define F32_ABS_MIN ( (f32)( FLT_MIN ) )
242#define F32_ABS_MAX ( (f32)( FLT_MAX ) )
243#define F32_NEARLY_ZERO ( (f32)( F32_ABS_MIN ) )
245#define U64_MAX ( (u64)( ULLONG_MAX ) )
246#define S64_MIN ( (s64)( LLONG_MIN ) )
247#define S64_MAX ( (s64)( LLONG_MAX ) )
251#define F64_ABS_MIN ( (f64)( DBL_MIN ) )
252#define F64_ABS_MAX ( (f64)( DBL_MAX ) )
253#define F64_NEARLY_ZERO ( (f64)( F64_ABS_MIN ) )
261#define GX_ALIGN32_BEGIN __declspec(align(32))
262#define GX_ALIGN32_END
263#define GX_ALIGN16_BEGIN __declspec(align(16))
264#define GX_ALIGN16_END
265#define GX_ALIGN8_BEGIN __declspec(align(8))
274#pragma inline_recursion(on)
275#pragma inline_depth(255)
276#define GX_INLINE __inline
279#define GX_FORCE_INLINE __inline
281#define GX_FORCE_INLINE __forceinline
287#if defined(_MSC_VER) && (_MSC_VER >= 1400)
289 #define GX_RESTRICT __restrict
309#define GX_DEPRECATED_BEGIN __declspec(deprecated)
310#define GX_DEPRECATED_END
315#define GX_THREAD_LOCAL_STORAGE __declspec(thread)
320#define GX_ALLOCA(size) _alloca(size)
327#define GX_PREFETCH_NT(__BASE_ADDRESS__, __OFFSET__)
331#define GX_PREFETCH_T(__BASE_ADDRESS__, __OFFSET__)
335#define GX_PREFETCH(__BASE_ADDRESS__, __OFFSET__)
339#define GX_PREFETCH128(__BASE_POINTER__, __OFFSET__)
345#if !defined(GX_SAFE_DELETE)
346 #define GX_SAFE_DELETE(__POINTER__) if(__POINTER__){GX_DELETE(__POINTER__); __POINTER__ = nullptr;}
350#if !defined(GX_SAFE_DELETE_ARRAY)
351 #define GX_SAFE_DELETE_ARRAY(__POINTER__) if(__POINTER__){GX_DELETE[](__POINTER__); __POINTER__ = nullptr;}
355#if !defined(DIRECTX_SAFE_RELEASE)
356 #define DIRECTX_SAFE_RELEASE(__POINTER__) if(__POINTER__){(__POINTER__)->Release(); __POINTER__ = nullptr;}
360#if !defined(GX_SAFE_PLACEMENT_DELETE)
361#define GX_SAFE_PLACEMENT_DELETE(__POINTER__, __CLASSNAME__) if(__POINTER__){(__POINTER__)->~__CLASSNAME__(); GX_SAFE_FREE_MEMORY(__POINTER__);}
365#if !defined(GX_SAFE_PLACEMENT_DELETE_ALLOCATOR)
366#define GX_SAFE_PLACEMENT_DELETE_ALLOCATOR(__POINTER__, __CLASSNAME__, __ALLOCATOR__) if(__POINTER__){(__POINTER__)->~__CLASSNAME__(); GX_SAFE_FREE_MEMORY_ALLOCATOR(__POINTER__, __ALLOCATOR__);}
375#define GX_POINTER_ADD(__POINTER__, __ADD__) ((void*)(((size_t)(__POINTER__)) + (size_t)(__ADD__)))
380#define GX_POINTER_SUB(__POINTER__, __SUB__) ((void*)(((size_t)(__POINTER__)) - (size_t)(__SUB__)))
385#define GX_POINTER_TO_UINT(__POINTER__) ((u64)(size_t)(__POINTER__))
386#define GX_POINTER_TO_SIZE_T(__POINTER__) ((size_t)(__POINTER__))
387#define GX_POINTER_TO_U32(__POINTER__) ((u32)(size_t)(__POINTER__))
392#define GX_SIZE_T_TO_POINTER(__SIZE_T__) ((void*)(size_t)(__SIZE_T__))
397#define GX_GET_OFFSET(__CLASS_NAME__, __PARAM_NAME__) (reinterpret_cast<size_t>(&((__CLASS_NAME__*)0x100)->__PARAM_NAME__) - 0x100)
402#define GX_GET_POINTER_BY_OFFSET(__POINTER__, __CLASS_NAME__, __OFFSET__) ((__CLASS_NAME__*)((size_t)__POINTER__ + __OFFSET__))
409#define GX_MEMSET(__DST__, __VALUE__, __SIZE__) memset(__DST__, __VALUE__, __SIZE__)
412#define GX_MEMSET_ALIGNMENT4(__DST__, __VALUE__, __SIZE__) memset(__DST__, __VALUE__, __SIZE__)
415#define GX_MEMSET_ALIGNMENT16(__DST__, __VALUE__, __SIZE__) memset(__DST__, __VALUE__, __SIZE__)
418#define GX_MEMSET_ALIGNMENT128(__DST__, __VALUE__, __SIZE__) memset(__DST__, __VALUE__, __SIZE__)
425#define GX_MEMCPY(__DST__, __SRC__, __SIZE__) memcpy(__DST__, __SRC__, __SIZE__)
428#define GX_MEMCPY_ALIGNMENT4(__DST__, __SRC__, __SIZE__) memcpy(__DST__, __SRC__, __SIZE__)
431#define GX_MEMCPY_ALIGNMENT16(__DST__, __SRC__, __SIZE__) memcpy(__DST__, __SRC__, __SIZE__)
434#define GX_MEMCPY_ALIGNMENT128(__DST__, __SRC__, __SIZE__) memcpy(__DST__, __SRC__, __SIZE__)
441#define GX_MEMCMP(__PTR1__, __PTR2__, __SIZE__) memcmp(__PTR1__, __PTR2__, __SIZE__)
444#define GX_MEMCMP_ALIGNMENT4(__PTR1__, __PTR2__, __SIZE__) memcmp(__PTR1__, __PTR2__, __SIZE__)
447#define GX_MEMCMP_ALIGNMENT16(__PTR1__, __PTR2__, __SIZE__) memcmp(__PTR1__, __PTR2__, __SIZE__)
450#define GX_MEMCMP_ALIGNMENT128(__PTR1__, __PTR2__, __SIZE__) memcmp(__PTR1__, __PTR2__, __SIZE__)
457#define GX_MEMMOVE(__DST__, __VALUE__, __SIZE__) memmove(__DST__, __VALUE__, __SIZE__)
460#define GX_MEMMOVE_ALIGNMENT4(__DST__, __VALUE__, __SIZE__) memmove(__DST__, __VALUE__, __SIZE__)
463#define GX_MEMMOVE_ALIGNMENT16(__DST__, __VALUE__, __SIZE__) memmove(__DST__, __VALUE__, __SIZE__)
466#define GX_MEMMOVE_ALIGNMENT128(__DST__, __VALUE__, __SIZE__) memmove(__DST__, __VALUE__, __SIZE__)
472#define GX_INVALID_HANDLE ((GX_HANDLE)0xffffffffL)
475#define GX_UNUSED(__POINTER__) (&__POINTER__)
478#define GX_OFFSET_OF(__STRUCTURE__, __VALUE__) (u32)(size_t)(&((__STRUCTURE__*)0)->__VALUE__)
481#define GX_FOURCC(__A__, __B__, __C__, __D__) (((u32)(__D__) << 24) | ((u32)(__C__) << 16) | ((u32)(__B__) << 8) | (u32)(__A__))
484#define GX_COLOR_RGB_SWAP 1
486GX_CORE_NAMESPACE_END()
491#if GX_USE_DEFAULT_ALLOCATOR
494 #define _CRTDBG_MAP_ALLOC
495 #define GX_MEMORY_LEAK_CHECK_INIT() _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
497 #define GX_MEMORY_LEAK_CHECK_INIT()
500 #define GX_NEW_NAME(name) new
501 #define GX_DELETE delete
504 #define GX_NEW new(__FILE__, __LINE__)
505 #define GX_NEW_NAME(name) new(__FILE__ "::" name, __LINE__)
506 #define GX_PLACEMENT_NEW(addr) new(addr)
507 #define GX_DELETE delete
508 void*
operator new (
size_t blocksize, gx::core::GX_CSTR filename, gx::core::u32 line );
509 void*
operator new[] (
size_t blocksize, gx::core::GX_CSTR filename, gx::core::u32 line );
510 void operator delete (
void* block , gx::core::GX_CSTR filename, gx::core::u32 line );
511 void operator delete[] (
void* block , gx::core::GX_CSTR filename, gx::core::u32 line );
513 inline void *
operator new(size_t,
void *where , gx::core::GX_CSTR, gx::core::u32) {
return (where); }
514 inline void operator delete(
void *,
void * , gx::core::GX_CSTR, gx::core::u32) { }
515 inline void *
operator new[](size_t,
void *where , gx::core::GX_CSTR, gx::core::u32) {
return (where); }
516 inline void operator delete[](
void *,
void *, gx::core::GX_CSTR, gx::core::u32) { }
519 #define GX_NEW_NAME(name) new
520 #define GX_PLACEMENT_NEW(addr) new(addr)
521 #define GX_DELETE delete
523 #define GX_MEMORY_LEAK_CHECK_INIT()
526void*
operator new (
size_t blocksize );
527void*
operator new[] (
size_t blocksize );
528void operator delete (
void* block );
529void operator delete[] (
void* block );
531GX_CORE_NAMESPACE_BEGIN()
536enum class GX_PLATFORM
546static GX_CSTR GX_PLATFORM_NAMES[
static_cast<u32
>(GX_PLATFORM::MAX)] = {
555GX_CORE_NAMESPACE_END()