summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bx
diff options
context:
space:
mode:
author Branimir Karadžić <branimirkaradzic@gmail.com>2016-03-31 20:39:30 +0200
committer Miodrag Milanovic <mmicko@gmail.com>2016-03-31 20:39:30 +0200
commit4172b54d844e4c1ff5626a8f22bf3f56e6c9dd94 (patch)
tree7592d25c86fc8beebbe2c26e56cdb71f45f96641 /3rdparty/bx
parent5c34b1ba40a348a8f941423724acbf2a4b0feb8b (diff)
Update BGFX and BX (nw)
Diffstat (limited to '3rdparty/bx')
-rw-r--r--3rdparty/bx/3rdparty/UnitTest++/src/Config.h3
-rw-r--r--3rdparty/bx/include/bx/config.h9
-rw-r--r--3rdparty/bx/include/bx/crtimpl.h111
-rw-r--r--3rdparty/bx/include/bx/fpumath.h238
-rw-r--r--3rdparty/bx/include/bx/platform.h34
-rw-r--r--3rdparty/bx/include/bx/readerwriter.h43
-rw-r--r--3rdparty/bx/scripts/toolchain.lua20
-rw-r--r--3rdparty/bx/scripts/unittest++.lua2
-rw-r--r--3rdparty/bx/tools/bin/darwin/geniebin422176 -> 438560 bytes
-rw-r--r--3rdparty/bx/tools/bin/darwin/ninjabin0 -> 171356 bytes
-rw-r--r--3rdparty/bx/tools/bin/linux/geniebin396856 -> 413240 bytes
-rw-r--r--3rdparty/bx/tools/bin/linux/ninjabin0 -> 166960 bytes
-rw-r--r--3rdparty/bx/tools/bin/windows/genie.exebin403456 -> 416256 bytes
-rw-r--r--3rdparty/bx/tools/bin/windows/ninja.exebin0 -> 310272 bytes
14 files changed, 383 insertions, 77 deletions
diff --git a/3rdparty/bx/3rdparty/UnitTest++/src/Config.h b/3rdparty/bx/3rdparty/UnitTest++/src/Config.h
index 5deeb277156..200833e9eae 100644
--- a/3rdparty/bx/3rdparty/UnitTest++/src/Config.h
+++ b/3rdparty/bx/3rdparty/UnitTest++/src/Config.h
@@ -22,7 +22,8 @@
|| defined(__NetBSD__) \
|| defined(__OpenBSD__) \
|| defined(__FreeBSD__) \
- || defined(__native_client__)
+ || defined(__native_client__) \
+ || defined(__riscv)
# define UNITTEST_POSIX
#endif
diff --git a/3rdparty/bx/include/bx/config.h b/3rdparty/bx/include/bx/config.h
index 72a6dc3e4af..59917706b43 100644
--- a/3rdparty/bx/include/bx/config.h
+++ b/3rdparty/bx/include/bx/config.h
@@ -24,6 +24,15 @@
# define BX_CONFIG_CRT_FILE_READER_WRITER !(BX_PLATFORM_NACL)
#endif // BX_CONFIG_CRT_FILE_READER_WRITER
+#ifndef BX_CONFIG_CRT_PROCESS
+# define BX_CONFIG_CRT_PROCESS !(0 \
+ || BX_PLATFORM_EMSCRIPTEN \
+ || BX_PLATFORM_NACL \
+ || BX_PLATFORM_WINRT \
+ || BX_PLATFORM_XBOXONE \
+ )
+#endif // BX_CONFIG_CRT_PROCESS
+
#ifndef BX_CONFIG_SEMAPHORE_PTHREAD
# define BX_CONFIG_SEMAPHORE_PTHREAD (BX_PLATFORM_OSX || BX_PLATFORM_IOS)
#endif // BX_CONFIG_SEMAPHORE_PTHREAD
diff --git a/3rdparty/bx/include/bx/crtimpl.h b/3rdparty/bx/include/bx/crtimpl.h
index 70cee21d028..a4820334ee3 100644
--- a/3rdparty/bx/include/bx/crtimpl.h
+++ b/3rdparty/bx/include/bx/crtimpl.h
@@ -192,6 +192,117 @@ namespace bx
};
#endif // BX_CONFIG_CRT_FILE_READER_WRITER
+#if BX_CONFIG_CRT_PROCESS
+
+#if BX_COMPILER_MSVC_COMPATIBLE
+# define popen _popen
+# define pclose _pclose
+#endif // BX_COMPILER_MSVC_COMPATIBLE
+
+ class ProcessReader : public ReaderOpenI, public CloserI, public ReaderI
+ {
+ public:
+ ProcessReader()
+ : m_file(NULL)
+ {
+ }
+
+ ~ProcessReader()
+ {
+ BX_CHECK(NULL == m_file, "Process not closed!");
+ }
+
+ virtual bool open(const char* _command, Error* _err) BX_OVERRIDE
+ {
+ BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
+
+ m_file = popen(_command, "r");
+ if (NULL == m_file)
+ {
+ BX_ERROR_SET(_err, BX_ERROR_READERWRITER_OPEN, "ProcessReader: Failed to open process.");
+ return false;
+ }
+
+ return true;
+ }
+
+ virtual void close() BX_OVERRIDE
+ {
+ BX_CHECK(NULL != m_file, "Process not open!");
+ pclose(m_file);
+ m_file = NULL;
+ }
+
+ 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."); BX_UNUSED(_err);
+
+ int32_t size = (int32_t)fread(_data, 1, _size, m_file);
+ if (size != _size)
+ {
+ return size >= 0 ? size : 0;
+ }
+
+ return size;
+ }
+
+ private:
+ FILE* m_file;
+ };
+
+ class ProcessWriter : public WriterOpenI, public CloserI, public WriterI
+ {
+ public:
+ ProcessWriter()
+ : m_file(NULL)
+ {
+ }
+
+ ~ProcessWriter()
+ {
+ BX_CHECK(NULL == m_file, "Process not closed!");
+ }
+
+ virtual bool open(const char* _command, bool, Error* _err) BX_OVERRIDE
+ {
+ BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
+
+ m_file = popen(_command, "w");
+ if (NULL == m_file)
+ {
+ BX_ERROR_SET(_err, BX_ERROR_READERWRITER_OPEN, "ProcessWriter: Failed to open process.");
+ return false;
+ }
+
+ return true;
+ }
+
+ virtual void close() BX_OVERRIDE
+ {
+ BX_CHECK(NULL != m_file, "Process not open!");
+ pclose(m_file);
+ m_file = NULL;
+ }
+
+ 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."); BX_UNUSED(_err);
+
+ int32_t size = (int32_t)fwrite(_data, 1, _size, m_file);
+ if (size != _size)
+ {
+ return size >= 0 ? size : 0;
+ }
+
+ return size;
+ }
+
+ private:
+ FILE* m_file;
+ };
+
+#endif // BX_CONFIG_CRT_PROCESS
+
} // 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 0dd274feb24..2335ad4f2f3 100644
--- a/3rdparty/bx/include/bx/fpumath.h
+++ b/3rdparty/bx/include/bx/fpumath.h
@@ -14,10 +14,28 @@
namespace bx
{
- static const float pi = 3.14159265358979323846f;
- static const float invPi = 1.0f/3.14159265358979323846f;
- static const float piHalf = 1.57079632679489661923f;
- static const float sqrt2 = 1.41421356237309504880f;
+ static const float pi = 3.14159265358979323846f;
+ static const float invPi = 1.0f/3.14159265358979323846f;
+ static const float piHalf = 1.57079632679489661923f;
+ static const float sqrt2 = 1.41421356237309504880f;
+
+ struct Handness
+ {
+ enum Enum
+ {
+ Left,
+ Right,
+ };
+ };
+
+ struct NearFar
+ {
+ enum Enum
+ {
+ Default,
+ Reverse,
+ };
+ };
inline float toRad(float _deg)
{
@@ -631,7 +649,8 @@ namespace bx
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)
+ template <Handness::Enum HandnessT>
+ inline void mtxProjXYWH(float* _result, float _x, float _y, float _width, float _height, float _near, float _far, bool _oglNdc = false)
{
const float diff = _far-_near;
const float aa = _oglNdc ? (_far+_near)/diff : _far/diff;
@@ -640,14 +659,15 @@ 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] = (Handness::Right == HandnessT) ? _x : -_x;
+ _result[ 9] = (Handness::Right == HandnessT) ? _y : -_y;
+ _result[10] = (Handness::Right == HandnessT) ? -aa : aa;
+ _result[11] = (Handness::Right == HandnessT) ? -1.0f : 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)
+ template <Handness::Enum HandnessT>
+ inline void mtxProj_impl(float* _result, float _ut, float _dt, float _lt, float _rt, float _near, float _far, bool _oglNdc = false)
{
const float invDiffRl = 1.0f/(_rt - _lt);
const float invDiffUd = 1.0f/(_ut - _dt);
@@ -655,38 +675,96 @@ namespace bx
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);
+ mtxProjXYWH<HandnessT>(_result, xx, yy, width, height, _near, _far, _oglNdc);
}
- inline void mtxProjRh(float* _result, const float _fov[4], float _near, float _far, bool _oglNdc = false)
+ template <Handness::Enum HandnessT>
+ inline void mtxProj_impl(float* _result, const float _fov[4], float _near, float _far, bool _oglNdc = false)
{
- mtxProjRh(_result, _fov[0], _fov[1], _fov[2], _fov[3], _near, _far, _oglNdc);
+ mtxProj_impl<HandnessT>(_result, _fov[0], _fov[1], _fov[2], _fov[3], _near, _far, _oglNdc);
}
- inline void mtxProjRh(float* _result, float _fovy, float _aspect, float _near, float _far, bool _oglNdc = false)
+ template <Handness::Enum HandnessT>
+ inline void mtxProj_impl(float* _result, float _fovy, float _aspect, float _near, float _far, bool _oglNdc = false)
{
const float height = 1.0f/tanf(toRad(_fovy)*0.5f);
const float width = height * 1.0f/_aspect;
- mtxProjRhXYWH(_result, 0.0f, 0.0f, width, height, _near, _far, _oglNdc);
+ mtxProjXYWH<HandnessT>(_result, 0.0f, 0.0f, width, height, _near, _far, _oglNdc);
}
- inline void mtxProjLhXYWH(float* _result, float _x, float _y, float _width, float _height, float _near, float _far, bool _oglNdc = false)
+ inline void mtxProj(float* _result, float _ut, float _dt, float _lt, float _rt, float _near, float _far, bool _oglNdc = false)
{
- const float diff = _far-_near;
- const float aa = _oglNdc ? (_far+_near)/diff : _far/diff;
- const float bb = _oglNdc ? (2.0f*_far*_near)/diff : _near*aa;
+ mtxProj_impl<Handness::Left>(_result, _ut, _dt, _lt, _rt, _near, _far, _oglNdc);
+ }
+
+ inline void mtxProj(float* _result, const float _fov[4], float _near, float _far, bool _oglNdc = false)
+ {
+ mtxProj_impl<Handness::Left>(_result, _fov, _near, _far, _oglNdc);
+ }
+
+ inline void mtxProj(float* _result, float _fovy, float _aspect, float _near, float _far, bool _oglNdc = false)
+ {
+ mtxProj_impl<Handness::Left>(_result, _fovy, _aspect, _near, _far, _oglNdc);
+ }
+
+ inline void mtxProjLh(float* _result, float _ut, float _dt, float _lt, float _rt, float _near, float _far, bool _oglNdc = false)
+ {
+ mtxProj_impl<Handness::Left>(_result, _ut, _dt, _lt, _rt, _near, _far, _oglNdc);
+ }
+
+ inline void mtxProjLh(float* _result, const float _fov[4], float _near, float _far, bool _oglNdc = false)
+ {
+ mtxProj_impl<Handness::Left>(_result, _fov, _near, _far, _oglNdc);
+ }
+
+ inline void mtxProjLh(float* _result, float _fovy, float _aspect, float _near, float _far, bool _oglNdc = false)
+ {
+ mtxProj_impl<Handness::Left>(_result, _fovy, _aspect, _near, _far, _oglNdc);
+ }
+
+ inline void mtxProjRh(float* _result, float _ut, float _dt, float _lt, float _rt, float _near, float _far, bool _oglNdc = false)
+ {
+ mtxProj_impl<Handness::Right>(_result, _ut, _dt, _lt, _rt, _near, _far, _oglNdc);
+ }
+
+ inline void mtxProjRh(float* _result, const float _fov[4], float _near, float _far, bool _oglNdc = false)
+ {
+ mtxProj_impl<Handness::Right>(_result, _fov, _near, _far, _oglNdc);
+ }
+
+ inline void mtxProjRh(float* _result, float _fovy, float _aspect, float _near, float _far, bool _oglNdc = false)
+ {
+ mtxProj_impl<Handness::Right>(_result, _fovy, _aspect, _near, _far, _oglNdc);
+ }
+
+ template <NearFar::Enum NearFarT, Handness::Enum HandnessT>
+ inline void mtxProjInfXYWH(float* _result, float _x, float _y, float _width, float _height, float _near, bool _oglNdc = false)
+ {
+ float aa;
+ float bb;
+ if (BX_ENABLED(NearFar::Reverse == NearFarT) )
+ {
+ aa = _oglNdc ? -1.0f : 0.0f;
+ bb = _oglNdc ? -2.0f*_near : -_near;
+ }
+ else
+ {
+ aa = 1.0f;
+ bb = _oglNdc ? 2.0f*_near : _near;
+ }
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] = (Handness::Right == HandnessT) ? _x : -_x;
+ _result[ 9] = (Handness::Right == HandnessT) ? _y : -_y;
+ _result[10] = (Handness::Right == HandnessT) ? -aa : aa;
+ _result[11] = (Handness::Right == HandnessT) ? -1.0f : 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)
+ template <NearFar::Enum NearFarT, Handness::Enum HandnessT>
+ inline void mtxProjInf_impl(float* _result, float _ut, float _dt, float _lt, float _rt, float _near, bool _oglNdc = false)
{
const float invDiffRl = 1.0f/(_rt - _lt);
const float invDiffUd = 1.0f/(_ut - _dt);
@@ -694,56 +772,100 @@ namespace bx
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);
+ mtxProjInfXYWH<NearFarT,HandnessT>(_result, xx, yy, width, height, _near, _oglNdc);
}
- inline void mtxProjLh(float* _result, const float _fov[4], float _near, float _far, bool _oglNdc = false)
+ template <NearFar::Enum NearFarT, Handness::Enum HandnessT>
+ inline void mtxProjInf_impl(float* _result, const float _fov[4], float _near, bool _oglNdc = false)
{
- mtxProjLh(_result, _fov[0], _fov[1], _fov[2], _fov[3], _near, _far, _oglNdc);
+ mtxProjInf_impl<NearFarT,HandnessT>(_result, _fov[0], _fov[1], _fov[2], _fov[3], _near, _oglNdc);
}
- inline void mtxProjLh(float* _result, float _fovy, float _aspect, float _near, float _far, bool _oglNdc = false)
+ template <NearFar::Enum NearFarT, Handness::Enum HandnessT>
+ inline void mtxProjInf_impl(float* _result, float _fovy, float _aspect, float _near, bool _oglNdc = false)
{
const float height = 1.0f/tanf(toRad(_fovy)*0.5f);
const float width = height * 1.0f/_aspect;
- mtxProjLhXYWH(_result, 0.0f, 0.0f, width, height, _near, _far, _oglNdc);
+ mtxProjInfXYWH<NearFarT,HandnessT>(_result, 0.0f, 0.0f, width, height, _near, _oglNdc);
}
- inline void mtxProj(float* _result, float _ut, float _dt, float _lt, float _rt, float _near, float _far, bool _oglNdc = false)
+ inline void mtxProjInf(float* _result, const float _fov[4], float _near, bool _oglNdc = false)
{
- mtxProjLh(_result, _ut, _dt, _lt, _rt, _near, _far, _oglNdc);
+ mtxProjInf_impl<NearFar::Default,Handness::Left>(_result, _fov, _near, _oglNdc);
}
- inline void mtxProj(float* _result, const float _fov[4], float _near, float _far, bool _oglNdc = false)
+ inline void mtxProjInf(float* _result, float _ut, float _dt, float _lt, float _rt, float _near, bool _oglNdc = false)
{
- mtxProjLh(_result, _fov, _near, _far, _oglNdc);
+ mtxProjInf_impl<NearFar::Default,Handness::Left>(_result, _ut, _dt, _lt, _rt, _near, _oglNdc);
}
- inline void mtxProj(float* _result, float _fovy, float _aspect, float _near, float _far, bool _oglNdc = false)
+ inline void mtxProjInf(float* _result, float _fovy, float _aspect, float _near, bool _oglNdc = false)
{
- mtxProjLh(_result, _fovy, _aspect, _near, _far, _oglNdc);
+ mtxProjInf_impl<NearFar::Default,Handness::Left>(_result, _fovy, _aspect, _near, _oglNdc);
}
- inline void mtxOrthoLh(float* _result, float _left, float _right, float _bottom, float _top, float _near, float _far, float _offset = 0.0f, bool _oglNdc = false)
+ inline void mtxProjInfLh(float* _result, float _ut, float _dt, float _lt, float _rt, float _near, 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);
+ mtxProjInf_impl<NearFar::Default,Handness::Left>(_result, _ut, _dt, _lt, _rt, _near, _oglNdc);
+ }
- 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 mtxProjInfLh(float* _result, const float _fov[4], float _near, bool _oglNdc = false)
+ {
+ mtxProjInf_impl<NearFar::Default,Handness::Left>(_result, _fov, _near, _oglNdc);
}
- inline void mtxOrthoRh(float* _result, float _left, float _right, float _bottom, float _top, float _near, float _far, float _offset = 0.0f, bool _oglNdc = false)
+ inline void mtxProjInfLh(float* _result, float _fovy, float _aspect, float _near, bool _oglNdc = false)
+ {
+ mtxProjInf_impl<NearFar::Default,Handness::Left>(_result, _fovy, _aspect, _near, _oglNdc);
+ }
+
+ inline void mtxProjInfRh(float* _result, float _ut, float _dt, float _lt, float _rt, float _near, bool _oglNdc = false)
+ {
+ mtxProjInf_impl<NearFar::Default,Handness::Right>(_result, _ut, _dt, _lt, _rt, _near, _oglNdc);
+ }
+
+ inline void mtxProjInfRh(float* _result, const float _fov[4], float _near, bool _oglNdc = false)
+ {
+ mtxProjInf_impl<NearFar::Default,Handness::Right>(_result, _fov, _near, _oglNdc);
+ }
+
+ inline void mtxProjInfRh(float* _result, float _fovy, float _aspect, float _near, bool _oglNdc = false)
+ {
+ mtxProjInf_impl<NearFar::Default,Handness::Right>(_result, _fovy, _aspect, _near, _oglNdc);
+ }
+
+ inline void mtxProjRevInfLh(float* _result, float _ut, float _dt, float _lt, float _rt, float _near, bool _oglNdc = false)
+ {
+ mtxProjInf_impl<NearFar::Reverse,Handness::Left>(_result, _ut, _dt, _lt, _rt, _near, _oglNdc);
+ }
+
+ inline void mtxProjRevInfLh(float* _result, const float _fov[4], float _near, bool _oglNdc = false)
+ {
+ mtxProjInf_impl<NearFar::Reverse,Handness::Left>(_result, _fov, _near, _oglNdc);
+ }
+
+ inline void mtxProjRevInfLh(float* _result, float _fovy, float _aspect, float _near, bool _oglNdc = false)
+ {
+ mtxProjInf_impl<NearFar::Reverse,Handness::Left>(_result, _fovy, _aspect, _near, _oglNdc);
+ }
+
+ inline void mtxProjRevInfRh(float* _result, float _ut, float _dt, float _lt, float _rt, float _near, bool _oglNdc = false)
+ {
+ mtxProjInf_impl<NearFar::Reverse,Handness::Right>(_result, _ut, _dt, _lt, _rt, _near, _oglNdc);
+ }
+
+ inline void mtxProjRevInfRh(float* _result, const float _fov[4], float _near, bool _oglNdc = false)
+ {
+ mtxProjInf_impl<NearFar::Reverse,Handness::Right>(_result, _fov, _near, _oglNdc);
+ }
+
+ inline void mtxProjRevInfRh(float* _result, float _fovy, float _aspect, float _near, bool _oglNdc = false)
+ {
+ mtxProjInf_impl<NearFar::Reverse,Handness::Right>(_result, _fovy, _aspect, _near, _oglNdc);
+ }
+
+ template <Handness::Enum HandnessT>
+ inline void mtxOrtho_impl(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);
@@ -755,7 +877,7 @@ namespace bx
memset(_result, 0, sizeof(float)*16);
_result[ 0] = aa;
_result[ 5] = bb;
- _result[10] = -cc;
+ _result[10] = (Handness::Right == HandnessT) ? -cc : cc;
_result[12] = dd + _offset;
_result[13] = ee;
_result[14] = ff;
@@ -764,7 +886,17 @@ namespace bx
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);
+ mtxOrtho_impl<Handness::Left>(_result, _left, _right, _bottom, _top, _near, _far, _offset, _oglNdc);
+ }
+
+ inline void mtxOrthoLh(float* _result, float _left, float _right, float _bottom, float _top, float _near, float _far, float _offset = 0.0f, bool _oglNdc = false)
+ {
+ mtxOrtho_impl<Handness::Left>(_result, _left, _right, _bottom, _top, _near, _far, _offset, _oglNdc);
+ }
+
+ inline void mtxOrthoRh(float* _result, float _left, float _right, float _bottom, float _top, float _near, float _far, float _offset = 0.0f, bool _oglNdc = false)
+ {
+ mtxOrtho_impl<Handness::Right>(_result, _left, _right, _bottom, _top, _near, _far, _offset, _oglNdc);
}
inline void mtxRotateX(float* _result, float _ax)
diff --git a/3rdparty/bx/include/bx/platform.h b/3rdparty/bx/include/bx/platform.h
index d07e031de34..4ed4752eca7 100644
--- a/3rdparty/bx/include/bx/platform.h
+++ b/3rdparty/bx/include/bx/platform.h
@@ -28,11 +28,12 @@
#define BX_PLATFORM_XBOX360 0
#define BX_PLATFORM_XBOXONE 0
-#define BX_CPU_ARM 0
-#define BX_CPU_JIT 0
-#define BX_CPU_MIPS 0
-#define BX_CPU_PPC 0
-#define BX_CPU_X86 0
+#define BX_CPU_ARM 0
+#define BX_CPU_JIT 0
+#define BX_CPU_MIPS 0
+#define BX_CPU_PPC 0
+#define BX_CPU_RISCV 0
+#define BX_CPU_X86 0
#define BX_ARCH_32BIT 0
#define BX_ARCH_64BIT 0
@@ -84,6 +85,12 @@
# undef BX_CPU_PPC
# define BX_CPU_PPC 1
# define BX_CACHE_LINE_SIZE 128
+#elif defined(__riscv) || \
+ defined(__riscv__) || \
+ defined(RISCVEL)
+# undef BX_CPU_RISCV
+# define BX_CPU_RISCV 1
+# define BX_CACHE_LINE_SIZE 64
#elif defined(_M_IX86) || \
defined(_M_X64) || \
defined(__i386__) || \
@@ -103,7 +110,8 @@
defined(__64BIT__) || \
defined(__mips64) || \
defined(__powerpc64__) || \
- defined(__ppc64__)
+ defined(__ppc64__) || \
+ defined(__LP64__)
# undef BX_ARCH_64BIT
# define BX_ARCH_64BIT 64
#else
@@ -171,10 +179,12 @@
// RaspberryPi compiler defines __linux__
# undef BX_PLATFORM_RPI
# define BX_PLATFORM_RPI 1
-#elif defined(__linux__)
+#elif defined(__linux__) \
+ || defined(__riscv__)
# undef BX_PLATFORM_LINUX
# define BX_PLATFORM_LINUX 1
-#elif defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) || defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__)
+#elif defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) \
+ || defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__)
# undef BX_PLATFORM_IOS
# define BX_PLATFORM_IOS 1
#elif defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
@@ -183,7 +193,7 @@
# define BX_PLATFORM_OSX __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
# else
# define BX_PLATFORM_OSX 1
-# endif // defined(MAC_OS_X_VERSION_MAX_ALLOWED)
+# endif // defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
#elif defined(__EMSCRIPTEN__)
# undef BX_PLATFORM_EMSCRIPTEN
# define BX_PLATFORM_EMSCRIPTEN 1
@@ -283,12 +293,14 @@
#if BX_CPU_ARM
# define BX_CPU_NAME "ARM"
+#elif BX_CPU_JIT
+# define BX_CPU_NAME "JIT-VM"
#elif BX_CPU_MIPS
# define BX_CPU_NAME "MIPS"
#elif BX_CPU_PPC
# define BX_CPU_NAME "PowerPC"
-#elif BX_CPU_JIT
-# define BX_CPU_NAME "JIT-VM"
+#elif BX_CPU_RISCV
+# define BX_CPU_NAME "RISC-V"
#elif BX_CPU_X86
# define BX_CPU_NAME "x86"
#endif // BX_CPU_
diff --git a/3rdparty/bx/include/bx/readerwriter.h b/3rdparty/bx/include/bx/readerwriter.h
index 245d158e742..2f1d4f512cf 100644
--- a/3rdparty/bx/include/bx/readerwriter.h
+++ b/3rdparty/bx/include/bx/readerwriter.h
@@ -230,38 +230,59 @@ namespace bx
{
};
- struct BX_NO_VTABLE FileReaderI : public ReaderSeekerI
+ struct BX_NO_VTABLE ReaderOpenI
{
+ virtual ~ReaderOpenI() = 0;
virtual bool open(const char* _filePath, Error* _err) = 0;
- virtual void close() = 0;
};
- struct BX_NO_VTABLE FileWriterI : public WriterSeekerI
+ inline ReaderOpenI::~ReaderOpenI()
+ {
+ }
+
+ struct BX_NO_VTABLE WriterOpenI
{
+ virtual ~WriterOpenI() = 0;
virtual bool open(const char* _filePath, bool _append, Error* _err) = 0;
+ };
+
+ inline WriterOpenI::~WriterOpenI()
+ {
+ }
+
+ struct BX_NO_VTABLE CloserI
+ {
+ virtual ~CloserI() = 0;
virtual void close() = 0;
};
- inline bool open(FileReaderI* _reader, const char* _filePath, Error* _err = NULL)
+ inline CloserI::~CloserI()
{
- BX_ERROR_USE_TEMP_WHEN_NULL(_err);
- return _reader->open(_filePath, _err);
}
- inline void close(FileReaderI* _reader)
+ struct BX_NO_VTABLE FileReaderI : public ReaderOpenI, public CloserI, public ReaderSeekerI
{
- _reader->close();
+ };
+
+ struct BX_NO_VTABLE FileWriterI : public WriterOpenI, public CloserI, public WriterSeekerI
+ {
+ };
+
+ inline bool open(ReaderOpenI* _reader, const char* _filePath, Error* _err = NULL)
+ {
+ BX_ERROR_USE_TEMP_WHEN_NULL(_err);
+ return _reader->open(_filePath, _err);
}
- inline bool open(FileWriterI* _writer, const char* _filePath, bool _append = false, Error* _err = NULL)
+ inline bool open(WriterOpenI* _writer, const char* _filePath, bool _append = false, Error* _err = NULL)
{
BX_ERROR_USE_TEMP_WHEN_NULL(_err);
return _writer->open(_filePath, _append, _err);
}
- inline void close(FileWriterI* _writer)
+ inline void close(CloserI* _reader)
{
- _writer->close();
+ _reader->close();
}
struct BX_NO_VTABLE MemoryBlockI
diff --git a/3rdparty/bx/scripts/toolchain.lua b/3rdparty/bx/scripts/toolchain.lua
index e87e5f3b236..4f37458df07 100644
--- a/3rdparty/bx/scripts/toolchain.lua
+++ b/3rdparty/bx/scripts/toolchain.lua
@@ -37,6 +37,7 @@ function toolchain(_buildDir, _libDir)
{ "ps4", "PS4" },
{ "qnx-arm", "QNX/Blackberry - ARM" },
{ "rpi", "RaspberryPi" },
+ { "riscv", "RISC-V" },
},
}
@@ -336,6 +337,13 @@ function toolchain(_buildDir, _libDir)
elseif "rpi" == _OPTIONS["gcc"] then
location (path.join(_buildDir, "projects", _ACTION .. "-rpi"))
+
+ elseif "riscv" == _OPTIONS["gcc"] then
+ premake.gcc.cc = "/opt/riscv/bin/riscv64-unknown-elf-gcc"
+ premake.gcc.cxx = "/opt/riscv/bin/riscv64-unknown-elf-g++"
+ premake.gcc.ar = "/opt/riscv/bin/riscv64-unknown-elf-ar"
+ location (path.join(_buildDir, "projects", _ACTION .. "-riscv"))
+
end
elseif _ACTION == "vs2012" or _ACTION == "vs2013" or _ACTION == "vs2015" then
@@ -1128,6 +1136,17 @@ function toolchain(_buildDir, _libDir)
"-Wl,--gc-sections",
}
+ configuration { "riscv" }
+ targetdir (path.join(_buildDir, "riscv/bin"))
+ objdir (path.join(_buildDir, "riscv/obj"))
+ buildoptions {
+ "-Wunused-value",
+ "-Wundef",
+ }
+ buildoptions_cpp {
+ "-std=c++0x",
+ }
+
configuration {} -- reset configuration
return true
@@ -1191,6 +1210,7 @@ function strip()
-- .. "-s EMTERPRETIFY_ASYNC=1 "
.. "-s TOTAL_MEMORY=268435456 "
-- .. "-s ALLOW_MEMORY_GROWTH=1 "
+-- .. "-s USE_WEBGL2=1 "
.. "--memory-init-file 1 "
.. "\"$(TARGET)\" -o \"$(TARGET)\".html "
-- .. "--preload-file ../../../examples/runtime@/"
diff --git a/3rdparty/bx/scripts/unittest++.lua b/3rdparty/bx/scripts/unittest++.lua
index 3a52b246b3e..cf183c1f2f0 100644
--- a/3rdparty/bx/scripts/unittest++.lua
+++ b/3rdparty/bx/scripts/unittest++.lua
@@ -15,7 +15,7 @@ project "UnitTest++"
"../3rdparty/UnitTest++/src/*.h",
}
- configuration { "linux or osx or android-* or *nacl* or ps4" }
+ configuration { "linux or osx or android-* or *nacl* or ps4 or rpi or riscv" }
files {
"../3rdparty/UnitTest++/src/Posix/**.cpp",
"../3rdparty/UnitTest++/src/Posix/**.h",
diff --git a/3rdparty/bx/tools/bin/darwin/genie b/3rdparty/bx/tools/bin/darwin/genie
index d938ff91dc5..4ecf8c000ae 100644
--- a/3rdparty/bx/tools/bin/darwin/genie
+++ b/3rdparty/bx/tools/bin/darwin/genie
Binary files differ
diff --git a/3rdparty/bx/tools/bin/darwin/ninja b/3rdparty/bx/tools/bin/darwin/ninja
new file mode 100644
index 00000000000..64fcacc550c
--- /dev/null
+++ b/3rdparty/bx/tools/bin/darwin/ninja
Binary files differ
diff --git a/3rdparty/bx/tools/bin/linux/genie b/3rdparty/bx/tools/bin/linux/genie
index 1487e071d06..8db245dfb99 100644
--- a/3rdparty/bx/tools/bin/linux/genie
+++ b/3rdparty/bx/tools/bin/linux/genie
Binary files differ
diff --git a/3rdparty/bx/tools/bin/linux/ninja b/3rdparty/bx/tools/bin/linux/ninja
new file mode 100644
index 00000000000..e4a6202d999
--- /dev/null
+++ b/3rdparty/bx/tools/bin/linux/ninja
Binary files differ
diff --git a/3rdparty/bx/tools/bin/windows/genie.exe b/3rdparty/bx/tools/bin/windows/genie.exe
index 232485d34fd..0553e86fc45 100644
--- a/3rdparty/bx/tools/bin/windows/genie.exe
+++ b/3rdparty/bx/tools/bin/windows/genie.exe
Binary files differ
diff --git a/3rdparty/bx/tools/bin/windows/ninja.exe b/3rdparty/bx/tools/bin/windows/ninja.exe
new file mode 100644
index 00000000000..40f662e32ac
--- /dev/null
+++ b/3rdparty/bx/tools/bin/windows/ninja.exe
Binary files differ