diff options
Diffstat (limited to '3rdparty/bx')
-rw-r--r-- | 3rdparty/bx/include/bx/allocator.h | 68 | ||||
-rw-r--r-- | 3rdparty/bx/include/bx/config.h | 14 | ||||
-rw-r--r-- | 3rdparty/bx/include/bx/crtimpl.h | 197 | ||||
-rw-r--r-- | 3rdparty/bx/include/bx/fpumath.h | 72 | ||||
-rw-r--r-- | 3rdparty/bx/include/bx/mutex.h | 4 | ||||
-rw-r--r-- | 3rdparty/bx/include/bx/os.h | 11 | ||||
-rw-r--r-- | 3rdparty/bx/include/bx/platform.h | 2 | ||||
-rw-r--r-- | 3rdparty/bx/include/bx/radixsort.h | 8 | ||||
-rw-r--r-- | 3rdparty/bx/include/bx/readerwriter.h | 124 | ||||
-rw-r--r-- | 3rdparty/bx/include/bx/sem.h | 14 | ||||
-rw-r--r-- | 3rdparty/bx/include/bx/thread.h | 6 | ||||
-rw-r--r-- | 3rdparty/bx/include/bx/timer.h | 6 | ||||
-rw-r--r-- | 3rdparty/bx/include/bx/uint32_t.h | 2 | ||||
-rw-r--r-- | 3rdparty/bx/scripts/toolchain.lua | 37 | ||||
-rw-r--r-- | 3rdparty/bx/tools/bin/darwin/genie | bin | 422176 -> 422176 bytes | |||
-rw-r--r-- | 3rdparty/bx/tools/bin/linux/genie | bin | 396856 -> 396856 bytes | |||
-rw-r--r-- | 3rdparty/bx/tools/bin/windows/genie.exe | bin | 400896 -> 403456 bytes | |||
-rw-r--r-- | 3rdparty/bx/tools/bin2c/bin2c.cpp | 2 |
18 files changed, 316 insertions, 251 deletions
diff --git a/3rdparty/bx/include/bx/allocator.h b/3rdparty/bx/include/bx/allocator.h index 50d526535b6..61356321134 100644 --- a/3rdparty/bx/include/bx/allocator.h +++ b/3rdparty/bx/include/bx/allocator.h @@ -12,10 +12,6 @@ #include <string.h> //::memmove #include <new> -#if BX_CONFIG_ALLOCATOR_CRT -# include <malloc.h> -#endif // BX_CONFIG_ALLOCATOR_CRT - #if BX_CONFIG_ALLOCATOR_DEBUG # define BX_ALLOC(_allocator, _size) bx::alloc(_allocator, _size, 0, __FILE__, __LINE__) # define BX_REALLOC(_allocator, _ptr, _size) bx::realloc(_allocator, _ptr, _size, 0, __FILE__, __LINE__) @@ -145,70 +141,6 @@ namespace bx } } -#if BX_CONFIG_ALLOCATOR_CRT - class CrtAllocator : public AllocatorI - { - public: - CrtAllocator() - { - } - - virtual ~CrtAllocator() - { - } - - virtual void* realloc(void* _ptr, size_t _size, size_t _align, const char* _file, uint32_t _line) BX_OVERRIDE - { - if (0 == _size) - { - if (NULL != _ptr) - { - if (BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT >= _align) - { - ::free(_ptr); - return NULL; - } - -# if BX_COMPILER_MSVC - BX_UNUSED(_file, _line); - _aligned_free(_ptr); -# else - bx::alignedFree(this, _ptr, _align, _file, _line); -# endif // BX_ - } - - return NULL; - } - else if (NULL == _ptr) - { - if (BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT >= _align) - { - return ::malloc(_size); - } - -# if BX_COMPILER_MSVC - BX_UNUSED(_file, _line); - return _aligned_malloc(_size, _align); -# else - return bx::alignedAlloc(this, _size, _align, _file, _line); -# endif // BX_ - } - - if (BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT >= _align) - { - return ::realloc(_ptr, _size); - } - -# if BX_COMPILER_MSVC - BX_UNUSED(_file, _line); - return _aligned_realloc(_ptr, _size, _align); -# else - return bx::alignedRealloc(this, _ptr, _size, _align, _file, _line); -# endif // BX_ - } - }; -#endif // BX_CONFIG_ALLOCATOR_CRT - } // namespace bx #endif // BX_ALLOCATOR_H_HEADER_GUARD diff --git a/3rdparty/bx/include/bx/config.h b/3rdparty/bx/include/bx/config.h index 6b8cfe45a7f..72a6dc3e4af 100644 --- a/3rdparty/bx/include/bx/config.h +++ b/3rdparty/bx/include/bx/config.h @@ -21,19 +21,7 @@ #endif // BX_CONFIG_SPSCQUEUE_USE_MUTEX #ifndef BX_CONFIG_CRT_FILE_READER_WRITER -# define BX_CONFIG_CRT_FILE_READER_WRITER (0 \ - || BX_PLATFORM_ANDROID \ - || BX_PLATFORM_BSD \ - || BX_PLATFORM_EMSCRIPTEN \ - || BX_PLATFORM_IOS \ - || BX_PLATFORM_LINUX \ - || BX_PLATFORM_OSX \ - || BX_PLATFORM_QNX \ - || BX_PLATFORM_RPI \ - || BX_PLATFORM_STEAMLINK \ - || BX_PLATFORM_WINDOWS \ - || BX_PLATFORM_WINRT \ - ? 1 : 0) +# define BX_CONFIG_CRT_FILE_READER_WRITER !(BX_PLATFORM_NACL) #endif // BX_CONFIG_CRT_FILE_READER_WRITER #ifndef BX_CONFIG_SEMAPHORE_PTHREAD diff --git a/3rdparty/bx/include/bx/crtimpl.h b/3rdparty/bx/include/bx/crtimpl.h new file mode 100644 index 00000000000..70cee21d028 --- /dev/null +++ b/3rdparty/bx/include/bx/crtimpl.h @@ -0,0 +1,197 @@ +/* + * Copyright 2010-2016 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bx#license-bsd-2-clause + */ + +#ifndef BX_CRTIMPL_H_HEADER_GUARD +#define BX_CRTIMPL_H_HEADER_GUARD + +#if BX_CONFIG_ALLOCATOR_CRT +# include <malloc.h> +# include "allocator.h" +#endif // BX_CONFIG_ALLOCATOR_CRT + +#if BX_CONFIG_CRT_FILE_READER_WRITER +# include "readerwriter.h" +#endif // BX_CONFIG_CRT_FILE_READER_WRITER + +namespace bx +{ +#if BX_CONFIG_ALLOCATOR_CRT + class CrtAllocator : public AllocatorI + { + public: + CrtAllocator() + { + } + + virtual ~CrtAllocator() + { + } + + virtual void* realloc(void* _ptr, size_t _size, size_t _align, const char* _file, uint32_t _line) BX_OVERRIDE + { + if (0 == _size) + { + if (NULL != _ptr) + { + if (BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT >= _align) + { + ::free(_ptr); + return NULL; + } + +# if BX_COMPILER_MSVC + BX_UNUSED(_file, _line); + _aligned_free(_ptr); +# else + bx::alignedFree(this, _ptr, _align, _file, _line); +# endif // BX_ + } + + return NULL; + } + else if (NULL == _ptr) + { + if (BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT >= _align) + { + return ::malloc(_size); + } + +# if BX_COMPILER_MSVC + BX_UNUSED(_file, _line); + return _aligned_malloc(_size, _align); +# else + return bx::alignedAlloc(this, _size, _align, _file, _line); +# endif // BX_ + } + + if (BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT >= _align) + { + return ::realloc(_ptr, _size); + } + +# if BX_COMPILER_MSVC + BX_UNUSED(_file, _line); + return _aligned_realloc(_ptr, _size, _align); +# else + return bx::alignedRealloc(this, _ptr, _size, _align, _file, _line); +# endif // BX_ + } + }; +#endif // BX_CONFIG_ALLOCATOR_CRT + +#if BX_CONFIG_CRT_FILE_READER_WRITER + class CrtFileReader : public FileReaderI + { + public: + CrtFileReader() + : m_file(NULL) + { + } + + virtual ~CrtFileReader() + { + } + + virtual bool open(const char* _filePath, Error* _err) BX_OVERRIDE + { + BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors."); + + m_file = fopen(_filePath, "rb"); + if (NULL == m_file) + { + BX_ERROR_SET(_err, BX_ERROR_READERWRITER_OPEN, "CrtFileReader: Failed to open file."); + return false; + } + + return true; + } + + virtual void close() BX_OVERRIDE + { + fclose(m_file); + } + + virtual int64_t seek(int64_t _offset = 0, Whence::Enum _whence = Whence::Current) BX_OVERRIDE + { + fseeko64(m_file, _offset, _whence); + return ftello64(m_file); + } + + virtual int32_t read(void* _data, int32_t _size, Error* _err) BX_OVERRIDE + { + BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors."); + + int32_t size = (int32_t)fread(_data, 1, _size, m_file); + if (size != _size) + { + BX_ERROR_SET(_err, BX_ERROR_READERWRITER_READ, "CrtFileReader: read failed."); + return size >= 0 ? size : 0; + } + + return size; + } + + private: + FILE* m_file; + }; + + class CrtFileWriter : public FileWriterI + { + public: + CrtFileWriter() + : m_file(NULL) + { + } + + virtual ~CrtFileWriter() + { + } + + virtual bool open(const char* _filePath, bool _append, Error* _err) BX_OVERRIDE + { + m_file = fopen(_filePath, _append ? "ab" : "wb"); + + if (NULL == m_file) + { + BX_ERROR_SET(_err, BX_ERROR_READERWRITER_OPEN, "CrtFileWriter: Failed to open file."); + return false; + } + + return true; + } + + virtual void close() BX_OVERRIDE + { + fclose(m_file); + } + + virtual int64_t seek(int64_t _offset = 0, Whence::Enum _whence = Whence::Current) BX_OVERRIDE + { + fseeko64(m_file, _offset, _whence); + return ftello64(m_file); + } + + virtual int32_t write(const void* _data, int32_t _size, Error* _err) BX_OVERRIDE + { + BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors."); + + int32_t size = (int32_t)fwrite(_data, 1, _size, m_file); + if (size != _size) + { + BX_ERROR_SET(_err, BX_ERROR_READERWRITER_WRITE, "CrtFileWriter: write failed."); + return size >= 0 ? size : 0; + } + + return size; + } + + private: + FILE* m_file; + }; +#endif // BX_CONFIG_CRT_FILE_READER_WRITER + +} // namespace bx + +#endif // BX_CRTIMPL_H_HEADER_GUARD diff --git a/3rdparty/bx/include/bx/fpumath.h b/3rdparty/bx/include/bx/fpumath.h index be125aa69eb..0dd274feb24 100644 --- a/3rdparty/bx/include/bx/fpumath.h +++ b/3rdparty/bx/include/bx/fpumath.h @@ -607,7 +607,7 @@ namespace bx inline void mtxLookAtLh(float* __restrict _result, const float* __restrict _eye, const float* __restrict _at, const float* __restrict _up = NULL) { float tmp[4]; - vec3Sub(tmp, _eye, _at); + vec3Sub(tmp, _at, _eye); float view[4]; vec3Norm(view, tmp); @@ -618,7 +618,7 @@ namespace bx inline void mtxLookAtRh(float* __restrict _result, const float* __restrict _eye, const float* __restrict _at, const float* __restrict _up = NULL) { float tmp[4]; - vec3Sub(tmp, _at, _eye); + vec3Sub(tmp, _eye, _at); float view[4]; vec3Norm(view, tmp); @@ -628,7 +628,7 @@ namespace bx inline void mtxLookAt(float* __restrict _result, const float* __restrict _eye, const float* __restrict _at, const float* __restrict _up = NULL) { - mtxLookAtRh(_result, _eye, _at, _up); + mtxLookAtLh(_result, _eye, _at, _up); } inline void mtxProjRhXYWH(float* _result, float _x, float _y, float _width, float _height, float _near, float _far, bool _oglNdc = false) @@ -640,19 +640,21 @@ namespace bx memset(_result, 0, sizeof(float)*16); _result[ 0] = _width; _result[ 5] = _height; - _result[ 8] = _x; - _result[ 9] = -_y; - _result[10] = aa; - _result[11] = 1.0f; + _result[ 8] = _x; + _result[ 9] = _y; + _result[10] = -aa; + _result[11] = -1.0f; _result[14] = -bb; } inline void mtxProjRh(float* _result, float _ut, float _dt, float _lt, float _rt, float _near, float _far, bool _oglNdc = false) { - const float width = 2.0f / (_lt + _rt); - const float height = 2.0f / (_ut + _dt); - const float xx = (_lt - _rt) * width * 0.5f; - const float yy = (_ut - _dt) * height * 0.5f; + const float invDiffRl = 1.0f/(_rt - _lt); + const float invDiffUd = 1.0f/(_ut - _dt); + const float width = 2.0f*_near * invDiffRl; + const float height = 2.0f*_near * invDiffUd; + const float xx = (_rt + _lt) * invDiffRl; + const float yy = (_ut + _dt) * invDiffUd; mtxProjRhXYWH(_result, xx, yy, width, height, _near, _far, _oglNdc); } @@ -677,19 +679,21 @@ namespace bx memset(_result, 0, sizeof(float)*16); _result[ 0] = _width; _result[ 5] = _height; - _result[ 8] = _x; + _result[ 8] = -_x; _result[ 9] = -_y; - _result[10] = -aa; - _result[11] = -1.0f; + _result[10] = aa; + _result[11] = 1.0f; _result[14] = -bb; } inline void mtxProjLh(float* _result, float _ut, float _dt, float _lt, float _rt, float _near, float _far, bool _oglNdc = false) { - const float width = 2.0f / (_lt + _rt); - const float height = 2.0f / (_ut + _dt); - const float xx = (_lt - _rt) * width * 0.5f; - const float yy = (_ut - _dt) * height * 0.5f; + const float invDiffRl = 1.0f/(_rt - _lt); + const float invDiffUd = 1.0f/(_ut - _dt); + const float width = 2.0f*_near * invDiffRl; + const float height = 2.0f*_near * invDiffUd; + const float xx = (_rt + _lt) * invDiffRl; + const float yy = (_ut + _dt) * invDiffUd; mtxProjLhXYWH(_result, xx, yy, width, height, _near, _far, _oglNdc); } @@ -707,20 +711,20 @@ namespace bx inline void mtxProj(float* _result, float _ut, float _dt, float _lt, float _rt, float _near, float _far, bool _oglNdc = false) { - mtxProjRh(_result, _ut, _dt, _lt, _rt, _near, _far, _oglNdc); + mtxProjLh(_result, _ut, _dt, _lt, _rt, _near, _far, _oglNdc); } inline void mtxProj(float* _result, const float _fov[4], float _near, float _far, bool _oglNdc = false) { - mtxProjRh(_result, _fov, _near, _far, _oglNdc); + mtxProjLh(_result, _fov, _near, _far, _oglNdc); } inline void mtxProj(float* _result, float _fovy, float _aspect, float _near, float _far, bool _oglNdc = false) { - mtxProjRh(_result, _fovy, _aspect, _near, _far, _oglNdc); + mtxProjLh(_result, _fovy, _aspect, _near, _far, _oglNdc); } - inline void mtxOrtho(float* _result, float _left, float _right, float _bottom, float _top, float _near, float _far, float _offset = 0.0f, bool _oglNdc = false) + inline void mtxOrthoLh(float* _result, float _left, float _right, float _bottom, float _top, float _near, float _far, float _offset = 0.0f, bool _oglNdc = false) { const float aa = 2.0f/(_right - _left); const float bb = 2.0f/(_top - _bottom); @@ -739,6 +743,30 @@ namespace bx _result[15] = 1.0f; } + inline void mtxOrthoRh(float* _result, float _left, float _right, float _bottom, float _top, float _near, float _far, float _offset = 0.0f, bool _oglNdc = false) + { + const float aa = 2.0f/(_right - _left); + const float bb = 2.0f/(_top - _bottom); + const float cc = (_oglNdc ? 2.0f : 1.0f) / (_far - _near); + const float dd = (_left + _right)/(_left - _right); + const float ee = (_top + _bottom)/(_bottom - _top); + const float ff = _oglNdc ? (_near + _far)/(_near - _far) : _near/(_near - _far); + + memset(_result, 0, sizeof(float)*16); + _result[ 0] = aa; + _result[ 5] = bb; + _result[10] = -cc; + _result[12] = dd + _offset; + _result[13] = ee; + _result[14] = ff; + _result[15] = 1.0f; + } + + inline void mtxOrtho(float* _result, float _left, float _right, float _bottom, float _top, float _near, float _far, float _offset = 0.0f, bool _oglNdc = false) + { + return mtxOrthoLh(_result, _left, _right, _bottom, _top, _near, _far, _offset, _oglNdc); + } + inline void mtxRotateX(float* _result, float _ax) { const float sx = fsin(_ax); diff --git a/3rdparty/bx/include/bx/mutex.h b/3rdparty/bx/include/bx/mutex.h index a68525f14cd..b01be030bf4 100644 --- a/3rdparty/bx/include/bx/mutex.h +++ b/3rdparty/bx/include/bx/mutex.h @@ -21,7 +21,7 @@ namespace bx { -#if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_WINRT +#if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT typedef CRITICAL_SECTION pthread_mutex_t; typedef unsigned pthread_mutexattr_t; @@ -70,7 +70,7 @@ namespace bx Mutex() { pthread_mutexattr_t attr; -#if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_WINRT +#if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT #else pthread_mutexattr_init(&attr); pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); diff --git a/3rdparty/bx/include/bx/os.h b/3rdparty/bx/include/bx/os.h index 074ec0e513c..314ef0607cc 100644 --- a/3rdparty/bx/include/bx/os.h +++ b/3rdparty/bx/include/bx/os.h @@ -75,7 +75,7 @@ namespace bx { #if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 ::Sleep(_ms); -#elif BX_PLATFORM_WINRT +#elif BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT BX_UNUSED(_ms); debugOutput("sleep is not implemented"); debugBreak(); #else @@ -91,7 +91,7 @@ namespace bx ::SwitchToThread(); #elif BX_PLATFORM_XBOX360 ::Sleep(0); -#elif BX_PLATFORM_WINRT +#elif BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT debugOutput("yield is not implemented"); debugBreak(); #else ::sched_yield(); @@ -180,6 +180,7 @@ namespace bx #elif BX_PLATFORM_EMSCRIPTEN \ || BX_PLATFORM_NACL \ || BX_PLATFORM_PS4 \ + || BX_PLATFORM_XBOXONE \ || BX_PLATFORM_WINRT BX_UNUSED(_filePath); return NULL; @@ -195,6 +196,7 @@ namespace bx #elif BX_PLATFORM_EMSCRIPTEN \ || BX_PLATFORM_NACL \ || BX_PLATFORM_PS4 \ + || BX_PLATFORM_XBOXONE \ || BX_PLATFORM_WINRT BX_UNUSED(_handle); #else @@ -209,6 +211,7 @@ namespace bx #elif BX_PLATFORM_EMSCRIPTEN \ || BX_PLATFORM_NACL \ || BX_PLATFORM_PS4 \ + || BX_PLATFORM_XBOXONE \ || BX_PLATFORM_WINRT BX_UNUSED(_handle, _symbol); return NULL; @@ -222,6 +225,7 @@ namespace bx #if BX_PLATFORM_WINDOWS ::SetEnvironmentVariableA(_name, _value); #elif BX_PLATFORM_PS4 \ + || BX_PLATFORM_XBOXONE \ || BX_PLATFORM_WINRT BX_UNUSED(_name, _value); #else @@ -234,6 +238,7 @@ namespace bx #if BX_PLATFORM_WINDOWS ::SetEnvironmentVariableA(_name, NULL); #elif BX_PLATFORM_PS4 \ + || BX_PLATFORM_XBOXONE \ || BX_PLATFORM_WINRT BX_UNUSED(_name); #else @@ -244,6 +249,7 @@ namespace bx inline int chdir(const char* _path) { #if BX_PLATFORM_PS4 \ + || BX_PLATFORM_XBOXONE \ || BX_PLATFORM_WINRT BX_UNUSED(_path); return -1; @@ -257,6 +263,7 @@ namespace bx inline char* pwd(char* _buffer, uint32_t _size) { #if BX_PLATFORM_PS4 \ + || BX_PLATFORM_XBOXONE \ || BX_PLATFORM_WINRT BX_UNUSED(_buffer, _size); return NULL; diff --git a/3rdparty/bx/include/bx/platform.h b/3rdparty/bx/include/bx/platform.h index 3f245d5dff9..d07e031de34 100644 --- a/3rdparty/bx/include/bx/platform.h +++ b/3rdparty/bx/include/bx/platform.h @@ -123,7 +123,7 @@ #if defined(_XBOX_VER) # undef BX_PLATFORM_XBOX360 # define BX_PLATFORM_XBOX360 1 -#elif defined (_DURANGO) +#elif defined(_DURANGO) || defined(_XBOX_ONE) # undef BX_PLATFORM_XBOXONE # define BX_PLATFORM_XBOXONE 1 #elif defined(_WIN32) || defined(_WIN64) diff --git a/3rdparty/bx/include/bx/radixsort.h b/3rdparty/bx/include/bx/radixsort.h index 8118a0aa0bf..d14398cacc8 100644 --- a/3rdparty/bx/include/bx/radixsort.h +++ b/3rdparty/bx/include/bx/radixsort.h @@ -14,7 +14,7 @@ namespace bx #define BX_RADIXSORT_HISTOGRAM_SIZE (1<<BX_RADIXSORT_BITS) #define BX_RADIXSORT_BIT_MASK (BX_RADIXSORT_HISTOGRAM_SIZE-1) - inline void radixSort32(uint32_t* __restrict _keys, uint32_t* __restrict _tempKeys, uint32_t _size) + inline void radixSort(uint32_t* __restrict _keys, uint32_t* __restrict _tempKeys, uint32_t _size) { uint32_t* __restrict keys = _keys; uint32_t* __restrict tempKeys = _tempKeys; @@ -76,7 +76,7 @@ done: } template <typename Ty> - inline void radixSort32(uint32_t* __restrict _keys, uint32_t* __restrict _tempKeys, Ty* __restrict _values, Ty* __restrict _tempValues, uint32_t _size) + inline void radixSort(uint32_t* __restrict _keys, uint32_t* __restrict _tempKeys, Ty* __restrict _values, Ty* __restrict _tempValues, uint32_t _size) { uint32_t* __restrict keys = _keys; uint32_t* __restrict tempKeys = _tempKeys; @@ -148,7 +148,7 @@ done: } } - inline void radixSort64(uint64_t* __restrict _keys, uint64_t* __restrict _tempKeys, uint32_t _size) + inline void radixSort(uint64_t* __restrict _keys, uint64_t* __restrict _tempKeys, uint32_t _size) { uint64_t* __restrict keys = _keys; uint64_t* __restrict tempKeys = _tempKeys; @@ -210,7 +210,7 @@ done: } template <typename Ty> - inline void radixSort64(uint64_t* __restrict _keys, uint64_t* __restrict _tempKeys, Ty* __restrict _values, Ty* __restrict _tempValues, uint32_t _size) + inline void radixSort(uint64_t* __restrict _keys, uint64_t* __restrict _tempKeys, Ty* __restrict _values, Ty* __restrict _tempValues, uint32_t _size) { uint64_t* __restrict keys = _keys; uint64_t* __restrict tempKeys = _tempKeys; diff --git a/3rdparty/bx/include/bx/readerwriter.h b/3rdparty/bx/include/bx/readerwriter.h index ef8c810a870..13fe205399e 100644 --- a/3rdparty/bx/include/bx/readerwriter.h +++ b/3rdparty/bx/include/bx/readerwriter.h @@ -6,6 +6,7 @@ #ifndef BX_READERWRITER_H_HEADER_GUARD #define BX_READERWRITER_H_HEADER_GUARD +#include <alloca.h> #include <stdarg.h> // va_list #include <stdio.h> #include <string.h> @@ -359,8 +360,8 @@ namespace bx m_top += morecore; } - int64_t reminder = m_top-m_pos; - int32_t size = uint32_min(_size, int32_t(reminder > INT32_MAX ? INT32_MAX : reminder) ); + int64_t remainder = m_top-m_pos; + int32_t size = uint32_min(_size, int32_t(remainder > INT32_MAX ? INT32_MAX : remainder) ); m_pos += size; if (size != _size) { @@ -412,8 +413,8 @@ namespace bx { BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors."); - int64_t reminder = m_top-m_pos; - int32_t size = uint32_min(_size, int32_t(reminder > INT32_MAX ? INT32_MAX : reminder) ); + int64_t remainder = m_top-m_pos; + int32_t size = uint32_min(_size, int32_t(remainder > INT32_MAX ? INT32_MAX : remainder) ); memcpy(_data, &m_data[m_pos], size); m_pos += size; if (size != _size) @@ -493,8 +494,8 @@ namespace bx m_size = m_memBlock->getSize(); } - int64_t reminder = m_size-m_pos; - int32_t size = uint32_min(_size, int32_t(reminder > INT32_MAX ? INT32_MAX : reminder) ); + int64_t remainder = m_size-m_pos; + int32_t size = uint32_min(_size, int32_t(remainder > INT32_MAX ? INT32_MAX : remainder) ); memcpy(&m_data[m_pos], _data, size); m_pos += size; m_top = int64_max(m_top, m_pos); @@ -530,117 +531,6 @@ namespace bx StaticMemoryBlock m_smb; }; -#if BX_CONFIG_CRT_FILE_READER_WRITER - class CrtFileReader : public FileReaderI - { - public: - CrtFileReader() - : m_file(NULL) - { - } - - virtual ~CrtFileReader() - { - } - - virtual bool open(const char* _filePath, Error* _err) BX_OVERRIDE - { - BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors."); - - m_file = fopen(_filePath, "rb"); - if (NULL == m_file) - { - BX_ERROR_SET(_err, BX_ERROR_READERWRITER_OPEN, "CrtFileReader: Failed to open file."); - return false; - } - - return true; - } - - virtual void close() BX_OVERRIDE - { - fclose(m_file); - } - - virtual int64_t seek(int64_t _offset = 0, Whence::Enum _whence = Whence::Current) BX_OVERRIDE - { - fseeko64(m_file, _offset, _whence); - return ftello64(m_file); - } - - virtual int32_t read(void* _data, int32_t _size, Error* _err) BX_OVERRIDE - { - BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors."); - - int32_t size = (int32_t)fread(_data, 1, _size, m_file); - if (size != _size) - { - BX_ERROR_SET(_err, BX_ERROR_READERWRITER_READ, "CrtFileReader: read failed."); - return size >= 0 ? size : 0; - } - - return size; - } - - private: - FILE* m_file; - }; - - class CrtFileWriter : public FileWriterI - { - public: - CrtFileWriter() - : m_file(NULL) - { - } - - virtual ~CrtFileWriter() - { - } - - virtual bool open(const char* _filePath, bool _append, Error* _err) BX_OVERRIDE - { - m_file = fopen(_filePath, _append ? "ab" : "wb"); - - if (NULL == m_file) - { - BX_ERROR_SET(_err, BX_ERROR_READERWRITER_OPEN, "CrtFileWriter: Failed to open file."); - return false; - } - - return true; - } - - virtual void close() BX_OVERRIDE - { - fclose(m_file); - } - - virtual int64_t seek(int64_t _offset = 0, Whence::Enum _whence = Whence::Current) BX_OVERRIDE - { - fseeko64(m_file, _offset, _whence); - return ftello64(m_file); - } - - virtual int32_t write(const void* _data, int32_t _size, Error* _err) BX_OVERRIDE - { - BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors."); - - int32_t size = (int32_t)fwrite(_data, 1, _size, m_file); - if (size != _size) - { - BX_ERROR_SET(_err, BX_ERROR_READERWRITER_WRITE, "CrtFileWriter: write failed."); - return size >= 0 ? size : 0; - } - - return size; - } - - private: - FILE* m_file; - }; -#endif // BX_CONFIG_CRT_FILE_READER_WRITER - } // namespace bx #endif // BX_READERWRITER_H_HEADER_GUARD diff --git a/3rdparty/bx/include/bx/sem.h b/3rdparty/bx/include/bx/sem.h index 85c66168d58..37141c53614 100644 --- a/3rdparty/bx/include/bx/sem.h +++ b/3rdparty/bx/include/bx/sem.h @@ -16,7 +16,9 @@ # include <semaphore.h> # include <time.h> # include <pthread.h> -#elif BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_WINRT +#elif BX_PLATFORM_XBOXONE +# include <synchapi.h> +#elif BX_PLATFORM_XBOX360 || BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT # include <windows.h> # include <limits.h> #endif // BX_PLATFORM_ @@ -211,7 +213,7 @@ namespace bx }; # endif // BX_CONFIG_SEMAPHORE_PTHREAD -#elif BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_WINRT +#elif BX_PLATFORM_XBOX360 || BX_PLATFORM_XBOXONE || BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT class Semaphore { @@ -223,10 +225,10 @@ namespace bx public: Semaphore() { -#if BX_PLATFORM_WINRT - m_handle = CreateSemaphoreEx(NULL, 0, LONG_MAX, NULL, 0, SEMAPHORE_ALL_ACCESS); +#if BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT + m_handle = CreateSemaphoreExW(NULL, 0, LONG_MAX, NULL, 0, SEMAPHORE_ALL_ACCESS); #else - m_handle = CreateSemaphore(NULL, 0, LONG_MAX, NULL); + m_handle = CreateSemaphoreA(NULL, 0, LONG_MAX, NULL); #endif BX_CHECK(NULL != m_handle, "Failed to create Semaphore!"); } @@ -244,7 +246,7 @@ namespace bx bool wait(int32_t _msecs = -1) const { DWORD milliseconds = (0 > _msecs) ? INFINITE : _msecs; -#if BX_PLATFORM_WINRT +#if BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT return WAIT_OBJECT_0 == WaitForSingleObjectEx(m_handle, milliseconds, FALSE); #else return WAIT_OBJECT_0 == WaitForSingleObject(m_handle, milliseconds); diff --git a/3rdparty/bx/include/bx/thread.h b/3rdparty/bx/include/bx/thread.h index 015bd57eff8..5e3a920c1ce 100644 --- a/3rdparty/bx/include/bx/thread.h +++ b/3rdparty/bx/include/bx/thread.h @@ -34,7 +34,7 @@ namespace bx public: Thread() -#if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_WINRT +#if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT : m_handle(INVALID_HANDLE_VALUE) , m_threadId(UINT32_MAX) #elif BX_PLATFORM_POSIX @@ -224,7 +224,7 @@ namespace bx } #endif // BX_PLATFORM_ -#if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_WINRT +#if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT HANDLE m_handle; DWORD m_threadId; #elif BX_PLATFORM_POSIX @@ -269,7 +269,7 @@ namespace bx uint32_t m_id; }; -#elif !BX_PLATFORM_WINRT +#elif !(BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT) class TlsData { diff --git a/3rdparty/bx/include/bx/timer.h b/3rdparty/bx/include/bx/timer.h index c3d16d29793..462d9757a60 100644 --- a/3rdparty/bx/include/bx/timer.h +++ b/3rdparty/bx/include/bx/timer.h @@ -12,7 +12,7 @@ # include <time.h> // clock, clock_gettime #elif BX_PLATFORM_EMSCRIPTEN # include <emscripten.h> -#elif BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT +#elif BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT # include <windows.h> #else # include <sys/time.h> // gettimeofday @@ -22,7 +22,7 @@ namespace bx { inline int64_t getHPCounter() { -#if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_WINRT +#if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT LARGE_INTEGER li; // Performance counter value may unexpectedly leap forward // http://support.microsoft.com/kb/274323 @@ -44,7 +44,7 @@ namespace bx inline int64_t getHPFrequency() { -#if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_WINRT +#if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT LARGE_INTEGER li; QueryPerformanceFrequency(&li); return li.QuadPart; diff --git a/3rdparty/bx/include/bx/uint32_t.h b/3rdparty/bx/include/bx/uint32_t.h index 411ac28ee6b..50f8e097a22 100644 --- a/3rdparty/bx/include/bx/uint32_t.h +++ b/3rdparty/bx/include/bx/uint32_t.h @@ -29,7 +29,7 @@ #include "bx.h" #if BX_COMPILER_MSVC -# if BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT +# if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT # include <math.h> // math.h is included because VS bitches: // warning C4985: 'ceil': attributes not present on previous declaration. // must be included before intrin.h. diff --git a/3rdparty/bx/scripts/toolchain.lua b/3rdparty/bx/scripts/toolchain.lua index fc674de9570..0cabfae5a9d 100644 --- a/3rdparty/bx/scripts/toolchain.lua +++ b/3rdparty/bx/scripts/toolchain.lua @@ -18,14 +18,14 @@ function toolchain(_buildDir, _libDir) { "android-x86", "Android - x86" }, { "asmjs", "Emscripten/asm.js" }, { "freebsd", "FreeBSD" }, + { "ios-arm", "iOS - ARM" }, + { "ios-simulator", "iOS - Simulator" }, { "linux-gcc", "Linux (GCC compiler)" }, { "linux-gcc-5", "Linux (GCC-5 compiler)" }, { "linux-clang", "Linux (Clang compiler)" }, { "linux-mips-gcc", "Linux (MIPS, GCC compiler)" }, { "linux-arm-gcc", "Linux (ARM, GCC compiler)" }, { "linux-steamlink", "Steam Link" }, - { "ios-arm", "iOS - ARM" }, - { "ios-simulator", "iOS - Simulator" }, { "tvos-arm64", "tvOS - ARM64" }, { "tvos-simulator", "tvOS - Simulator" }, { "mingw-gcc", "MinGW" }, @@ -54,6 +54,7 @@ function toolchain(_buildDir, _libDir) { "winphone81", "Windows Phone 8.1" }, { "winstore81", "Windows Store 8.1" }, { "winstore82", "Universal Windows App" }, + { "durango", "Durango" }, }, } @@ -363,18 +364,28 @@ function toolchain(_buildDir, _libDir) platforms { "ARM" } location (path.join(_buildDir, "projects", _ACTION .. "-winstore82")) + elseif "durango" == _OPTIONS["vs"] then + if not os.getenv("DurangoXDK") then + print("DurangoXDK not found.") + end + + premake.vstudio.toolset = "v140" + premake.vstudio.storeapp = "durango" + platforms { "Durango" } + location (path.join(_buildDir, "projects", _ACTION .. "-durango")) + end + elseif ("vs2012-xp") == _OPTIONS["vs"] then premake.vstudio.toolset = ("v110_xp") location (path.join(_buildDir, "projects", _ACTION .. "-xp")) - elseif ("vs2013-xp") == _OPTIONS["vs"] then + elseif "vs2013-xp" == _OPTIONS["vs"] then premake.vstudio.toolset = ("v120_xp") location (path.join(_buildDir, "projects", _ACTION .. "-xp")) - elseif ("vs2015-xp") == _OPTIONS["vs"] then + elseif "vs2015-xp" == _OPTIONS["vs"] then premake.vstudio.toolset = ("v140_xp") location (path.join(_buildDir, "projects", _ACTION .. "-xp")) - end elseif _ACTION == "xcode4" then @@ -664,6 +675,7 @@ function toolchain(_buildDir, _libDir) } configuration { "android-*" } + targetprefix ("lib") flags { "NoImportLib", } @@ -800,7 +812,7 @@ function toolchain(_buildDir, _libDir) linkoptions { "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86"), path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86/usr/lib/crtbegin_so.o"), - path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "/arch-x86/usr/lib/crtend_so.o"), + path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86/usr/lib/crtend_so.o"), } configuration { "asmjs" } @@ -899,14 +911,23 @@ function toolchain(_buildDir, _libDir) configuration { "pnacl", "Release" } libdirs { "$(NACL_SDK_ROOT)/lib/pnacl/Release" } - configuration { "Xbox360" } + configuration { "xbox360" } targetdir (path.join(_buildDir, "xbox360/bin")) objdir (path.join(_buildDir, "xbox360/obj")) includedirs { path.join(bxDir, "include/compat/msvc") } libdirs { path.join(_libDir, "lib/xbox360") } defines { "NOMINMAX", - "_XBOX", + } + + configuration { "durango" } + targetdir (path.join(_buildDir, "durango/bin")) + objdir (path.join(_buildDir, "durango/obj")) + includedirs { path.join(bxDir, "include/compat/msvc") } + libdirs { path.join(_libDir, "lib/durango") } + removeflags { "StaticRuntime" } + defines { + "NOMINMAX", } configuration { "osx", "x32" } diff --git a/3rdparty/bx/tools/bin/darwin/genie b/3rdparty/bx/tools/bin/darwin/genie Binary files differindex a7c61b7300e..9113b07986b 100644 --- a/3rdparty/bx/tools/bin/darwin/genie +++ b/3rdparty/bx/tools/bin/darwin/genie diff --git a/3rdparty/bx/tools/bin/linux/genie b/3rdparty/bx/tools/bin/linux/genie Binary files differindex 223ef23852e..c7be887f7d6 100644 --- a/3rdparty/bx/tools/bin/linux/genie +++ b/3rdparty/bx/tools/bin/linux/genie diff --git a/3rdparty/bx/tools/bin/windows/genie.exe b/3rdparty/bx/tools/bin/windows/genie.exe Binary files differindex 59575ce272e..fb46691d96f 100644 --- a/3rdparty/bx/tools/bin/windows/genie.exe +++ b/3rdparty/bx/tools/bin/windows/genie.exe diff --git a/3rdparty/bx/tools/bin2c/bin2c.cpp b/3rdparty/bx/tools/bin2c/bin2c.cpp index bdb92a4c04f..8aa1b9f9142 100644 --- a/3rdparty/bx/tools/bin2c/bin2c.cpp +++ b/3rdparty/bx/tools/bin2c/bin2c.cpp @@ -7,7 +7,7 @@ #include <vector> #include <bx/commandline.h> -#include <bx/readerwriter.h> +#include <bx/crtimpl.h> #include <bx/string.h> class Bin2cWriter : public bx::WriterI |